From 9b83d05c2e4e30d9ed128d92225c708a8211383f Mon Sep 17 00:00:00 2001 From: Ladislav Dokoupil Date: Tue, 18 Apr 2023 14:52:34 +0200 Subject: [PATCH] make default test parameters unique --- .../aws/cloudformation/AwsTestConstants.java | 8 ++--- .../ec2/Ec2DeploySuiteTests.java | 2 ++ .../ec2/suitetests/AwsEc2DeployFirstTest.java | 8 ++--- .../AwsEc2UndeployedSecondTest.java | 6 ++-- .../ec2Domain/DomainEc2DeploySuiteTests.java | 2 ++ .../AwsDomainEc2DeployFirstTest.java | 8 ++--- .../AwsDomainEc2UndeployedSecondTest.java | 6 ++-- .../di/AwsDomainManagementClientTests.java | 11 +++--- .../AwsStandaloneManagementClientTests.java | 11 +++--- .../src/test/resources/sunstone.properties | 3 ++ .../aws/cloudformation/AwsTestConstants.java | 14 ++++---- .../MultipleAwsCfTemplatesRepetableTest.java | 22 ++++++++---- .../MultipleAwsCfTemplatesTest.java | 22 ++++++++---- ...pleDifferentRegionsAwsCfTemplatesTest.java | 34 +++++++++++++------ .../SingleAwsCfTemplateTest.java | 16 ++++++--- .../SingleTransitiveAwsCfTemplateTest.java | 14 +++++--- .../di/SunstoneResourceAwsSuiteTests.java | 5 ++- .../di/suitetests/AwsEC2InstanceTests.java | 12 +++---- .../di/suitetests/AwsHostnameTests.java | 12 +++---- .../suite/tests/PerSuiteAwsCfTemplate.java | 16 ++++++--- .../tests/PerSuitePerClassAwsCfTemplates.java | 22 ++++++++---- .../tests/TwoSamePerSuiteAwsCfTemplates.java | 18 +++++++--- aws/src/test/resources/sunstone.properties | 5 +++ .../armTemplates/AzureTestConstants.java | 6 +++- .../archiveDeploy/vm/VmDeploySuiteTests.java | 3 +- .../vm/suitetests/AzureVmDeployFirstTest.java | 10 +++--- .../AzureVmUndeployedSecondTest.java | 6 ++-- .../vmDomain/VmDomainDeploySuiteTests.java | 3 +- .../AzureDomainVmDeployFirstTest.java | 9 +++-- .../AzureDomainVmUndeployedSecondTest.java | 9 ++--- .../webapp/WebAppDeploySuiteTests.java | 3 +- .../AzureWebAppDeployFirstTest.java | 8 ++--- .../AzureWebAppUndeployedSecondTest.java | 7 ++-- .../di/AzDomainManagementClientTests.java | 17 ++++------ .../di/AzStandaloneManagementClientTests.java | 13 ++++--- .../src/test/resources/sunstone.properties | 5 ++- .../armTemplates/AzureTestConstants.java | 5 ++- .../MultipleAzArmTemplatesRepetableTest.java | 18 ++++++---- .../MultipleAzArmTemplatesTest.java | 18 ++++++---- ...ipleDifferentGroupsAzArmTemplatesTest.java | 24 ++++++++----- .../armTemplates/SingleAzArmTemplateTest.java | 14 +++++--- .../SingleTransitiveAzArmTemplateTest.java | 11 ++++-- .../azure/armTemplates/di/AzPgSqlTests.java | 24 ++++++------- .../azure/armTemplates/di/AzVmTests.java | 25 +++++++------- .../armTemplates/di/AzureWebAppTests.java | 18 +++++----- .../suite/AzureArmTemplatesSuiteTest.java | 4 ++- .../suite/tests/PerSuiteAzArmTemplate.java | 14 +++++--- .../tests/PerSuitePerClassAzArmTemplates.java | 25 +++++++++----- .../tests/TwoSamePerSuiteAzArmTemplates.java | 12 ++++--- azure/src/test/resources/sunstone.properties | 5 ++- 50 files changed, 363 insertions(+), 230 deletions(-) diff --git a/aws-wildfly/src/test/java/aws/cloudformation/AwsTestConstants.java b/aws-wildfly/src/test/java/aws/cloudformation/AwsTestConstants.java index ee237a5b..db1518a4 100644 --- a/aws-wildfly/src/test/java/aws/cloudformation/AwsTestConstants.java +++ b/aws-wildfly/src/test/java/aws/cloudformation/AwsTestConstants.java @@ -2,12 +2,8 @@ public class AwsTestConstants { - public static final String TAG = "sunstoneKeyTag"; - public static final String NAME_1 = "sunstoneKeyName1"; - public static final String NAME_2 = "sunstoneKeyName2"; - public static final String instanceName = "${non.existing:eapSunstoneInjectInstance}"; - // must be same as in MP Config - public static final String region = "${ec2.region:us-east-1}"; + public static final String instanceName = "${sunstone.test.instance.name}"; + public static final String region = "${sunstone.aws.region}"; public static final String mgmtUser = "${non.existing:admin}"; public static final String mgmtPassword = "${non.existing:pass.1234}"; public static final String mgmtPort = "${non.existing:9990}"; diff --git a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/Ec2DeploySuiteTests.java b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/Ec2DeploySuiteTests.java index 5bec7bf8..0185096e 100644 --- a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/Ec2DeploySuiteTests.java +++ b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/Ec2DeploySuiteTests.java @@ -1,6 +1,7 @@ package aws.cloudformation.archiveDeploy.ec2; +import aws.cloudformation.AwsTestConstants; import aws.cloudformation.archiveDeploy.ec2.suitetests.AwsEc2DeployFirstTest; import aws.cloudformation.archiveDeploy.ec2.suitetests.AwsEc2UndeployedSecondTest; import org.junit.platform.suite.api.SelectClasses; @@ -14,4 +15,5 @@ @Suite @SelectClasses({AwsEc2DeployFirstTest.class, AwsEc2UndeployedSecondTest.class}) public class Ec2DeploySuiteTests { + public static final String suiteInstanceName = "ec2-deploy-" + AwsTestConstants.instanceName; } diff --git a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/suitetests/AwsEc2DeployFirstTest.java b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/suitetests/AwsEc2DeployFirstTest.java index 83947a2d..e1c20e46 100644 --- a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/suitetests/AwsEc2DeployFirstTest.java +++ b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/suitetests/AwsEc2DeployFirstTest.java @@ -1,7 +1,7 @@ package aws.cloudformation.archiveDeploy.ec2.suitetests; -import aws.cloudformation.AwsTestConstants; +import aws.cloudformation.archiveDeploy.ec2.Ec2DeploySuiteTests; import sunstone.aws.annotation.AwsEc2Instance; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -21,15 +21,15 @@ import static aws.cloudformation.AwsTestConstants.region; @WithAwsCfTemplate(parameters = { - @Parameter(k = "instanceName", v = AwsTestConstants.instanceName) + @Parameter(k = "instanceName", v = Ec2DeploySuiteTests.suiteInstanceName) }, template = "sunstone/aws/cloudformation/eap.yaml", region = region, perSuite = true) public class AwsEc2DeployFirstTest { - @AwsEc2Instance(nameTag = AwsTestConstants.instanceName, region = region) + @AwsEc2Instance(nameTag = Ec2DeploySuiteTests.suiteInstanceName, region = region) Hostname hostname; @Deployment(name = "testapp.war") - @AwsEc2Instance(nameTag = AwsTestConstants.instanceName, region = region) + @AwsEc2Instance(nameTag = Ec2DeploySuiteTests.suiteInstanceName, region = region) static WebArchive deploy() { return ShrinkWrap.create(WebArchive.class) .addAsWebResource(new StringAsset("Hello World"), "index.jsp"); diff --git a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/suitetests/AwsEc2UndeployedSecondTest.java b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/suitetests/AwsEc2UndeployedSecondTest.java index 106ca220..31763099 100644 --- a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/suitetests/AwsEc2UndeployedSecondTest.java +++ b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2/suitetests/AwsEc2UndeployedSecondTest.java @@ -1,7 +1,7 @@ package aws.cloudformation.archiveDeploy.ec2.suitetests; -import aws.cloudformation.AwsTestConstants; +import aws.cloudformation.archiveDeploy.ec2.Ec2DeploySuiteTests; import sunstone.aws.annotation.AwsEc2Instance; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -17,11 +17,11 @@ import static aws.cloudformation.AwsTestConstants.region; @WithAwsCfTemplate(parameters = { - @Parameter(k = "instanceName", v = AwsTestConstants.instanceName) + @Parameter(k = "instanceName", v = Ec2DeploySuiteTests.suiteInstanceName) }, template = "sunstone/aws/cloudformation/eap.yaml", region = region, perSuite = true) public class AwsEc2UndeployedSecondTest { - @AwsEc2Instance(nameTag = AwsTestConstants.instanceName, region = region) + @AwsEc2Instance(nameTag = Ec2DeploySuiteTests.suiteInstanceName, region = region) Hostname hostname; @Test diff --git a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/DomainEc2DeploySuiteTests.java b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/DomainEc2DeploySuiteTests.java index b895307d..07d38636 100644 --- a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/DomainEc2DeploySuiteTests.java +++ b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/DomainEc2DeploySuiteTests.java @@ -1,6 +1,7 @@ package aws.cloudformation.archiveDeploy.ec2Domain; +import aws.cloudformation.AwsTestConstants; import aws.cloudformation.archiveDeploy.ec2Domain.suitetests.AwsDomainEc2DeployFirstTest; import aws.cloudformation.archiveDeploy.ec2Domain.suitetests.AwsDomainEc2UndeployedSecondTest; import org.junit.platform.suite.api.SelectClasses; @@ -14,4 +15,5 @@ @Suite @SelectClasses({AwsDomainEc2DeployFirstTest.class, AwsDomainEc2UndeployedSecondTest.class}) public class DomainEc2DeploySuiteTests { + public static final String suiteInstanceName = "domain-ec2-deploy-" + AwsTestConstants.instanceName; } diff --git a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/suitetests/AwsDomainEc2DeployFirstTest.java b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/suitetests/AwsDomainEc2DeployFirstTest.java index f19e9b1d..d7974606 100644 --- a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/suitetests/AwsDomainEc2DeployFirstTest.java +++ b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/suitetests/AwsDomainEc2DeployFirstTest.java @@ -1,7 +1,7 @@ package aws.cloudformation.archiveDeploy.ec2Domain.suitetests; -import aws.cloudformation.AwsTestConstants; +import aws.cloudformation.archiveDeploy.ec2Domain.DomainEc2DeploySuiteTests; import sunstone.annotation.OperatingMode; import sunstone.annotation.WildFly; import sunstone.aws.annotation.AwsEc2Instance; @@ -23,16 +23,16 @@ import static aws.cloudformation.AwsTestConstants.region; @WithAwsCfTemplate(parameters = { - @Parameter(k = "instanceName", v = AwsTestConstants.instanceName) + @Parameter(k = "instanceName", v = DomainEc2DeploySuiteTests.suiteInstanceName) }, template = "sunstone/aws/cloudformation/eapDomain.yaml", region = region, perSuite = true) public class AwsDomainEc2DeployFirstTest { - @AwsEc2Instance(nameTag = AwsTestConstants.instanceName, region = region) + @AwsEc2Instance(nameTag = DomainEc2DeploySuiteTests.suiteInstanceName, region = region) @WildFly(mode = OperatingMode.DOMAIN) Hostname hostname; @Deployment(name = "testapp.war") - @AwsEc2Instance(nameTag = AwsTestConstants.instanceName, region = region) + @AwsEc2Instance(nameTag = DomainEc2DeploySuiteTests.suiteInstanceName, region = region) @WildFly(mode = OperatingMode.DOMAIN) static WebArchive deploy() { return ShrinkWrap.create(WebArchive.class) diff --git a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/suitetests/AwsDomainEc2UndeployedSecondTest.java b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/suitetests/AwsDomainEc2UndeployedSecondTest.java index 42ad461b..101941df 100644 --- a/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/suitetests/AwsDomainEc2UndeployedSecondTest.java +++ b/aws-wildfly/src/test/java/aws/cloudformation/archiveDeploy/ec2Domain/suitetests/AwsDomainEc2UndeployedSecondTest.java @@ -1,7 +1,7 @@ package aws.cloudformation.archiveDeploy.ec2Domain.suitetests; -import aws.cloudformation.AwsTestConstants; +import aws.cloudformation.archiveDeploy.ec2Domain.DomainEc2DeploySuiteTests; import sunstone.annotation.OperatingMode; import sunstone.annotation.WildFly; import sunstone.aws.annotation.AwsEc2Instance; @@ -19,11 +19,11 @@ import static aws.cloudformation.AwsTestConstants.region; @WithAwsCfTemplate(parameters = { - @Parameter(k = "instanceName", v = AwsTestConstants.instanceName) + @Parameter(k = "instanceName", v = DomainEc2DeploySuiteTests.suiteInstanceName) }, template = "sunstone/aws/cloudformation/eapDomain.yaml", region = region, perSuite = true) public class AwsDomainEc2UndeployedSecondTest { - @AwsEc2Instance(nameTag = AwsTestConstants.instanceName, region = region) + @AwsEc2Instance(nameTag = DomainEc2DeploySuiteTests.suiteInstanceName, region = region) @WildFly(mode = OperatingMode.DOMAIN) Hostname hostname; diff --git a/aws-wildfly/src/test/java/aws/cloudformation/di/AwsDomainManagementClientTests.java b/aws-wildfly/src/test/java/aws/cloudformation/di/AwsDomainManagementClientTests.java index a9afaab0..85607d3e 100644 --- a/aws-wildfly/src/test/java/aws/cloudformation/di/AwsDomainManagementClientTests.java +++ b/aws-wildfly/src/test/java/aws/cloudformation/di/AwsDomainManagementClientTests.java @@ -21,17 +21,18 @@ * So the idea is to have only one testcase due to performance. */ @WithAwsCfTemplate(parameters = { - @Parameter(k = "instanceName", v = instanceName) + @Parameter(k = "instanceName", v = AwsDomainManagementClientTests.classInstanceName) }, template = "sunstone/aws/cloudformation/eapDomain.yaml", region = region) public class AwsDomainManagementClientTests { + protected static final String classInstanceName = "AwsDomainManagementClientTests-" + instanceName; - @AwsEc2Instance(nameTag = instanceName) + @AwsEc2Instance(nameTag = classInstanceName) @WildFly(mode = OperatingMode.DOMAIN) static OnlineManagementClient staticMgmtClient; - @AwsEc2Instance(nameTag = instanceName, region = region) + @AwsEc2Instance(nameTag = classInstanceName, region = region) @WildFly( mode = OperatingMode.DOMAIN, domain = @DomainMode( @@ -44,7 +45,7 @@ public class AwsDomainManagementClientTests { ) static OnlineManagementClient staticMgmtClientSpecified; - @AwsEc2Instance(nameTag = instanceName, region = region) + @AwsEc2Instance(nameTag = classInstanceName, region = region) @WildFly( mode = OperatingMode.DOMAIN, domain = @DomainMode( @@ -57,7 +58,7 @@ public class AwsDomainManagementClientTests { ) OnlineManagementClient mgmtClientSpecified; - @AwsEc2Instance(nameTag = instanceName) + @AwsEc2Instance(nameTag = classInstanceName) @WildFly(mode = OperatingMode.DOMAIN) OnlineManagementClient mgmtClient; diff --git a/aws-wildfly/src/test/java/aws/cloudformation/di/AwsStandaloneManagementClientTests.java b/aws-wildfly/src/test/java/aws/cloudformation/di/AwsStandaloneManagementClientTests.java index f298dbe0..85a359c4 100644 --- a/aws-wildfly/src/test/java/aws/cloudformation/di/AwsStandaloneManagementClientTests.java +++ b/aws-wildfly/src/test/java/aws/cloudformation/di/AwsStandaloneManagementClientTests.java @@ -29,23 +29,24 @@ * So the idea is to have only one testcase due to performance. */ @WithAwsCfTemplate(parameters = { - @Parameter(k = "instanceName", v = instanceName) + @Parameter(k = "instanceName", v = AwsStandaloneManagementClientTests.classInstanceName) }, template = "sunstone/aws/cloudformation/eap.yaml", region = region) public class AwsStandaloneManagementClientTests { + protected static final String classInstanceName = "AwsStandaloneManagementClientTests-" + instanceName; - @AwsEc2Instance(nameTag = instanceName) + @AwsEc2Instance(nameTag = classInstanceName) static OnlineManagementClient staticMgmtClient; - @AwsEc2Instance(nameTag = instanceName, region = region) + @AwsEc2Instance(nameTag = classInstanceName, region = region) @WildFly(mode = OperatingMode.STANDALONE, standalone = @StandaloneMode(user = mgmtUser, password = mgmtPassword, port = mgmtPort)) static OnlineManagementClient staticMgmtClientSpecified; - @AwsEc2Instance(nameTag = instanceName, region = region) + @AwsEc2Instance(nameTag = classInstanceName, region = region) @WildFly(mode = OperatingMode.STANDALONE, standalone = @StandaloneMode(user = mgmtUser, password = mgmtPassword, port = mgmtPort)) OnlineManagementClient mgmtClientSpecified; - @AwsEc2Instance(nameTag = instanceName) + @AwsEc2Instance(nameTag = classInstanceName) OnlineManagementClient mgmtClient; @BeforeAll diff --git a/aws-wildfly/src/test/resources/sunstone.properties b/aws-wildfly/src/test/resources/sunstone.properties index 7f473c8b..dbf62e5f 100644 --- a/aws-wildfly/src/test/resources/sunstone.properties +++ b/aws-wildfly/src/test/resources/sunstone.properties @@ -8,3 +8,6 @@ sunstone.wildfly.mgmt.password=pass.1234 sunstone.wildfly.mgmt.connection.timeout=120000 sunstone.wildfly.mgmt.host=master sunstone.wildfly.mgmt.profile=default +sunstone.test.instance.name=eapSunstoneInjectInstance-${ts.test.run} + +ts.test.run=defaultrun diff --git a/aws/src/test/java/aws/cloudformation/AwsTestConstants.java b/aws/src/test/java/aws/cloudformation/AwsTestConstants.java index ee237a5b..bae2c1e4 100644 --- a/aws/src/test/java/aws/cloudformation/AwsTestConstants.java +++ b/aws/src/test/java/aws/cloudformation/AwsTestConstants.java @@ -1,13 +1,15 @@ package aws.cloudformation; +import sunstone.aws.impl.AwsConfig; + public class AwsTestConstants { - public static final String TAG = "sunstoneKeyTag"; - public static final String NAME_1 = "sunstoneKeyName1"; - public static final String NAME_2 = "sunstoneKeyName2"; - public static final String instanceName = "${non.existing:eapSunstoneInjectInstance}"; - // must be same as in MP Config - public static final String region = "${ec2.region:us-east-1}"; + public static final String TAG = "${sunstone.test.keypair.tag}"; + public static final String NAME_1 = "${sunstone.test.keypair.name1}"; + public static final String NAME_2 = "${sunstone.test.keypair.name2}"; + public static final String instanceName = "${sunstone.test.instance.name}"; + public static final String region = "${"+ AwsConfig.REGION + "}"; + public static final String region2 = "${sunstone.aws.region2}"; public static final String mgmtUser = "${non.existing:admin}"; public static final String mgmtPassword = "${non.existing:pass.1234}"; public static final String mgmtPort = "${non.existing:9990}"; diff --git a/aws/src/test/java/aws/cloudformation/MultipleAwsCfTemplatesRepetableTest.java b/aws/src/test/java/aws/cloudformation/MultipleAwsCfTemplatesRepetableTest.java index d959c2d5..ad00fd99 100644 --- a/aws/src/test/java/aws/cloudformation/MultipleAwsCfTemplatesRepetableTest.java +++ b/aws/src/test/java/aws/cloudformation/MultipleAwsCfTemplatesRepetableTest.java @@ -6,6 +6,7 @@ import software.amazon.awssdk.services.ec2.Ec2Client; import software.amazon.awssdk.services.ec2.model.KeyPairInfo; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.aws.annotation.WithAwsCfTemplate; import sunstone.aws.annotation.WithAwsCfTemplateRepeatable; @@ -17,19 +18,28 @@ @WithAwsCfTemplate(parameters = { @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_1)}, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1"), + template = "sunstone/aws/cloudformation/keyPair.yaml"), @WithAwsCfTemplate(parameters = { @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_2)}, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1") + template = "sunstone/aws/cloudformation/keyPair.yaml") }) public class MultipleAwsCfTemplatesRepetableTest { static Ec2Client client; + @SunstoneProperty(expression=AwsTestConstants.NAME_1) + static String keyName1; + @SunstoneProperty(expression=AwsTestConstants.NAME_2) + static String keyName2; + @SunstoneProperty(expression=AwsTestConstants.TAG) + static String keyTag; + @SunstoneProperty(expression = AwsTestConstants.region) + static String region; + @BeforeAll public static void setup() { - client = AwsTestUtils.getEC2Client("us-east-1"); + client = AwsTestUtils.getEC2Client(region); } @AfterAll @@ -39,9 +49,9 @@ public static void close() { @Test public void resourcesCreated() { - List keys = AwsTestUtils.findEC2KeysByTag(client, "tag", AwsTestConstants.TAG); + List keys = AwsTestUtils.findEC2KeysByTag(client, "tag", keyTag); assertThat(keys.size()).isEqualTo(2); - assertThat(keys).anyMatch(key -> key.keyName().equals(AwsTestConstants.NAME_1)); - assertThat(keys).anyMatch(key -> key.keyName().equals(AwsTestConstants.NAME_2)); + assertThat(keys).anyMatch(key -> key.keyName().equals(keyName1)); + assertThat(keys).anyMatch(key -> key.keyName().equals(keyName2)); } } diff --git a/aws/src/test/java/aws/cloudformation/MultipleAwsCfTemplatesTest.java b/aws/src/test/java/aws/cloudformation/MultipleAwsCfTemplatesTest.java index 3bba4c2b..7c9add9e 100644 --- a/aws/src/test/java/aws/cloudformation/MultipleAwsCfTemplatesTest.java +++ b/aws/src/test/java/aws/cloudformation/MultipleAwsCfTemplatesTest.java @@ -6,6 +6,7 @@ import software.amazon.awssdk.services.ec2.Ec2Client; import software.amazon.awssdk.services.ec2.model.KeyPairInfo; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.aws.annotation.WithAwsCfTemplate; import java.util.List; @@ -17,19 +18,28 @@ @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_1) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1") + template = "sunstone/aws/cloudformation/keyPair.yaml") @WithAwsCfTemplate(parameters = { @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_2) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1") + template = "sunstone/aws/cloudformation/keyPair.yaml") public class MultipleAwsCfTemplatesTest { static Ec2Client client; + @SunstoneProperty(expression=AwsTestConstants.NAME_1) + static String keyName1; + @SunstoneProperty(expression=AwsTestConstants.NAME_2) + static String keyName2; + @SunstoneProperty(expression=AwsTestConstants.TAG) + static String keyTag; + @SunstoneProperty(expression = AwsTestConstants.region) + static String region; + @BeforeAll public static void setup() { - client = AwsTestUtils.getEC2Client("us-east-1"); + client = AwsTestUtils.getEC2Client(region); } @AfterAll @@ -39,10 +49,10 @@ public static void close() { @Test public void resourcesCreated() { - List keys = AwsTestUtils.findEC2KeysByTag(client, "tag", AwsTestConstants.TAG); + List keys = AwsTestUtils.findEC2KeysByTag(client, "tag", keyTag); assertThat(keys.size()).isEqualTo(2); - assertThat(keys).anyMatch(key -> key.keyName().equals(AwsTestConstants.NAME_1)); - assertThat(keys).anyMatch(key -> key.keyName().equals(AwsTestConstants.NAME_2)); + assertThat(keys).anyMatch(key -> key.keyName().equals(keyName1)); + assertThat(keys).anyMatch(key -> key.keyName().equals(keyName2)); } } diff --git a/aws/src/test/java/aws/cloudformation/MultipleDifferentRegionsAwsCfTemplatesTest.java b/aws/src/test/java/aws/cloudformation/MultipleDifferentRegionsAwsCfTemplatesTest.java index e535ffc7..0f6b612e 100644 --- a/aws/src/test/java/aws/cloudformation/MultipleDifferentRegionsAwsCfTemplatesTest.java +++ b/aws/src/test/java/aws/cloudformation/MultipleDifferentRegionsAwsCfTemplatesTest.java @@ -6,6 +6,7 @@ import software.amazon.awssdk.services.ec2.Ec2Client; import software.amazon.awssdk.services.ec2.model.KeyPairInfo; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.aws.annotation.WithAwsCfTemplate; import java.util.List; @@ -17,40 +18,51 @@ @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_1) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1") + template = "sunstone/aws/cloudformation/keyPair.yaml") @WithAwsCfTemplate(parameters = { @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_2) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-2") + template = "sunstone/aws/cloudformation/keyPair.yaml", region = AwsTestConstants.region2) public class MultipleDifferentRegionsAwsCfTemplatesTest { - static Ec2Client clientUsEast1; - static Ec2Client clientUsEast2; + static Ec2Client clientRegion1; + static Ec2Client clientRegion2; + + @SunstoneProperty(expression=AwsTestConstants.NAME_1) + static String keyName1; + @SunstoneProperty(expression=AwsTestConstants.NAME_2) + static String keyName2; + @SunstoneProperty(expression=AwsTestConstants.TAG) + static String keyTag; + @SunstoneProperty(expression = AwsTestConstants.region) + static String region; + @SunstoneProperty(expression = AwsTestConstants.region2) + static String region2; @BeforeAll public static void setup() { - clientUsEast1 = AwsTestUtils.getEC2Client("us-east-1"); - clientUsEast2 = AwsTestUtils.getEC2Client("us-east-2"); + clientRegion1 = AwsTestUtils.getEC2Client(region); + clientRegion2 = AwsTestUtils.getEC2Client(region2); } @AfterAll public static void close() { - clientUsEast1.close(); + clientRegion1.close(); } @Test public void usEast1resourcesCreated() { - List keys = AwsTestUtils.findEC2KeysByTag(clientUsEast1, "tag", AwsTestConstants.TAG); + List keys = AwsTestUtils.findEC2KeysByTag(clientRegion1, "tag", keyTag); assertThat(keys.size()).isEqualTo(1); - assertThat(keys.get(0).keyName()).isEqualTo(AwsTestConstants.NAME_1); + assertThat(keys.get(0).keyName()).isEqualTo(keyName1); } @Test public void usEast2resourcesCreated() { - List keys = AwsTestUtils.findEC2KeysByTag(clientUsEast2, "tag", AwsTestConstants.TAG); + List keys = AwsTestUtils.findEC2KeysByTag(clientRegion2, "tag", keyTag); assertThat(keys.size()).isEqualTo(1); - assertThat(keys.get(0).keyName()).isEqualTo(AwsTestConstants.NAME_2); + assertThat(keys.get(0).keyName()).isEqualTo(keyName2); } } diff --git a/aws/src/test/java/aws/cloudformation/SingleAwsCfTemplateTest.java b/aws/src/test/java/aws/cloudformation/SingleAwsCfTemplateTest.java index 42ae3644..fb741798 100644 --- a/aws/src/test/java/aws/cloudformation/SingleAwsCfTemplateTest.java +++ b/aws/src/test/java/aws/cloudformation/SingleAwsCfTemplateTest.java @@ -7,6 +7,7 @@ import software.amazon.awssdk.services.ec2.Ec2Client; import software.amazon.awssdk.services.ec2.model.KeyPairInfo; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.aws.annotation.WithAwsCfTemplate; import java.util.List; @@ -17,13 +18,18 @@ @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_1) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1") + template = "sunstone/aws/cloudformation/keyPair.yaml") public class SingleAwsCfTemplateTest { static Ec2Client client; + @SunstoneProperty(expression=AwsTestConstants.NAME_1) + static String keyName; + @SunstoneProperty(expression = AwsTestConstants.region) + static String region; + @BeforeAll public static void setup() { - client = AwsTestUtils.getEC2Client("us-east-1"); + client = AwsTestUtils.getEC2Client(region); } @AfterAll @@ -33,8 +39,8 @@ public static void close() { @Test public void resourceCreated() { - List keys = AwsTestUtils.findEC2KeysByName(client, AwsTestConstants.NAME_1); + List keys = AwsTestUtils.findEC2KeysByName(client, keyName); assertThat(keys.size()).isEqualTo(1); - assertThat(keys.get(0).keyName()).isEqualTo(AwsTestConstants.NAME_1); + assertThat(keys.get(0).keyName()).isEqualTo(keyName); } -} \ No newline at end of file +} diff --git a/aws/src/test/java/aws/cloudformation/SingleTransitiveAwsCfTemplateTest.java b/aws/src/test/java/aws/cloudformation/SingleTransitiveAwsCfTemplateTest.java index 711839f5..37ba4b39 100644 --- a/aws/src/test/java/aws/cloudformation/SingleTransitiveAwsCfTemplateTest.java +++ b/aws/src/test/java/aws/cloudformation/SingleTransitiveAwsCfTemplateTest.java @@ -7,6 +7,7 @@ import software.amazon.awssdk.services.ec2.Ec2Client; import software.amazon.awssdk.services.ec2.model.KeyPairInfo; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.aws.annotation.WithAwsCfTemplate; import java.lang.annotation.ElementType; @@ -22,9 +23,14 @@ public class SingleTransitiveAwsCfTemplateTest { static Ec2Client client; + @SunstoneProperty(expression=AwsTestConstants.NAME_1) + static String keyName1; + @SunstoneProperty(expression = AwsTestConstants.region) + static String region; + @BeforeAll public static void setup() { - client = AwsTestUtils.getEC2Client("us-east-1"); + client = AwsTestUtils.getEC2Client(region); } @AfterAll @@ -34,9 +40,9 @@ public static void close() { @Test public void resourceCreated() { - List keys = AwsTestUtils.findEC2KeysByName(client, AwsTestConstants.NAME_1); + List keys = AwsTestUtils.findEC2KeysByName(client, keyName1); assertThat(keys.size()).isEqualTo(1); - assertThat(keys.get(0).keyName()).isEqualTo(AwsTestConstants.NAME_1); + assertThat(keys.get(0).keyName()).isEqualTo(keyName1); } @Retention(RetentionPolicy.RUNTIME) @@ -46,7 +52,7 @@ public void resourceCreated() { @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_1) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1") + template = "sunstone/aws/cloudformation/keyPair.yaml") @interface TestAnnotation { } } \ No newline at end of file diff --git a/aws/src/test/java/aws/cloudformation/di/SunstoneResourceAwsSuiteTests.java b/aws/src/test/java/aws/cloudformation/di/SunstoneResourceAwsSuiteTests.java index 4dd8b241..345f3853 100644 --- a/aws/src/test/java/aws/cloudformation/di/SunstoneResourceAwsSuiteTests.java +++ b/aws/src/test/java/aws/cloudformation/di/SunstoneResourceAwsSuiteTests.java @@ -1,11 +1,14 @@ package aws.cloudformation.di; +import aws.cloudformation.di.suitetests.AwsEC2InstanceTests; import aws.cloudformation.di.suitetests.AwsHostnameTests; import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; +import static aws.cloudformation.AwsTestConstants.instanceName; @Suite -@SelectClasses({AwsHostnameTests.class}) +@SelectClasses({AwsHostnameTests.class, AwsEC2InstanceTests.class}) public class SunstoneResourceAwsSuiteTests { + public static final String suiteInstanceName = "AwsEC2InstanceTests-" + instanceName; } diff --git a/aws/src/test/java/aws/cloudformation/di/suitetests/AwsEC2InstanceTests.java b/aws/src/test/java/aws/cloudformation/di/suitetests/AwsEC2InstanceTests.java index 20bad6db..970a9276 100644 --- a/aws/src/test/java/aws/cloudformation/di/suitetests/AwsEC2InstanceTests.java +++ b/aws/src/test/java/aws/cloudformation/di/suitetests/AwsEC2InstanceTests.java @@ -8,8 +8,8 @@ import sunstone.aws.annotation.AwsEc2Instance; import sunstone.aws.annotation.WithAwsCfTemplate; -import static aws.cloudformation.AwsTestConstants.instanceName; import static aws.cloudformation.AwsTestConstants.region; +import static aws.cloudformation.di.SunstoneResourceAwsSuiteTests.suiteInstanceName; import static org.assertj.core.api.Assertions.assertThat; @@ -20,21 +20,21 @@ * So the idea is to have only one testcase due to performance. */ @WithAwsCfTemplate(parameters = { - @Parameter(k = "instanceName", v = instanceName) + @Parameter(k = "instanceName", v = suiteInstanceName) }, template = "sunstone/aws/cloudformation/eap.yaml", region = region, perSuite = true) public class AwsEC2InstanceTests { - @AwsEc2Instance(nameTag = instanceName) + @AwsEc2Instance(nameTag = suiteInstanceName) static Instance staticVm; - @AwsEc2Instance(nameTag = instanceName, region = region) + @AwsEc2Instance(nameTag = suiteInstanceName, region = region) static Instance staticVmWithRegion; - @AwsEc2Instance(nameTag = instanceName) + @AwsEc2Instance(nameTag = suiteInstanceName) Instance vm; - @AwsEc2Instance(nameTag = instanceName, region = region) + @AwsEc2Instance(nameTag = suiteInstanceName, region = region) Instance vmWithRegion; @BeforeAll diff --git a/aws/src/test/java/aws/cloudformation/di/suitetests/AwsHostnameTests.java b/aws/src/test/java/aws/cloudformation/di/suitetests/AwsHostnameTests.java index b825782e..27eddfa9 100644 --- a/aws/src/test/java/aws/cloudformation/di/suitetests/AwsHostnameTests.java +++ b/aws/src/test/java/aws/cloudformation/di/suitetests/AwsHostnameTests.java @@ -8,8 +8,8 @@ import sunstone.aws.annotation.WithAwsCfTemplate; import sunstone.inject.Hostname; -import static aws.cloudformation.AwsTestConstants.instanceName; import static aws.cloudformation.AwsTestConstants.region; +import static aws.cloudformation.di.SunstoneResourceAwsSuiteTests.suiteInstanceName; import static org.assertj.core.api.Assertions.assertThat; @@ -20,21 +20,21 @@ * So the idea is to have only one testcase due to performance. */ @WithAwsCfTemplate(parameters = { - @Parameter(k = "instanceName", v = instanceName) + @Parameter(k = "instanceName", v = suiteInstanceName) }, template = "sunstone/aws/cloudformation/eap.yaml", region = region, perSuite = true) public class AwsHostnameTests { - @AwsEc2Instance(nameTag = instanceName) + @AwsEc2Instance(nameTag = suiteInstanceName) static Hostname staticHostname; - @AwsEc2Instance(nameTag = instanceName, region = region) + @AwsEc2Instance(nameTag = suiteInstanceName, region = region) static Hostname staticHostnameWithRegion; - @AwsEc2Instance(nameTag = instanceName) + @AwsEc2Instance(nameTag = suiteInstanceName) Hostname hostname; - @AwsEc2Instance(nameTag = instanceName, region = region) + @AwsEc2Instance(nameTag = suiteInstanceName, region = region) Hostname hostnameWithRegion; @BeforeAll diff --git a/aws/src/test/java/aws/cloudformation/suite/tests/PerSuiteAwsCfTemplate.java b/aws/src/test/java/aws/cloudformation/suite/tests/PerSuiteAwsCfTemplate.java index 2dcf437c..8dcc8f71 100644 --- a/aws/src/test/java/aws/cloudformation/suite/tests/PerSuiteAwsCfTemplate.java +++ b/aws/src/test/java/aws/cloudformation/suite/tests/PerSuiteAwsCfTemplate.java @@ -9,6 +9,7 @@ import software.amazon.awssdk.services.ec2.Ec2Client; import software.amazon.awssdk.services.ec2.model.KeyPairInfo; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.aws.annotation.WithAwsCfTemplate; import java.util.List; @@ -19,13 +20,20 @@ @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_1) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1", perSuite = true) + template = "sunstone/aws/cloudformation/keyPair.yaml", perSuite = true) public class PerSuiteAwsCfTemplate { static Ec2Client client; + @SunstoneProperty(expression=AwsTestConstants.NAME_1) + static String keyName1; + @SunstoneProperty(expression=AwsTestConstants.TAG) + static String keyTag; + @SunstoneProperty(expression = AwsTestConstants.region) + static String region; + @BeforeAll public static void setup() { - client = AwsTestUtils.getEC2Client("us-east-1"); + client = AwsTestUtils.getEC2Client(region); } @AfterAll @@ -35,8 +43,8 @@ public static void close() { @Test public void resourceCreated() { - List keys = AwsTestUtils.findEC2KeysByTag(client, "tag", AwsTestConstants.TAG); + List keys = AwsTestUtils.findEC2KeysByTag(client, "tag", keyTag); assertThat(keys.size()).isEqualTo(1); - assertThat(keys.get(0).keyName()).isEqualTo(AwsTestConstants.NAME_1); + assertThat(keys.get(0).keyName()).isEqualTo(keyName1); } } \ No newline at end of file diff --git a/aws/src/test/java/aws/cloudformation/suite/tests/PerSuitePerClassAwsCfTemplates.java b/aws/src/test/java/aws/cloudformation/suite/tests/PerSuitePerClassAwsCfTemplates.java index 051b35ec..d7f8f5cf 100644 --- a/aws/src/test/java/aws/cloudformation/suite/tests/PerSuitePerClassAwsCfTemplates.java +++ b/aws/src/test/java/aws/cloudformation/suite/tests/PerSuitePerClassAwsCfTemplates.java @@ -9,6 +9,7 @@ import software.amazon.awssdk.services.ec2.Ec2Client; import software.amazon.awssdk.services.ec2.model.KeyPairInfo; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.aws.annotation.WithAwsCfTemplate; import java.util.List; @@ -19,18 +20,27 @@ @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_1) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1", perSuite = true) + template = "sunstone/aws/cloudformation/keyPair.yaml", perSuite = true) @WithAwsCfTemplate(parameters = { @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_2) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1", perSuite = false) + template = "sunstone/aws/cloudformation/keyPair.yaml", perSuite = false) public class PerSuitePerClassAwsCfTemplates { static Ec2Client client; + @SunstoneProperty(expression=AwsTestConstants.NAME_1) + static String keyName1; + @SunstoneProperty(expression=AwsTestConstants.NAME_2) + static String keyName2; + @SunstoneProperty(expression=AwsTestConstants.TAG) + static String keyTag; + @SunstoneProperty(expression = AwsTestConstants.region) + static String region; + @BeforeAll public static void setup() { - client = AwsTestUtils.getEC2Client("us-east-1"); + client = AwsTestUtils.getEC2Client(region); } @AfterAll @@ -40,9 +50,9 @@ public static void close() { @Test public void resourcesCreated() { - List keys = AwsTestUtils.findEC2KeysByTag(client, "tag", AwsTestConstants.TAG); + List keys = AwsTestUtils.findEC2KeysByTag(client, "tag", keyTag); assertThat(keys.size()).isEqualTo(2); - assertThat(keys).anyMatch(key -> key.keyName().equals(AwsTestConstants.NAME_1)); - assertThat(keys).anyMatch(key -> key.keyName().equals(AwsTestConstants.NAME_2)); + assertThat(keys).anyMatch(key -> key.keyName().equals(keyName1)); + assertThat(keys).anyMatch(key -> key.keyName().equals(keyName2)); } } \ No newline at end of file diff --git a/aws/src/test/java/aws/cloudformation/suite/tests/TwoSamePerSuiteAwsCfTemplates.java b/aws/src/test/java/aws/cloudformation/suite/tests/TwoSamePerSuiteAwsCfTemplates.java index 7389dfe6..b120e98a 100644 --- a/aws/src/test/java/aws/cloudformation/suite/tests/TwoSamePerSuiteAwsCfTemplates.java +++ b/aws/src/test/java/aws/cloudformation/suite/tests/TwoSamePerSuiteAwsCfTemplates.java @@ -9,6 +9,7 @@ import software.amazon.awssdk.services.ec2.Ec2Client; import software.amazon.awssdk.services.ec2.model.KeyPairInfo; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.aws.annotation.WithAwsCfTemplate; import java.util.List; @@ -19,18 +20,25 @@ @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_1) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1", perSuite = true) + template = "sunstone/aws/cloudformation/keyPair.yaml", perSuite = true) @WithAwsCfTemplate(parameters = { @Parameter(k = "keyTag", v = AwsTestConstants.TAG), @Parameter(k = "keyName", v = AwsTestConstants.NAME_1) }, - template = "sunstone/aws/cloudformation/keyPair.yaml", region = "us-east-1", perSuite = true) + template = "sunstone/aws/cloudformation/keyPair.yaml", perSuite = true) public class TwoSamePerSuiteAwsCfTemplates { static Ec2Client client; + @SunstoneProperty(expression=AwsTestConstants.NAME_1) + static String keyName1; + @SunstoneProperty(expression=AwsTestConstants.TAG) + static String keyTag; + @SunstoneProperty(expression = AwsTestConstants.region) + static String region; + @BeforeAll public static void setup() { - client = AwsTestUtils.getEC2Client("us-east-1"); + client = AwsTestUtils.getEC2Client(region); } @AfterAll @@ -40,8 +48,8 @@ public static void close() { @Test public void resourceCreated() { - List keys = AwsTestUtils.findEC2KeysByTag(client, "tag", AwsTestConstants.TAG); + List keys = AwsTestUtils.findEC2KeysByTag(client, "tag", keyTag); assertThat(keys.size()).isEqualTo(1); - assertThat(keys.get(0).keyName()).isEqualTo(AwsTestConstants.NAME_1); + assertThat(keys.get(0).keyName()).isEqualTo(keyName1); } } \ No newline at end of file diff --git a/aws/src/test/resources/sunstone.properties b/aws/src/test/resources/sunstone.properties index c8d2b86b..19438a6f 100644 --- a/aws/src/test/resources/sunstone.properties +++ b/aws/src/test/resources/sunstone.properties @@ -1,5 +1,10 @@ sunstone.aws.accessKeyID=${aws.accessKeyID} sunstone.aws.secretAccessKey=${aws.secretAccessKey} sunstone.aws.region=${aws.region:us-east-1} +sunstone.aws.region2=${aws.region2:us-east-2} +sunstone.test.instance.name=eapSunstoneInjectInstance-${ts.test.run} +sunstone.test.keypair.tag=sunstoneKeyTag-${ts.test.run} +sunstone.test.keypair.name1=sunstoneKeyName1-${ts.test.run} +sunstone.test.keypair.name2=sunstoneKeyName2-${ts.test.run} ts.test.run=defaultrun diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/AzureTestConstants.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/AzureTestConstants.java index 99f24e38..7b6beb9b 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/AzureTestConstants.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/AzureTestConstants.java @@ -1,6 +1,8 @@ package sunstone.azure.armTemplates; +import sunstone.azure.impl.AzureConfig; + public class AzureTestConstants { public static final String VNET_TAG = "sunstoneVnet"; public static final String VNET_NAME_1 = "sunstoneVnet1"; @@ -8,7 +10,9 @@ public class AzureTestConstants { public static final String VNET_NAME_2 = "sunstoneVnet2"; public static final String IMAGE_REF = "${image.ref:/subscriptions/7dee6f21-9f05-414e-99fa-08d3215fb420/resourceGroups/istraka-test/providers/Microsoft.Compute/images/eap-test-image}"; - public static final String instanceName = "${non.existing:eapSunstoneInjectInstance}"; + public static final String instanceName = "${sunstone.test.instance.name}"; + + public static final String deployGroup = "${"+ AzureConfig.GROUP + "}"; public static final String mgmtUser = "${non.existing:admin}"; public static final String mgmtPassword = "${non.existing:pass.1234}"; diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/VmDeploySuiteTests.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/VmDeploySuiteTests.java index 220fd6f8..c009a91d 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/VmDeploySuiteTests.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/VmDeploySuiteTests.java @@ -3,6 +3,7 @@ import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; +import sunstone.azure.armTemplates.AzureTestConstants; import sunstone.azure.armTemplates.archiveDeploy.vm.suitetests.AzureVmDeployFirstTest; import sunstone.azure.armTemplates.archiveDeploy.vm.suitetests.AzureVmUndeployedSecondTest; @@ -13,5 +14,5 @@ @Suite @SelectClasses({AzureVmDeployFirstTest.class, AzureVmUndeployedSecondTest.class}) public class VmDeploySuiteTests { - public static final String vmDeployGroup = "deploytestVM"; + public static final String groupName = "vm-" + AzureTestConstants.deployGroup; } diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/suitetests/AzureVmDeployFirstTest.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/suitetests/AzureVmDeployFirstTest.java index ba05a5e9..3e8e60ed 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/suitetests/AzureVmDeployFirstTest.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/suitetests/AzureVmDeployFirstTest.java @@ -14,27 +14,25 @@ import sunstone.annotation.Parameter; import sunstone.annotation.Deployment; import sunstone.azure.annotation.WithAzureArmTemplate; +import sunstone.azure.armTemplates.archiveDeploy.vm.VmDeploySuiteTests; import sunstone.inject.Hostname; import java.io.IOException; -import static sunstone.azure.armTemplates.archiveDeploy.vm.VmDeploySuiteTests.vmDeployGroup; - @WithAzureArmTemplate(parameters = { @Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName), @Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF) }, - template = "sunstone/azure/armTemplates/eap.json", group = vmDeployGroup, perSuite = true) + template = "sunstone/azure/armTemplates/eap.json", group = VmDeploySuiteTests.groupName, perSuite = true) public class AzureVmDeployFirstTest { - @Deployment(name = "testapp.war") - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = vmDeployGroup) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = VmDeploySuiteTests.groupName) static WebArchive deploy() { return ShrinkWrap.create(WebArchive.class) .addAsWebResource(new StringAsset("Hello World"), "index.jsp"); } - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = vmDeployGroup) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = VmDeploySuiteTests.groupName) Hostname hostname; @Test diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/suitetests/AzureVmUndeployedSecondTest.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/suitetests/AzureVmUndeployedSecondTest.java index b7ee9577..54364035 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/suitetests/AzureVmUndeployedSecondTest.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vm/suitetests/AzureVmUndeployedSecondTest.java @@ -2,7 +2,6 @@ import sunstone.azure.armTemplates.AzureTestConstants; -import sunstone.azure.armTemplates.archiveDeploy.vm.VmDeploySuiteTests; import sunstone.azure.annotation.AzureVirtualMachine; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -11,6 +10,7 @@ import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; import sunstone.azure.annotation.WithAzureArmTemplate; +import sunstone.azure.armTemplates.archiveDeploy.vm.VmDeploySuiteTests; import sunstone.inject.Hostname; import java.io.IOException; @@ -22,9 +22,9 @@ @Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName), @Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF) }, - template = "sunstone/azure/armTemplates/eap.json", group = VmDeploySuiteTests.vmDeployGroup, perSuite = true) + template = "sunstone/azure/armTemplates/eap.json", group = VmDeploySuiteTests.groupName, perSuite = true) public class AzureVmUndeployedSecondTest { - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = VmDeploySuiteTests.vmDeployGroup) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = VmDeploySuiteTests.groupName) Hostname hostname; @Test diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/VmDomainDeploySuiteTests.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/VmDomainDeploySuiteTests.java index 37cd0948..2f307abc 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/VmDomainDeploySuiteTests.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/VmDomainDeploySuiteTests.java @@ -3,6 +3,7 @@ import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; +import sunstone.azure.armTemplates.AzureTestConstants; import sunstone.azure.armTemplates.archiveDeploy.vmDomain.suitetests.AzureDomainVmDeployFirstTest; import sunstone.azure.armTemplates.archiveDeploy.vmDomain.suitetests.AzureDomainVmUndeployedSecondTest; @@ -13,5 +14,5 @@ @Suite @SelectClasses({AzureDomainVmDeployFirstTest.class, AzureDomainVmUndeployedSecondTest.class}) public class VmDomainDeploySuiteTests { - public static final String vmDeployGroup = "deploytestVM"; + public static final String groupName = "vmDomain-" + AzureTestConstants.deployGroup; } diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/suitetests/AzureDomainVmDeployFirstTest.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/suitetests/AzureDomainVmDeployFirstTest.java index 04942d9f..644eabdf 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/suitetests/AzureDomainVmDeployFirstTest.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/suitetests/AzureDomainVmDeployFirstTest.java @@ -14,28 +14,27 @@ import sunstone.annotation.OperatingMode; import sunstone.annotation.Parameter; import sunstone.annotation.WildFly; +import sunstone.azure.armTemplates.archiveDeploy.vmDomain.VmDomainDeploySuiteTests; import sunstone.inject.Hostname; import sunstone.azure.annotation.AzureVirtualMachine; import sunstone.azure.annotation.WithAzureArmTemplate; import sunstone.azure.armTemplates.AzureTestConstants; -import static sunstone.azure.armTemplates.archiveDeploy.vm.VmDeploySuiteTests.vmDeployGroup; @WithAzureArmTemplate(parameters = { @Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName), @Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF) }, - template = "sunstone/azure/armTemplates/eapDomain.json", group = vmDeployGroup, perSuite = true) + template = "sunstone/azure/armTemplates/eapDomain.json", group = VmDomainDeploySuiteTests.groupName, perSuite = true) public class AzureDomainVmDeployFirstTest { - @Deployment(name = "testapp.war") - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = vmDeployGroup) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = VmDomainDeploySuiteTests.groupName) @WildFly(mode = OperatingMode.DOMAIN) static WebArchive deploy() { return ShrinkWrap.create(WebArchive.class) .addAsWebResource(new StringAsset("Hello World"), "index.jsp"); } - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = vmDeployGroup) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = VmDomainDeploySuiteTests.groupName) @WildFly(mode = OperatingMode.DOMAIN) Hostname hostname; diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/suitetests/AzureDomainVmUndeployedSecondTest.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/suitetests/AzureDomainVmUndeployedSecondTest.java index b6fadb82..b2e3635c 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/suitetests/AzureDomainVmUndeployedSecondTest.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/vmDomain/suitetests/AzureDomainVmUndeployedSecondTest.java @@ -9,11 +9,12 @@ import org.junit.jupiter.api.Test; import sunstone.annotation.OperatingMode; import sunstone.annotation.Parameter; -import sunstone.annotation.WildFly;import sunstone.inject.Hostname; +import sunstone.annotation.WildFly; +import sunstone.azure.armTemplates.archiveDeploy.vmDomain.VmDomainDeploySuiteTests; +import sunstone.inject.Hostname; import sunstone.azure.annotation.AzureVirtualMachine; import sunstone.azure.annotation.WithAzureArmTemplate; import sunstone.azure.armTemplates.AzureTestConstants; -import sunstone.azure.armTemplates.archiveDeploy.vmDomain.VmDomainDeploySuiteTests; /** * The test is supposed to run after AzureWebAppDeployFirstTest and verifies undeploy operation @@ -22,9 +23,9 @@ @Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName), @Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF) }, - template = "sunstone/azure/armTemplates/eapDomain.json", group = VmDomainDeploySuiteTests.vmDeployGroup, perSuite = true) + template = "sunstone/azure/armTemplates/eapDomain.json", group = VmDomainDeploySuiteTests.groupName, perSuite = true) public class AzureDomainVmUndeployedSecondTest { - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = VmDomainDeploySuiteTests.vmDeployGroup) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = VmDomainDeploySuiteTests.groupName) @WildFly(mode = OperatingMode.DOMAIN) Hostname hostname; diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/WebAppDeploySuiteTests.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/WebAppDeploySuiteTests.java index 8307ef64..cee6f8f0 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/WebAppDeploySuiteTests.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/WebAppDeploySuiteTests.java @@ -1,6 +1,7 @@ package sunstone.azure.armTemplates.archiveDeploy.webapp; +import sunstone.azure.armTemplates.AzureTestConstants; import sunstone.azure.armTemplates.archiveDeploy.webapp.suitetests.AzureWebAppDeployFirstTest; import sunstone.azure.armTemplates.archiveDeploy.webapp.suitetests.AzureWebAppUndeployedSecondTest; import org.junit.platform.suite.api.SelectClasses; @@ -14,5 +15,5 @@ @Suite @SelectClasses({AzureWebAppDeployFirstTest.class, AzureWebAppUndeployedSecondTest.class}) public class WebAppDeploySuiteTests { - public static final String webAppDeployGroup = "deploytestWebApp"; + public static final String groupName = "webApp-" + AzureTestConstants.deployGroup; } diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/suitetests/AzureWebAppDeployFirstTest.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/suitetests/AzureWebAppDeployFirstTest.java index 1a049e33..0781531c 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/suitetests/AzureWebAppDeployFirstTest.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/suitetests/AzureWebAppDeployFirstTest.java @@ -2,7 +2,6 @@ import sunstone.azure.armTemplates.AzureTestConstants; -import sunstone.azure.armTemplates.archiveDeploy.webapp.WebAppDeploySuiteTests; import sunstone.azure.annotation.AzureWebApplication; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -15,21 +14,22 @@ import sunstone.annotation.Deployment; import sunstone.annotation.Parameter; import sunstone.azure.annotation.WithAzureArmTemplate; +import sunstone.azure.armTemplates.archiveDeploy.webapp.WebAppDeploySuiteTests; import sunstone.inject.Hostname; import java.io.IOException; @WithAzureArmTemplate(template = "sunstone/azure/armTemplates/eapWebApp.json", - parameters = {@Parameter(k = "appName", v = AzureTestConstants.instanceName)}, group = WebAppDeploySuiteTests.webAppDeployGroup, perSuite = true) + parameters = {@Parameter(k = "appName", v = AzureTestConstants.instanceName)}, group = WebAppDeploySuiteTests.groupName, perSuite = true) public class AzureWebAppDeployFirstTest { @Deployment - @AzureWebApplication(name = AzureTestConstants.instanceName, group = WebAppDeploySuiteTests.webAppDeployGroup) + @AzureWebApplication(name = AzureTestConstants.instanceName, group = WebAppDeploySuiteTests.groupName) static WebArchive deploy() { return ShrinkWrap.create(WebArchive.class) .addAsWebResource(new StringAsset("Hello World"), "index.jsp"); } - @AzureWebApplication(name = AzureTestConstants.instanceName, group = WebAppDeploySuiteTests.webAppDeployGroup) + @AzureWebApplication(name = AzureTestConstants.instanceName, group = WebAppDeploySuiteTests.groupName) Hostname hostname; @Test diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/suitetests/AzureWebAppUndeployedSecondTest.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/suitetests/AzureWebAppUndeployedSecondTest.java index 90bc9150..1a8e9cd0 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/suitetests/AzureWebAppUndeployedSecondTest.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/archiveDeploy/webapp/suitetests/AzureWebAppUndeployedSecondTest.java @@ -2,7 +2,6 @@ import sunstone.azure.armTemplates.AzureTestConstants; -import sunstone.azure.armTemplates.archiveDeploy.webapp.WebAppDeploySuiteTests; import sunstone.azure.annotation.AzureWebApplication; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -11,6 +10,7 @@ import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; import sunstone.azure.annotation.WithAzureArmTemplate; +import sunstone.azure.armTemplates.archiveDeploy.webapp.WebAppDeploySuiteTests; import sunstone.inject.Hostname; import java.io.IOException; @@ -19,10 +19,9 @@ * The test is supposed to run after AzureWebAppDeployFirstTest and verifies undeploy operation */ @WithAzureArmTemplate(template = "sunstone/azure/armTemplates/eapWebApp.json", - parameters = {@Parameter(k = "appName", v = AzureTestConstants.instanceName)}, group = WebAppDeploySuiteTests.webAppDeployGroup, perSuite = true) + parameters = {@Parameter(k = "appName", v = AzureTestConstants.instanceName)}, group = WebAppDeploySuiteTests.groupName, perSuite = true) public class AzureWebAppUndeployedSecondTest { - - @AzureWebApplication(name = AzureTestConstants.instanceName, group = WebAppDeploySuiteTests.webAppDeployGroup) + @AzureWebApplication(name = AzureTestConstants.instanceName, group = WebAppDeploySuiteTests.groupName) Hostname hostname; @Test diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/di/AzDomainManagementClientTests.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/di/AzDomainManagementClientTests.java index c07789e2..63f793dd 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/di/AzDomainManagementClientTests.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/di/AzDomainManagementClientTests.java @@ -1,5 +1,6 @@ package sunstone.azure.armTemplates.di; +import java.io.IOException; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.wildfly.extras.creaper.core.online.CliException; @@ -11,9 +12,6 @@ import sunstone.azure.annotation.AzureVirtualMachine; import sunstone.azure.annotation.WithAzureArmTemplate; import sunstone.azure.armTemplates.AzureTestConstants; - -import java.io.IOException; - import static org.assertj.core.api.Assertions.assertThat; @WithAzureArmTemplate( @@ -21,24 +19,23 @@ @Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName), @Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF) }, - template = "sunstone/azure/armTemplates/eapDomain.json", group = AzDomainManagementClientTests.group) + template = "sunstone/azure/armTemplates/eapDomain.json", group = AzDomainManagementClientTests.groupName) public class AzDomainManagementClientTests { + static final String groupName = "AzDomainManagementClientTests-" + AzureTestConstants.deployGroup; - public static final String group = "${azure.group:sunstone-testing-group}"; - - @AzureVirtualMachine(name = AzureTestConstants.instanceName) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) @WildFly(mode = OperatingMode.DOMAIN) static OnlineManagementClient staticMgmtClient; - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzDomainManagementClientTests.group) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) @WildFly(mode = OperatingMode.DOMAIN, domain = @DomainMode(user = AzureTestConstants.mgmtUser, password = AzureTestConstants.mgmtPassword, port = AzureTestConstants.mgmtPort, host = AzureTestConstants.mgmtHost, profile = AzureTestConstants.mgmtProfile)) static OnlineManagementClient staticMgmtClientSpecified; - @AzureVirtualMachine(name = AzureTestConstants.instanceName) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) @WildFly(mode = OperatingMode.DOMAIN) OnlineManagementClient mgmtClient; - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzDomainManagementClientTests.group) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) @WildFly(mode = OperatingMode.DOMAIN, domain = @DomainMode(user = AzureTestConstants.mgmtUser, password = AzureTestConstants.mgmtPassword, port = AzureTestConstants.mgmtPort, host = AzureTestConstants.mgmtHost, profile = AzureTestConstants.mgmtProfile)) OnlineManagementClient mgmtClientSpecified; diff --git a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/di/AzStandaloneManagementClientTests.java b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/di/AzStandaloneManagementClientTests.java index 8481d5d9..0a734801 100644 --- a/azure-wildfly/src/test/java/sunstone/azure/armTemplates/di/AzStandaloneManagementClientTests.java +++ b/azure-wildfly/src/test/java/sunstone/azure/armTemplates/di/AzStandaloneManagementClientTests.java @@ -22,21 +22,20 @@ @Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName), @Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF) }, - template = "sunstone/azure/armTemplates/eap.json", group = AzStandaloneManagementClientTests.group) + template = "sunstone/azure/armTemplates/eap.json", group = AzStandaloneManagementClientTests.groupName) public class AzStandaloneManagementClientTests { - public static final String group = "${azure.group:sunstone-testing-group}"; - - @AzureVirtualMachine(name = AzureTestConstants.instanceName) + static final String groupName = "AzStandaloneManagementClientTests-" + AzureTestConstants.deployGroup; + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) static OnlineManagementClient staticMgmtClient; - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzStandaloneManagementClientTests.group) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) @WildFly(mode = OperatingMode.STANDALONE, standalone = @StandaloneMode(user = AzureTestConstants.mgmtUser, password = AzureTestConstants.mgmtPassword, port = AzureTestConstants.mgmtPort)) static OnlineManagementClient staticMgmtClientSpecified; - @AzureVirtualMachine(name = AzureTestConstants.instanceName) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) OnlineManagementClient mgmtClient; - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = AzStandaloneManagementClientTests.group) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) @WildFly(mode = OperatingMode.STANDALONE, standalone = @StandaloneMode(user = AzureTestConstants.mgmtUser, password = AzureTestConstants.mgmtPassword, port = AzureTestConstants.mgmtPort)) OnlineManagementClient mgmtClientSpecified; diff --git a/azure-wildfly/src/test/resources/sunstone.properties b/azure-wildfly/src/test/resources/sunstone.properties index d5cfed17..6054869f 100644 --- a/azure-wildfly/src/test/resources/sunstone.properties +++ b/azure-wildfly/src/test/resources/sunstone.properties @@ -3,7 +3,8 @@ sunstone.azure.tenantId=${azure.tenantId} sunstone.azure.applicationId=${azure.applicationId} sunstone.azure.password=${azure.password} sunstone.azure.region=${azure.region:eastus2} -sunstone.azure.group=${azure.group:sunstone-testing-group} +sunstone.azure.group=sunstoneTesting-${ts.test.run} +sunstone.test.instance.name=eapSunstoneInjectInstance-${ts.test.run} sunstone.wildfly.mgmt.port=9990 sunstone.wildfly.mgmt.user=admin @@ -11,3 +12,5 @@ sunstone.wildfly.mgmt.password=pass.1234 sunstone.wildfly.mgmt.connection.timeout=120000 sunstone.wildfly.mgmt.host=master sunstone.wildfly.mgmt.profile=default + +ts.test.run=defaultrun diff --git a/azure/src/test/java/sunstone/azure/armTemplates/AzureTestConstants.java b/azure/src/test/java/sunstone/azure/armTemplates/AzureTestConstants.java index 99f24e38..6690a28a 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/AzureTestConstants.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/AzureTestConstants.java @@ -1,6 +1,8 @@ package sunstone.azure.armTemplates; +import sunstone.azure.impl.AzureConfig; + public class AzureTestConstants { public static final String VNET_TAG = "sunstoneVnet"; public static final String VNET_NAME_1 = "sunstoneVnet1"; @@ -8,8 +10,9 @@ public class AzureTestConstants { public static final String VNET_NAME_2 = "sunstoneVnet2"; public static final String IMAGE_REF = "${image.ref:/subscriptions/7dee6f21-9f05-414e-99fa-08d3215fb420/resourceGroups/istraka-test/providers/Microsoft.Compute/images/eap-test-image}"; - public static final String instanceName = "${non.existing:eapSunstoneInjectInstance}"; + public static final String instanceName = "${sunstone.test.instance.name}"; + public static final String deployGroup = "${"+ AzureConfig.GROUP + "}"; public static final String mgmtUser = "${non.existing:admin}"; public static final String mgmtPassword = "${non.existing:pass.1234}"; public static final String mgmtPort = "${non.existing:9990}"; diff --git a/azure/src/test/java/sunstone/azure/armTemplates/MultipleAzArmTemplatesRepetableTest.java b/azure/src/test/java/sunstone/azure/armTemplates/MultipleAzArmTemplatesRepetableTest.java index 13b9e1f7..307ca4d0 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/MultipleAzArmTemplatesRepetableTest.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/MultipleAzArmTemplatesRepetableTest.java @@ -6,26 +6,30 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.azure.annotation.WithAzureArmTemplate; import sunstone.azure.annotation.WithAzureArmTemplateRepeatable; - -import static sunstone.azure.armTemplates.MultipleAzArmTemplatesRepetableTest.GROUP; import static org.assertj.core.api.Assertions.assertThat; +import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup; +import static sunstone.azure.armTemplates.MultipleAzArmTemplatesRepetableTest.groupName; @WithAzureArmTemplateRepeatable({ @WithAzureArmTemplate(parameters = { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_1), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = GROUP), + template = "sunstone/azure/armTemplates/vnet.json", group = groupName), @WithAzureArmTemplate(parameters = { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_2), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = GROUP) + template = "sunstone/azure/armTemplates/vnet.json", group = groupName) }) public class MultipleAzArmTemplatesRepetableTest { - static final String GROUP = "MultipleAzArmTemplatesRepetableTest"; + static final String groupName = "MultipleAzArmTemplatesRepetableTest-" + deployGroup; + + @SunstoneProperty(expression = groupName) + static String classGroup; static AzureResourceManager arm; @@ -36,9 +40,9 @@ public static void setup() { @Test public void resourcesCreated() { - Network vnet = arm.networks().getByResourceGroup(GROUP, AzureTestConstants.VNET_NAME_1); + Network vnet = arm.networks().getByResourceGroup(classGroup, AzureTestConstants.VNET_NAME_1); assertThat(vnet).isNotNull(); - vnet = arm.networks().getByResourceGroup(GROUP, AzureTestConstants.VNET_NAME_2); + vnet = arm.networks().getByResourceGroup(classGroup, AzureTestConstants.VNET_NAME_2); assertThat(vnet).isNotNull(); } } diff --git a/azure/src/test/java/sunstone/azure/armTemplates/MultipleAzArmTemplatesTest.java b/azure/src/test/java/sunstone/azure/armTemplates/MultipleAzArmTemplatesTest.java index 4f248b6e..f67dc0ec 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/MultipleAzArmTemplatesTest.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/MultipleAzArmTemplatesTest.java @@ -6,24 +6,28 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.azure.annotation.WithAzureArmTemplate; - -import static sunstone.azure.armTemplates.MultipleAzArmTemplatesTest.GROUP; import static org.assertj.core.api.Assertions.assertThat; +import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup; +import static sunstone.azure.armTemplates.MultipleAzArmTemplatesTest.groupName; @WithAzureArmTemplate(parameters = { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_1), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = GROUP) + template = "sunstone/azure/armTemplates/vnet.json", group = groupName) @WithAzureArmTemplate(parameters = { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_2), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = GROUP) + template = "sunstone/azure/armTemplates/vnet.json", group = groupName) public class MultipleAzArmTemplatesTest { - static final String GROUP = "MultipleAzArmTemplatesTest"; + static final String groupName = "MultipleAzArmTemplatesTest-" + deployGroup; + + @SunstoneProperty(expression = groupName) + static String classGroup; static AzureResourceManager arm; @@ -34,9 +38,9 @@ public static void setup() { @Test public void resourcesCreated() { - Network vnet1 = arm.networks().getByResourceGroup(GROUP, AzureTestConstants.VNET_NAME_1); + Network vnet1 = arm.networks().getByResourceGroup(classGroup, AzureTestConstants.VNET_NAME_1); assertThat(vnet1).isNotNull(); - Network vnet2 = arm.networks().getByResourceGroup(GROUP, AzureTestConstants.VNET_NAME_2); + Network vnet2 = arm.networks().getByResourceGroup(classGroup, AzureTestConstants.VNET_NAME_2); assertThat(vnet2).isNotNull(); } } \ No newline at end of file diff --git a/azure/src/test/java/sunstone/azure/armTemplates/MultipleDifferentGroupsAzArmTemplatesTest.java b/azure/src/test/java/sunstone/azure/armTemplates/MultipleDifferentGroupsAzArmTemplatesTest.java index ede43ee2..96962ac8 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/MultipleDifferentGroupsAzArmTemplatesTest.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/MultipleDifferentGroupsAzArmTemplatesTest.java @@ -6,26 +6,32 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.azure.annotation.WithAzureArmTemplate; - -import static sunstone.azure.armTemplates.MultipleDifferentGroupsAzArmTemplatesTest.GROUP1; -import static sunstone.azure.armTemplates.MultipleDifferentGroupsAzArmTemplatesTest.GROUP2; import static org.assertj.core.api.Assertions.assertThat; +import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup; +import static sunstone.azure.armTemplates.MultipleDifferentGroupsAzArmTemplatesTest.groupName1; +import static sunstone.azure.armTemplates.MultipleDifferentGroupsAzArmTemplatesTest.groupName2; @WithAzureArmTemplate(parameters = { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_1), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = GROUP1) + template = "sunstone/azure/armTemplates/vnet.json", group = groupName1) @WithAzureArmTemplate(parameters = { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_2), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = GROUP2) + template = "sunstone/azure/armTemplates/vnet.json", group = groupName2) public class MultipleDifferentGroupsAzArmTemplatesTest { - static final String GROUP1 = "MultipleAzArmTemplatesTest1"; - static final String GROUP2 = "MultipleAzArmTemplatesTest2"; + static final String groupName1 = "MultipleAzArmTemplatesTest1-" + deployGroup; + static final String groupName2 = "MultipleAzArmTemplatesTest2-" + deployGroup; + + @SunstoneProperty(expression = groupName1) + static String classGroup1; + @SunstoneProperty(expression = groupName2) + static String classGroup2; static AzureResourceManager arm; @@ -36,12 +42,12 @@ public static void setup() { @Test public void group1ResourcesCreated() { - Network vnet = arm.networks().getByResourceGroup(GROUP1, AzureTestConstants.VNET_NAME_1); + Network vnet = arm.networks().getByResourceGroup(classGroup1, AzureTestConstants.VNET_NAME_1); assertThat(vnet).isNotNull(); } @Test public void group2ResourcesCreated() { - Network vnet = arm.networks().getByResourceGroup(GROUP2, AzureTestConstants.VNET_NAME_2); + Network vnet = arm.networks().getByResourceGroup(classGroup2, AzureTestConstants.VNET_NAME_2); assertThat(vnet).isNotNull(); } } \ No newline at end of file diff --git a/azure/src/test/java/sunstone/azure/armTemplates/SingleAzArmTemplateTest.java b/azure/src/test/java/sunstone/azure/armTemplates/SingleAzArmTemplateTest.java index ec4004a2..578a34ef 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/SingleAzArmTemplateTest.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/SingleAzArmTemplateTest.java @@ -6,18 +6,22 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.azure.annotation.WithAzureArmTemplate; - -import static sunstone.azure.armTemplates.SingleAzArmTemplateTest.GROUP; import static org.assertj.core.api.Assertions.assertThat; +import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup; +import static sunstone.azure.armTemplates.SingleAzArmTemplateTest.groupName; @WithAzureArmTemplate(parameters = { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_1), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = GROUP) + template = "sunstone/azure/armTemplates/vnet.json", group = groupName) public class SingleAzArmTemplateTest { - static final String GROUP = "SingleAzArmTemplateTest"; + static final String groupName = "SingleAzArmTemplateTest-" + deployGroup; + + @SunstoneProperty(expression = groupName) + static String classGroup; static AzureResourceManager arm; @@ -28,7 +32,7 @@ public static void setup() { @Test public void resourceCreated() { - Network vnet = arm.networks().getByResourceGroup(GROUP, AzureTestConstants.VNET_NAME_1); + Network vnet = arm.networks().getByResourceGroup(classGroup, AzureTestConstants.VNET_NAME_1); assertThat(vnet).isNotNull(); } } diff --git a/azure/src/test/java/sunstone/azure/armTemplates/SingleTransitiveAzArmTemplateTest.java b/azure/src/test/java/sunstone/azure/armTemplates/SingleTransitiveAzArmTemplateTest.java index 5c24cf54..645c3bd9 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/SingleTransitiveAzArmTemplateTest.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/SingleTransitiveAzArmTemplateTest.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.azure.annotation.WithAzureArmTemplate; import java.lang.annotation.ElementType; @@ -15,10 +16,14 @@ import java.lang.annotation.Target; import static org.assertj.core.api.Assertions.assertThat; +import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup; @SingleTransitiveAzArmTemplateTest.TestTransitiveAnnotation public class SingleTransitiveAzArmTemplateTest { - static final String GROUP = "SingleTransitiveAzArmTemplateTest"; + static final String groupName = "SingleTransitiveAzArmTemplateTest-" + deployGroup; + + @SunstoneProperty(expression = groupName) + static String classGroup; static AzureResourceManager arm; @@ -29,7 +34,7 @@ public static void setup() { @Test public void resourceCreated() { - Network vnet = arm.networks().getByResourceGroup(GROUP, AzureTestConstants.VNET_NAME_1); + Network vnet = arm.networks().getByResourceGroup(classGroup, AzureTestConstants.VNET_NAME_1); assertThat(vnet).isNotNull(); } @@ -40,7 +45,7 @@ public void resourceCreated() { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_1), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = GROUP) + template = "sunstone/azure/armTemplates/vnet.json", group = groupName) @interface TestTransitiveAnnotation { } } diff --git a/azure/src/test/java/sunstone/azure/armTemplates/di/AzPgSqlTests.java b/azure/src/test/java/sunstone/azure/armTemplates/di/AzPgSqlTests.java index e7b989aa..bb6d5595 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/di/AzPgSqlTests.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/di/AzPgSqlTests.java @@ -10,7 +10,7 @@ import sunstone.inject.Hostname; import static org.assertj.core.api.Assertions.assertThat; -import static sunstone.azure.armTemplates.di.AzVmTests.group; +import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup; @WithAzureArmTemplate(parameters = { @@ -18,37 +18,35 @@ @Parameter(k = "password", v = AzPgSqlTests.PGSQL_PASSWORD), @Parameter(k = "serverName", v = AzPgSqlTests.PGSQL_NAME), }, - template = "sunstone/azure/armTemplates/posgresql.json", group = group, perSuite = true) + template = "sunstone/azure/armTemplates/posgresql.json", group = AzPgSqlTests.groupName) public class AzPgSqlTests { + static final String groupName = "AzPgSqlTests-" + deployGroup; public static final String PGSQL_NAME = "DSAzureTest-pgsql"; public static final String PGSQL_USER = "user"; public static final String PGSQL_PASSWORD = "1234567890Ab"; - // must be same string as in MP Config - public static final String group = "${azure.group:sunstone-testing-group}"; - - @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME) + @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = groupName) static Hostname staticHostname; - @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = group) + @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = groupName) static Hostname staticHostnameWithRegion; - @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME) + @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = groupName) static Server staticServer; - @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = group) + @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = groupName) static Server staticServerWithGroup; - @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME) + @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = groupName) Hostname hostname; - @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = group) + @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = groupName) Hostname hostnameWithGroup; - @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME) + @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = groupName) Server vm; - @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = group) + @AzurePgSqlServer(name = AzPgSqlTests.PGSQL_NAME, group = groupName) Server vmWithGroup; @BeforeAll diff --git a/azure/src/test/java/sunstone/azure/armTemplates/di/AzVmTests.java b/azure/src/test/java/sunstone/azure/armTemplates/di/AzVmTests.java index 6629ae78..4989aa40 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/di/AzVmTests.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/di/AzVmTests.java @@ -11,40 +11,39 @@ import sunstone.azure.armTemplates.AzureTestConstants; import static org.assertj.core.api.Assertions.assertThat; -import static sunstone.azure.armTemplates.di.AzVmTests.group; +import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup; @WithAzureArmTemplate(parameters = { @Parameter(k = "virtualMachineName", v = AzureTestConstants.instanceName), @Parameter(k = "imageRefId", v = AzureTestConstants.IMAGE_REF) }, - template = "sunstone/azure/armTemplates/eap.json", group = group, perSuite = true) + template = "sunstone/azure/armTemplates/eap.json", group = AzVmTests.groupName) public class AzVmTests { - // must be same string as in MP Config - public static final String group = "${azure.group:sunstone-testing-group}"; + static final String groupName = "AzVmTests-" + deployGroup; - @AzureVirtualMachine(name = AzureTestConstants.instanceName) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) static Hostname staticHostname; - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = group) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) static Hostname staticHostnameWithRegion; - @AzureVirtualMachine(name = AzureTestConstants.instanceName) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) static VirtualMachine staticVM; - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = group) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) static VirtualMachine staticVmWithRegion; - @AzureVirtualMachine(name = AzureTestConstants.instanceName) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) Hostname hostname; - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = group) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) Hostname hostnameWithRegion; - @AzureVirtualMachine(name = AzureTestConstants.instanceName) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) VirtualMachine vm; - @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = group) + @AzureVirtualMachine(name = AzureTestConstants.instanceName, group = groupName) VirtualMachine vmWithRegion; @BeforeAll @@ -66,4 +65,4 @@ public void testDI() { assertThat(hostname.get()).isNotBlank(); assertThat(hostnameWithRegion.get()).isNotBlank(); } -} \ No newline at end of file +} diff --git a/azure/src/test/java/sunstone/azure/armTemplates/di/AzureWebAppTests.java b/azure/src/test/java/sunstone/azure/armTemplates/di/AzureWebAppTests.java index e991604d..fb6247cb 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/di/AzureWebAppTests.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/di/AzureWebAppTests.java @@ -19,29 +19,29 @@ import java.io.IOException; import static org.assertj.core.api.Assertions.assertThat; +import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup; @WithAzureArmTemplate(template = "sunstone/azure/armTemplates/eapWebApp.json", - parameters = {@Parameter(k = "appName", v = AzureTestConstants.instanceName)}, group = AzureWebAppTests.group) + parameters = {@Parameter(k = "appName", v = AzureTestConstants.instanceName)}, group = AzureWebAppTests.groupName) public class AzureWebAppTests { + static final String groupName = "AzureWebAppTests-" + deployGroup; - public static final String group = "sunstone-web-app"; - - @AzureWebApplication(name = AzureTestConstants.instanceName, group = group) + @AzureWebApplication(name = AzureTestConstants.instanceName, group = groupName) static Hostname staticHostname; - @AzureWebApplication(name = AzureTestConstants.instanceName, group = group) + @AzureWebApplication(name = AzureTestConstants.instanceName, group = groupName) static WebApp staticWebApp; - @AzureAppServicePlan(name = AzureTestConstants.instanceName + "-plan", group = group) + @AzureAppServicePlan(name = AzureTestConstants.instanceName + "-plan", group = groupName) static AppServicePlan staticPlan; - @AzureWebApplication(name = AzureTestConstants.instanceName, group = group) + @AzureWebApplication(name = AzureTestConstants.instanceName, group = groupName) Hostname hostname; - @AzureWebApplication(name = AzureTestConstants.instanceName, group = group) + @AzureWebApplication(name = AzureTestConstants.instanceName, group = groupName) WebApp webApp; - @AzureAppServicePlan(name = AzureTestConstants.instanceName + "-plan", group = group) + @AzureAppServicePlan(name = AzureTestConstants.instanceName + "-plan", group = groupName) static AppServicePlan plan; @BeforeAll diff --git a/azure/src/test/java/sunstone/azure/armTemplates/suite/AzureArmTemplatesSuiteTest.java b/azure/src/test/java/sunstone/azure/armTemplates/suite/AzureArmTemplatesSuiteTest.java index b78a78db..6f5deb3f 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/suite/AzureArmTemplatesSuiteTest.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/suite/AzureArmTemplatesSuiteTest.java @@ -5,9 +5,11 @@ import sunstone.azure.armTemplates.suite.tests.TwoSamePerSuiteAzArmTemplates; import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; +import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup; @Suite @SelectClasses({PerSuiteAzArmTemplate.class, PerSuitePerClassAzArmTemplates.class, TwoSamePerSuiteAzArmTemplates.class}) public class AzureArmTemplatesSuiteTest { - public static final String GROUP = "AzArmSuiteTest"; + public static final String groupName = "AzArmSuiteTest-" + deployGroup; } + diff --git a/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/PerSuiteAzArmTemplate.java b/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/PerSuiteAzArmTemplate.java index d10fc59c..1a919f9b 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/PerSuiteAzArmTemplate.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/PerSuiteAzArmTemplate.java @@ -1,15 +1,16 @@ package sunstone.azure.armTemplates.suite.tests; -import sunstone.azure.armTemplates.AzureTestUtils; -import sunstone.azure.armTemplates.AzureTestConstants; -import sunstone.azure.armTemplates.suite.AzureArmTemplatesSuiteTest; import com.azure.resourcemanager.AzureResourceManager; import com.azure.resourcemanager.network.models.Network; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.azure.annotation.WithAzureArmTemplate; +import sunstone.azure.armTemplates.AzureTestConstants; +import sunstone.azure.armTemplates.AzureTestUtils; +import sunstone.azure.armTemplates.suite.AzureArmTemplatesSuiteTest; import static org.assertj.core.api.Assertions.assertThat; @@ -17,10 +18,13 @@ @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_1), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = AzureArmTemplatesSuiteTest.GROUP, perSuite = true) + template = "sunstone/azure/armTemplates/vnet.json", group = AzureArmTemplatesSuiteTest.groupName, perSuite = true) public class PerSuiteAzArmTemplate { static AzureResourceManager arm; + @SunstoneProperty(expression=AzureArmTemplatesSuiteTest.groupName) + static String suiteGroup; + @BeforeAll public static void setup() { arm = AzureTestUtils.getResourceManager(); @@ -28,7 +32,7 @@ public static void setup() { @Test public void resourceCreated() { - Network vnet = arm.networks().getByResourceGroup(AzureArmTemplatesSuiteTest.GROUP, AzureTestConstants.VNET_NAME_1); + Network vnet = arm.networks().getByResourceGroup(suiteGroup, AzureTestConstants.VNET_NAME_1); assertThat(vnet).isNotNull(); } } diff --git a/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/PerSuitePerClassAzArmTemplates.java b/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/PerSuitePerClassAzArmTemplates.java index db778596..2bb843ec 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/PerSuitePerClassAzArmTemplates.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/PerSuitePerClassAzArmTemplates.java @@ -1,30 +1,39 @@ package sunstone.azure.armTemplates.suite.tests; -import sunstone.azure.armTemplates.AzureTestUtils; -import sunstone.azure.armTemplates.AzureTestConstants; -import sunstone.azure.armTemplates.suite.AzureArmTemplatesSuiteTest; import com.azure.resourcemanager.AzureResourceManager; import com.azure.resourcemanager.network.models.Network; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.azure.annotation.WithAzureArmTemplate; +import sunstone.azure.armTemplates.AzureTestConstants; +import sunstone.azure.armTemplates.AzureTestUtils; +import sunstone.azure.armTemplates.suite.AzureArmTemplatesSuiteTest; import static org.assertj.core.api.Assertions.assertThat; +import static sunstone.azure.armTemplates.AzureTestConstants.deployGroup; @WithAzureArmTemplate(parameters = { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_1), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = AzureArmTemplatesSuiteTest.GROUP, perSuite = true) + template = "sunstone/azure/armTemplates/vnet.json", group = AzureArmTemplatesSuiteTest.groupName, perSuite = true) @WithAzureArmTemplate(parameters = { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_2), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = PerSuitePerClassAzArmTemplates.GROUP, perSuite = false) + template = "sunstone/azure/armTemplates/vnet.json", group = PerSuitePerClassAzArmTemplates.groupName, perSuite = false) public class PerSuitePerClassAzArmTemplates { - static final String GROUP = "PerSuitePerClassAzArmTemplate"; + static final String groupName = "PerSuitePerClassAzArmTemplate-" + deployGroup; + + @SunstoneProperty(expression = groupName) + static String classGroup; + + @SunstoneProperty(expression=AzureArmTemplatesSuiteTest.groupName) + static String suiteGroup; + static AzureResourceManager arm; @BeforeAll @@ -34,9 +43,9 @@ public static void setup() { @Test public void resourceCreated() { - Network vnet = arm.networks().getByResourceGroup(AzureArmTemplatesSuiteTest.GROUP, AzureTestConstants.VNET_NAME_1); + Network vnet = arm.networks().getByResourceGroup(suiteGroup, AzureTestConstants.VNET_NAME_1); assertThat(vnet).isNotNull(); - vnet = arm.networks().getByResourceGroup(PerSuitePerClassAzArmTemplates.GROUP, AzureTestConstants.VNET_NAME_2); + vnet = arm.networks().getByResourceGroup(classGroup, AzureTestConstants.VNET_NAME_2); assertThat(vnet).isNotNull(); } } diff --git a/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/TwoSamePerSuiteAzArmTemplates.java b/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/TwoSamePerSuiteAzArmTemplates.java index a796c593..6055e739 100644 --- a/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/TwoSamePerSuiteAzArmTemplates.java +++ b/azure/src/test/java/sunstone/azure/armTemplates/suite/tests/TwoSamePerSuiteAzArmTemplates.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import sunstone.annotation.Parameter; +import sunstone.annotation.SunstoneProperty; import sunstone.azure.annotation.WithAzureArmTemplate; import sunstone.azure.armTemplates.AzureTestConstants; import sunstone.azure.armTemplates.AzureTestUtils; @@ -17,15 +18,18 @@ @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_1), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = AzureArmTemplatesSuiteTest.GROUP, perSuite = true) + template = "sunstone/azure/armTemplates/vnet.json", group = AzureArmTemplatesSuiteTest.groupName, perSuite = true) @WithAzureArmTemplate(parameters = { @Parameter(k = "vnetName", v = AzureTestConstants.VNET_NAME_1), @Parameter(k = "vnetTag", v = AzureTestConstants.VNET_TAG) }, - template = "sunstone/azure/armTemplates/vnet.json", region = "eastus2", group = AzureArmTemplatesSuiteTest.GROUP, perSuite = true) + template = "sunstone/azure/armTemplates/vnet.json", group = AzureArmTemplatesSuiteTest.groupName, perSuite = true) public class TwoSamePerSuiteAzArmTemplates { static AzureResourceManager arm; + @SunstoneProperty(expression=AzureArmTemplatesSuiteTest.groupName) + static String suiteGroup; + @BeforeAll public static void setup() { arm = AzureTestUtils.getResourceManager(); @@ -33,8 +37,8 @@ public static void setup() { @Test public void resourceCreated() { - Network vnet = arm.networks().getByResourceGroup(AzureArmTemplatesSuiteTest.GROUP, AzureTestConstants.VNET_NAME_1); + Network vnet = arm.networks().getByResourceGroup(suiteGroup, AzureTestConstants.VNET_NAME_1); // deployment would fail on creating second vnet of the same name assertThat(vnet).isNotNull(); } -} \ No newline at end of file +} diff --git a/azure/src/test/resources/sunstone.properties b/azure/src/test/resources/sunstone.properties index d5cfed17..6054869f 100644 --- a/azure/src/test/resources/sunstone.properties +++ b/azure/src/test/resources/sunstone.properties @@ -3,7 +3,8 @@ sunstone.azure.tenantId=${azure.tenantId} sunstone.azure.applicationId=${azure.applicationId} sunstone.azure.password=${azure.password} sunstone.azure.region=${azure.region:eastus2} -sunstone.azure.group=${azure.group:sunstone-testing-group} +sunstone.azure.group=sunstoneTesting-${ts.test.run} +sunstone.test.instance.name=eapSunstoneInjectInstance-${ts.test.run} sunstone.wildfly.mgmt.port=9990 sunstone.wildfly.mgmt.user=admin @@ -11,3 +12,5 @@ sunstone.wildfly.mgmt.password=pass.1234 sunstone.wildfly.mgmt.connection.timeout=120000 sunstone.wildfly.mgmt.host=master sunstone.wildfly.mgmt.profile=default + +ts.test.run=defaultrun