dimas-b commented on code in PR #932:
URL: https://github.com/apache/polaris/pull/932#discussion_r1939840795


##########
quarkus/admin/src/testFixtures/java/org/apache/polaris/admintool/PostgresTestResourceLifecycleManager.java:
##########
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.admintool;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import io.quarkus.test.common.DevServicesContext;
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import java.io.File;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Comparator;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.testcontainers.containers.PostgreSQLContainer;
+import org.testcontainers.utility.DockerImageName;
+
+public class PostgresTestResourceLifecycleManager
+    implements QuarkusTestResourceLifecycleManager, 
DevServicesContext.ContextAware {
+
+  public static final String INIT_SCRIPT = "init-script";
+
+  private PostgreSQLContainer<?> postgres;
+  private String initScript;
+  private DevServicesContext context;
+  private Path rootDir;
+
+  @Override
+  public void init(Map<String, String> initArgs) {
+    initScript = initArgs.get(INIT_SCRIPT);
+  }
+
+  @Override
+  public void setIntegrationTestContext(DevServicesContext context) {
+    this.context = context;
+  }
+
+  @Override
+  @SuppressWarnings("resource")
+  public Map<String, String> start() {
+    postgres =
+        new PostgreSQLContainer<>(DockerImageName.parse("postgres:17-alpine"))
+            .withDatabaseName("polaris_realm1")
+            .withUsername("polaris")
+            .withPassword("polaris");
+    if (initScript != null) {
+      postgres.withInitScript(initScript);
+    }
+    context.containerNetworkId().ifPresent(postgres::withNetworkMode);
+    postgres.start();
+    return Map.of(
+        "polaris.persistence.eclipselink.configuration-file", 
createPersistenceXml().toString());
+  }
+
+  @Override
+  public void stop() {
+    if (postgres != null) {
+      try {
+        postgres.stop();
+      } finally {
+        postgres = null;
+      }
+    }
+    if (rootDir != null) {
+      try (Stream<Path> paths = Files.walk(rootDir)) {
+        boolean allDeleted =
+            
paths.sorted(Comparator.reverseOrder()).map(Path::toFile).allMatch(File::delete);

Review Comment:
   Why not  `org.apache.commons.io.FileUtils.deleteDirectory(...)`?



##########
quarkus/admin/src/main/resources/org/apache/polaris/admintool/banner.txt:
##########
@@ -0,0 +1,20 @@
+
+ @@@@   @@@  @       @    @@@@   @  @@@@    @@@@    @  @@@@@  @    @     @@@   
@@@@
+ @   @ @   @ @      @ @   @   @  @  @@     @       @ @   @   @ @   @    @   @ 
@     
+ @@@@  @   @ @     @@@@@  @@@@   @    @@   @      @@@@@  @  @@@@@  @    @   @ 
@  @@@
+ @      @@@  @@@@ @     @ @  @@  @  @@@@    @@@@ @     @ @ @@   @@ @@@@  @@@   
@@@@ 

Review Comment:
   nit: maybe "Polaris Admin Tool"?... Cf. https://www.asciiart.eu/



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to