99
1010import org .apache .logging .log4j .LogManager ;
1111import org .apache .logging .log4j .Logger ;
12- import org .junit .jupiter .api .AfterAll ;
13- import org .junit .jupiter .api .BeforeAll ;
1412import org .junit .jupiter .api .Test ;
1513import org .testcontainers .containers .ComposeContainer ;
16- import org .testcontainers .containers .wait .strategy .LogMessageWaitStrategy ;
17-
18- import java .io .File ;
19- import java .io .IOException ;
20- import java .net .URISyntaxException ;
21- import java .time .Duration ;
22- import java .util .HashMap ;
23- import java .util .Properties ;
24- import java .util .stream .Collectors ;
2514
2615import cloud .katta .protocols .hub .HubSession ;
27- import cloud .katta .testsetup .AbstractHubTest ;
2816import cloud .katta .testsetup .HubTestConfig ;
29- import cloud .katta .testsetup .HubTestSetupDockerExtension ;
3017
31- class StorageProfileArchiveIT extends AbstractHubTest {
18+ class StorageProfileArchiveIT extends AbtractAdminCliIT {
3219 private static final Logger log = LogManager .getLogger (StorageProfileArchiveIT .class .getName ());
3320 public static ComposeContainer compose ;
3421
@@ -43,41 +30,4 @@ public void testHubWorkflow() throws Exception {
4330
4431 new StorageProfileArchive ().call ("http://localhost:8280" , accessToken , "732D43FA-3716-46C4-B931-66EA5405EF1C" );
4532 }
46-
47- @ BeforeAll
48- public static void setupDocker () throws URISyntaxException , IOException {
49- final HubTestConfig .Setup .DockerConfig configuration = new HubTestConfig .Setup .DockerConfig ("/docker-compose-minio-localhost-hub.yml" , "/.local.env" , "local" , "admin" , "admin" , "top-secret" );
50- log .info ("Setup docker {}" , configuration );
51- final Properties props = new Properties ();
52- props .load (StorageProfileArchiveIT .class .getResourceAsStream (configuration .envFile ));
53- final HashMap <String , String > env = props .entrySet ().stream ().collect (
54- Collectors .toMap (
55- e -> String .valueOf (e .getKey ()),
56- e -> String .valueOf (e .getValue ()),
57- (prev , next ) -> next , HashMap ::new
58- ));
59- env .put ("HUB_ADMIN_USER" , configuration .hubAdminUser );
60- env .put ("HUB_ADMIN_PASSWORD" , configuration .hubAdminPassword );
61- env .put ("HUB_KEYCLOAK_SYSTEM_CLIENT_SECRET" , configuration .hubKeycloakSystemClientSecret );
62- compose = new ComposeContainer (
63- new File (HubTestSetupDockerExtension .class .getResource (configuration .composeFile ).toURI ()))
64- .withLocalCompose (true )
65- .withPull (true )
66- .withEnv (env )
67- .withOptions (configuration .profile == null ? "" : String .format ("--profile=%s" , configuration .profile ))
68- .waitingFor ("wait-1" , new LogMessageWaitStrategy ().withRegEx (".*exit 0.*" ).withStartupTimeout (Duration .ofMinutes (2 )));
69- compose .start ();
70-
71- log .info ("Done setup docker {}" , configuration );
72- }
73-
74- @ AfterAll
75- public static void teardownDocker () {
76- try {
77- compose .stop ();
78- }
79- catch (Exception e ) {
80- log .warn (e );
81- }
82- }
8333}
0 commit comments