You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2015/09/10 10:14:00 UTC
[16/16] stratos git commit: Upgrading automation engine to v4.4.2
Upgrading automation engine to v4.4.2
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/395be450
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/395be450
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/395be450
Branch: refs/heads/stratos-4.1.x
Commit: 395be450e505ce4cdc63c3bc77435cc913aff756
Parents: f4e8570
Author: Akila Perera <ra...@gmail.com>
Authored: Thu Sep 10 13:42:12 2015 +0530
Committer: Akila Perera <ra...@gmail.com>
Committed: Thu Sep 10 13:42:36 2015 +0530
----------------------------------------------------------------------
pom.xml | 64 ++
products/stratos/modules/integration/pom.xml | 161 +----
.../integration/tests/RestConstants.java | 55 --
.../tests/StratosTestServerManager.java | 232 ------
.../integration/tests/TopologyHandler.java | 697 -------------------
.../application/ApplicationBurstingTest.java | 227 ------
.../application/ApplicationUpdateTest.java | 243 -------
.../application/GroupStartupOrderTest.java | 362 ----------
.../GroupTerminationBehaviorTest.java | 428 ------------
.../PartitionOneAfterAnotherClusterTest.java | 298 --------
.../PartitionRoundRobinClusterTest.java | 305 --------
.../application/SampleApplicationsTest.java | 409 -----------
.../application/SingleClusterScalingTest.java | 365 ----------
.../tests/group/CartridgeGroupTest.java | 266 -------
.../integration/tests/group/CartridgeTest.java | 199 ------
.../tests/policies/ApplicationPolicyTest.java | 237 -------
.../tests/policies/AutoscalingPolicyTest.java | 170 -----
.../tests/policies/DeploymentPolicyTest.java | 281 --------
.../tests/policies/NetworkPartitionTest.java | 168 -----
.../integration/tests/rest/ErrorResponse.java | 56 --
.../integration/tests/rest/HttpResponse.java | 59 --
.../tests/rest/HttpResponseHandler.java | 68 --
.../tests/rest/IntegrationMockClient.java | 102 ---
.../integration/tests/rest/RestClient.java | 387 ----------
.../tests/rest/WebClientWrapper.java | 62 --
.../integration/tests/users/TenantTest.java | 44 --
.../integration/tests/users/UserTest.java | 115 ---
.../src/test/resources/JMSOutputAdaptor.xml | 30 -
...cation-policy-application-bursting-test.json | 18 -
.../app-bursting-single-cartriddge-group.json | 70 --
...caling-policy-application-bursting-test.json | 14 -
...esb-php-group-application-bursting-test.json | 19 -
.../mock/esb-application-bursting-test.json | 50 --
.../mock/php-application-bursting-test.json | 51 --
.../mock/tomcat-application-bursting-test.json | 53 --
...oyment-policy-application-bursting-test.json | 32 -
...k-partition-application-bursting-test-1.json | 15 -
...k-partition-application-bursting-test-2.json | 24 -
...cation-policy-application-policy-test-1.json | 18 -
...cation-policy-application-policy-test-2.json | 18 -
...lication-policy-application-policy-test.json | 18 -
...ork-partition-application-policy-test-1.json | 24 -
...ork-partition-application-policy-test-2.json | 15 -
...lication-policy-application-update-test.json | 18 -
.../g-sc-G123-1-application-update-test-v1.json | 86 ---
.../g-sc-G123-1-application-update-test.json | 86 ---
...oscaling-policy-application-update-test.json | 14 -
...rdige-nested-application-update-test-v1.json | 50 --
...artrdige-nested-application-update-test.json | 50 --
.../mock/c1-application-update-test.json | 45 --
.../mock/c2-application-update-test.json | 45 --
.../mock/c3-application-update-test.json | 45 --
...yment-policy-application-update-test-v1.json | 36 -
...ployment-policy-application-update-test.json | 32 -
...-partition-application-update-test-1-v1.json | 28 -
...ork-partition-application-update-test-1.json | 15 -
...ork-partition-application-update-test-2.json | 24 -
...caling-policy-autoscaling-policy-test-1.json | 14 -
...caling-policy-autoscaling-policy-test-2.json | 14 -
...aling-policy-autoscaling-policy-test-v1.json | 14 -
...oscaling-policy-autoscaling-policy-test.json | 14 -
.../g4-g5-g6-cartridge-group-test-v1.json | 50 --
.../g4-g5-g6-cartridge-group-test.json | 50 --
.../group-1-cartridge-group-test.json | 50 --
.../group-2-cartridge-group-test.json | 50 --
.../mock/c4-cartridge-group-test.json | 45 --
.../mock/c5-cartridge-group-test.json | 124 ----
.../mock/c6-cartridge-group-test.json | 45 --
.../cartridges/mock/c0-cartridge-test-v1.json | 124 ----
.../cartridges/mock/c0-cartridge-test.json | 124 ----
.../cartridges/mock/c1-cartridge-test.json | 124 ----
.../cartridges/mock/c2-cartridge-test.json | 124 ----
...loyment-policy-deployment-policy-test-1.json | 32 -
...loyment-policy-deployment-policy-test-2.json | 32 -
...oyment-policy-deployment-policy-test-v1.json | 36 -
...eployment-policy-deployment-policy-test.json | 32 -
...k-partition-deployment-policy-test-1-v1.json | 28 -
...work-partition-deployment-policy-test-1.json | 15 -
...work-partition-deployment-policy-test-2.json | 24 -
...ication-policy-group-startup-order-test.json | 13 -
.../applications/group-startup-order-test.json | 206 ------
...scaling-policy-group-startup-order-test.json | 14 -
.../group6-group-startup-order-test.json | 44 --
.../group8-group-startup-order-test.json | 18 -
.../mock/esb-group-startup-order-test.json | 50 --
.../mock/php-group-startup-order-test.json | 51 --
.../stratos-lb-group-startup-order-test.json | 44 --
.../mock/tomcat-group-startup-order-test.json | 53 --
.../mock/tomcat1-group-startup-order-test.json | 45 --
.../mock/tomcat2-group-startup-order-test.json | 49 --
.../mock/tomcat3-group-startup-order-test.json | 31 -
...loyment-policy-group-startup-order-test.json | 18 -
...rk-partition-group-startup-order-test-1.json | 15 -
...rk-partition-group-startup-order-test-2.json | 24 -
...-policy-group-termination-behavior-test.json | 17 -
.../group-termination-behavior-test.json | 101 ---
...-policy-group-termination-behavior-test.json | 14 -
...-groups-group-termination-behavior-test.json | 58 --
.../c1-group-termination-behavior-test.json | 45 --
.../c2-group-termination-behavior-test.json | 45 --
.../c3-group-termination-behavior-test.json | 45 --
.../c4-group-termination-behavior-test.json | 45 --
...-policy-group-termination-behavior-test.json | 18 -
...ition-group-termination-behavior-test-1.json | 15 -
.../src/test/resources/instrumentation.txt | 1 -
.../src/test/resources/jndi.properties | 22 -
.../src/test/resources/keys/wso2carbon.jks | Bin 33260 -> 0 bytes
.../src/test/resources/mock-iaas.xml | 123 ----
...work-partition-network-partition-test-1.json | 15 -
...work-partition-network-partition-test-2.json | 15 -
...ork-partition-network-partition-test-v1.json | 28 -
...etwork-partition-network-partition-test.json | 15 -
...ation-policy-partition-round-robin-test.json | 13 -
.../partition-round-robin-test.json | 28 -
...aling-policy-partition-round-robin-test.json | 14 -
.../mock/c7-partition-round-robin-test.json | 45 --
...yment-policy-partition-round-robin-test.json | 22 -
...rk-partition-partition-round-robin-test.json | 24 -
...ication-policy-sample-applications-test.json | 18 -
...g-sc-G123-1-sample-applications-test-v1.json | 86 ---
.../g-sc-G123-1-sample-applications-test.json | 86 ---
.../sample-applications-test-1.json | 86 ---
.../sample-applications-test-2.json | 86 ---
...scaling-policy-sample-applications-test.json | 14 -
...dige-nested-sample-applications-test-v1.json | 50 --
...rtrdige-nested-sample-applications-test.json | 50 --
.../mock/c1-sample-applications-test.json | 45 --
.../mock/c2-sample-applications-test.json | 45 --
.../mock/c3-sample-applications-test.json | 45 --
...ment-policy-sample-applications-test-v1.json | 36 -
...loyment-policy-sample-applications-test.json | 32 -
...partition-sample-applications-test-1-v1.json | 28 -
...rk-partition-sample-applications-test-1.json | 15 -
...rk-partition-sample-applications-test-2.json | 24 -
.../integration/src/test/resources/scaling.drl | 311 ---------
...tion-policy-single-cluster-scaling-test.json | 13 -
.../single-cluster-scaling-test.json | 28 -
...ling-policy-single-cluster-scaling-test.json | 14 -
.../mock/c7-single-cluster-scaling-test.json | 45 --
...ment-policy-single-cluster-scaling-test.json | 22 -
...k-partition-single-cluster-scaling-test.json | 24 -
.../src/test/resources/stratos-testing.xml | 94 ---
.../test-conf/integration-test.properties | 26 -
.../src/test/resources/user-test/tenant-1.json | 9 -
.../src/test/resources/user-test/user-1-v1.json | 8 -
.../src/test/resources/user-test/user-1.json | 8 -
.../modules/integration/test-common/pom.xml | 126 ++++
.../integration/common/RestConstants.java | 53 ++
.../common/StratosTestServerManager.java | 516 ++++++++++++++
.../integration/common/TopologyHandler.java | 677 ++++++++++++++++++
.../apache/stratos/integration/common/Util.java | 38 +
.../extensions/StratosServerExtension.java | 145 ++++
.../integration/common/rest/ErrorResponse.java | 54 ++
.../integration/common/rest/HttpResponse.java | 54 ++
.../common/rest/HttpResponseHandler.java | 66 ++
.../common/rest/IntegrationMockClient.java | 100 +++
.../integration/common/rest/RestClient.java | 385 ++++++++++
.../common/rest/WebClientWrapper.java | 60 ++
.../integration/test-integration/pom.xml | 226 ++++++
.../tests/StratosIntegrationTest.java | 79 +++
.../application/ApplicationBurstingTest.java | 235 +++++++
.../application/ApplicationUpdateTest.java | 247 +++++++
.../application/GroupStartupOrderTest.java | 377 ++++++++++
.../GroupTerminationBehaviorTest.java | 427 ++++++++++++
.../PartitionOneAfterAnotherClusterTest.java | 291 ++++++++
.../PartitionRoundRobinClusterTest.java | 298 ++++++++
.../application/SampleApplicationsTest.java | 419 +++++++++++
.../application/SingleClusterScalingTest.java | 369 ++++++++++
.../tests/group/CartridgeGroupTest.java | 272 ++++++++
.../integration/tests/group/CartridgeTest.java | 203 ++++++
.../tests/policies/ApplicationPolicyTest.java | 243 +++++++
.../tests/policies/AutoscalingPolicyTest.java | 173 +++++
.../tests/policies/DeploymentPolicyTest.java | 285 ++++++++
.../tests/policies/NetworkPartitionTest.java | 170 +++++
.../integration/tests/users/TenantTest.java | 42 ++
.../integration/tests/users/UserTest.java | 112 +++
...cation-policy-application-bursting-test.json | 18 +
.../app-bursting-single-cartriddge-group.json | 70 ++
...caling-policy-application-bursting-test.json | 14 +
...esb-php-group-application-bursting-test.json | 19 +
.../mock/esb-application-bursting-test.json | 50 ++
.../mock/php-application-bursting-test.json | 51 ++
.../mock/tomcat-application-bursting-test.json | 53 ++
...oyment-policy-application-bursting-test.json | 32 +
...k-partition-application-bursting-test-1.json | 15 +
...k-partition-application-bursting-test-2.json | 24 +
...cation-policy-application-policy-test-1.json | 18 +
...cation-policy-application-policy-test-2.json | 18 +
...lication-policy-application-policy-test.json | 18 +
...ork-partition-application-policy-test-1.json | 24 +
...ork-partition-application-policy-test-2.json | 15 +
...lication-policy-application-update-test.json | 18 +
.../g-sc-G123-1-application-update-test-v1.json | 86 +++
.../g-sc-G123-1-application-update-test.json | 86 +++
...oscaling-policy-application-update-test.json | 14 +
...rdige-nested-application-update-test-v1.json | 50 ++
...artrdige-nested-application-update-test.json | 50 ++
.../mock/c1-application-update-test.json | 45 ++
.../mock/c2-application-update-test.json | 45 ++
.../mock/c3-application-update-test.json | 45 ++
...yment-policy-application-update-test-v1.json | 36 +
...ployment-policy-application-update-test.json | 32 +
...-partition-application-update-test-1-v1.json | 28 +
...ork-partition-application-update-test-1.json | 15 +
...ork-partition-application-update-test-2.json | 24 +
.../src/test/resources/automation.xml | 234 +++++++
.../src/test/resources/automationSchema.xsd | 573 +++++++++++++++
...caling-policy-autoscaling-policy-test-1.json | 14 +
...caling-policy-autoscaling-policy-test-2.json | 14 +
...aling-policy-autoscaling-policy-test-v1.json | 14 +
...oscaling-policy-autoscaling-policy-test.json | 14 +
.../g4-g5-g6-cartridge-group-test-v1.json | 50 ++
.../g4-g5-g6-cartridge-group-test.json | 50 ++
.../group-1-cartridge-group-test.json | 50 ++
.../group-2-cartridge-group-test.json | 50 ++
.../mock/c4-cartridge-group-test.json | 45 ++
.../mock/c5-cartridge-group-test.json | 124 ++++
.../mock/c6-cartridge-group-test.json | 45 ++
.../cartridges/mock/c0-cartridge-test-v1.json | 124 ++++
.../cartridges/mock/c0-cartridge-test.json | 124 ++++
.../cartridges/mock/c1-cartridge-test.json | 124 ++++
.../cartridges/mock/c2-cartridge-test.json | 124 ++++
.../test/resources/common/JMSOutputAdaptor.xml | 30 +
.../src/test/resources/common/autoscaler.xml | 57 ++
.../common/cartridge-config.properties | 27 +
.../test/resources/common/cloud-controller.xml | 81 +++
.../src/test/resources/common/identity.xml | 260 +++++++
.../src/test/resources/common/jndi.properties | 22 +
.../src/test/resources/common/log4j.properties | 206 ++++++
.../src/test/resources/common/mock-iaas.xml | 123 ++++
.../src/test/resources/common/scaling.drl | 311 +++++++++
.../resources/common/thrift-client-config.xml | 27 +
...loyment-policy-deployment-policy-test-1.json | 32 +
...loyment-policy-deployment-policy-test-2.json | 32 +
...oyment-policy-deployment-policy-test-v1.json | 36 +
...eployment-policy-deployment-policy-test.json | 32 +
...k-partition-deployment-policy-test-1-v1.json | 28 +
...work-partition-deployment-policy-test-1.json | 15 +
...work-partition-deployment-policy-test-2.json | 24 +
.../src/test/resources/filters.txt | 16 +
...ication-policy-group-startup-order-test.json | 13 +
.../applications/group-startup-order-test.json | 206 ++++++
...scaling-policy-group-startup-order-test.json | 14 +
.../group6-group-startup-order-test.json | 44 ++
.../group8-group-startup-order-test.json | 18 +
.../mock/esb-group-startup-order-test.json | 50 ++
.../mock/php-group-startup-order-test.json | 51 ++
.../stratos-lb-group-startup-order-test.json | 44 ++
.../mock/tomcat-group-startup-order-test.json | 53 ++
.../mock/tomcat1-group-startup-order-test.json | 45 ++
.../mock/tomcat2-group-startup-order-test.json | 49 ++
.../mock/tomcat3-group-startup-order-test.json | 31 +
...loyment-policy-group-startup-order-test.json | 18 +
...rk-partition-group-startup-order-test-1.json | 15 +
...rk-partition-group-startup-order-test-2.json | 24 +
...-policy-group-termination-behavior-test.json | 17 +
.../group-termination-behavior-test.json | 101 +++
...-policy-group-termination-behavior-test.json | 14 +
...-groups-group-termination-behavior-test.json | 58 ++
.../c1-group-termination-behavior-test.json | 45 ++
.../c2-group-termination-behavior-test.json | 45 ++
.../c3-group-termination-behavior-test.json | 45 ++
.../c4-group-termination-behavior-test.json | 45 ++
...-policy-group-termination-behavior-test.json | 18 +
...ition-group-termination-behavior-test-1.json | 15 +
.../src/test/resources/instrumentation.txt | 1 +
.../keystores/products/client-truststore.jks | Bin 0 -> 37935 bytes
.../resources/keystores/products/userRP.jks | Bin 0 -> 33278 bytes
.../resources/keystores/products/wso2carbon.jks | Bin 0 -> 33260 bytes
...work-partition-network-partition-test-1.json | 15 +
...work-partition-network-partition-test-2.json | 15 +
...ork-partition-network-partition-test-v1.json | 28 +
...etwork-partition-network-partition-test.json | 15 +
...ation-policy-partition-round-robin-test.json | 13 +
.../partition-round-robin-test.json | 28 +
...aling-policy-partition-round-robin-test.json | 14 +
.../mock/c7-partition-round-robin-test.json | 45 ++
...yment-policy-partition-round-robin-test.json | 22 +
...rk-partition-partition-round-robin-test.json | 24 +
...ication-policy-sample-applications-test.json | 18 +
...g-sc-G123-1-sample-applications-test-v1.json | 86 +++
.../g-sc-G123-1-sample-applications-test.json | 86 +++
.../sample-applications-test-1.json | 86 +++
.../sample-applications-test-2.json | 86 +++
...scaling-policy-sample-applications-test.json | 14 +
...dige-nested-sample-applications-test-v1.json | 50 ++
...rtrdige-nested-sample-applications-test.json | 50 ++
.../mock/c1-sample-applications-test.json | 45 ++
.../mock/c2-sample-applications-test.json | 45 ++
.../mock/c3-sample-applications-test.json | 45 ++
...ment-policy-sample-applications-test-v1.json | 36 +
...loyment-policy-sample-applications-test.json | 32 +
...partition-sample-applications-test-1-v1.json | 28 +
...rk-partition-sample-applications-test-1.json | 15 +
...rk-partition-sample-applications-test-2.json | 24 +
...tion-policy-single-cluster-scaling-test.json | 13 +
.../single-cluster-scaling-test.json | 28 +
...ling-policy-single-cluster-scaling-test.json | 14 +
.../mock/c7-single-cluster-scaling-test.json | 45 ++
...ment-policy-single-cluster-scaling-test.json | 22 +
...k-partition-single-cluster-scaling-test.json | 24 +
.../src/test/resources/stratos-testng.xml | 101 +++
.../src/test/resources/user-test/tenant-1.json | 9 +
.../src/test/resources/user-test/user-1-v1.json | 8 +
.../src/test/resources/user-test/user-1.json | 8 +
305 files changed, 13276 insertions(+), 10986 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index c94e1f0..6fe098c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -419,6 +419,12 @@
<dependencyManagement>
<dependencies>
<dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>SecVerifier</artifactId>
+ <type>aar</type>
+ <version>${carbon.kernel.version}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
@@ -473,6 +479,57 @@
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-exec</artifactId>
+ <version>${commons.exec.version}</version>
+ </dependency>
+
+ <!-- Automation framework dependencies -->
+ <dependency>
+ <groupId>org.wso2.carbon.automation</groupId>
+ <artifactId>org.wso2.carbon.automation.test.utils</artifactId>
+ <version>${carbon.automation.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon.automation</groupId>
+ <artifactId>org.wso2.carbon.automation.engine</artifactId>
+ <version>${carbon.automation.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon.automation</groupId>
+ <artifactId>org.wso2.carbon.automation.extensions</artifactId>
+ <version>${carbon.automation.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon.automationutils</groupId>
+ <artifactId>org.wso2.carbon.integration.common.utils</artifactId>
+ <version>${carbon.automationutils.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon.automationutils</groupId>
+ <artifactId>org.wso2.carbon.integration.common.admin.client</artifactId>
+ <version>${carbon.automationutils.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon.automationutils</groupId>
+ <artifactId>org.wso2.carbon.integration.common.extensions</artifactId>
+ <version>${carbon.automationutils.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>${testng.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jacoco</groupId>
+ <artifactId>org.jacoco.agent</artifactId>
+ <version>${jacoco.agent.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -715,6 +772,8 @@
<!-- Carbon related versions -->
<carbon.kernel.version>4.2.0</carbon.kernel.version>
<carbon.deployment.version>4.2.3</carbon.deployment.version>
+ <carbon.automation.version>4.4.2</carbon.automation.version>
+ <carbon.automationutils.version>4.4.2</carbon.automationutils.version>
<carbon.ui.stratos.version>4.2.0-stratosv2</carbon.ui.stratos.version>
<carbon.p2.plugin.version>1.5.4</carbon.p2.plugin.version>
<carbon.platform.patch.version.4.2.1>4.2.1</carbon.platform.patch.version.4.2.1>
@@ -770,6 +829,11 @@
<siddhi.version>2.0.0-wso2v5</siddhi.version>
<siddhi.event.processor.version>1.0.0</siddhi.event.processor.version>
<scr.annotations.version>1.9.12</scr.annotations.version>
+ <testng.version>6.1.1</testng.version>
+ <jacoco.agent.version>0.7.4.201502262128</jacoco.agent.version>
+ <commons.exec.version>1.0.1</commons.exec.version>
+ <httpcore.version>4.3.0.wso2v1</httpcore.version>
+ <httpclient.version>4.2.5.wso2v1</httpclient.version>
<!-- OSGi import ranges -->
<axiom.osgi.version.range>[1.2.11.wso2v4, 1.3.0)</axiom.osgi.version.range>
http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/products/stratos/modules/integration/pom.xml
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/pom.xml b/products/stratos/modules/integration/pom.xml
index 1c8e36d..bbf43f0 100755
--- a/products/stratos/modules/integration/pom.xml
+++ b/products/stratos/modules/integration/pom.xml
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
@@ -17,9 +16,8 @@
~ specific language governing permissions and limitations
~ under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.stratos</groupId>
@@ -29,153 +27,12 @@
</parent>
<artifactId>stratos-integration</artifactId>
- <name>Apache Stratos - Integration Tests</name>
- <packaging>jar</packaging>
+ <packaging>pom</packaging>
+ <name>Apache Stratos - Integration Aggregation Module</name>
+ <description>Apache Stratos - Integration Aggregation Module</description>
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-exec</artifactId>
- <version>1.0.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.integration.framework</artifactId>
- <version>${carbon.kernel.version}</version>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>6.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.axis2.wso2</groupId>
- <artifactId>axis2-client</artifactId>
- <version>${axis2.wso2.version}</version>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.addressing</artifactId>
- <version>${carbon.kernel.version}</version>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.integration.core</artifactId>
- <version>${carbon.kernel.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>SecVerifier</artifactId>
- <version>${carbon.kernel.version}</version>
- <type>aar</type>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-all</artifactId>
- <version>5.10.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents.wso2</groupId>
- <artifactId>httpcore</artifactId>
- <version>4.3.0.wso2v1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents.wso2</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.2.5.wso2v1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.messaging</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.mock.iaas.client</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.wso2.andes.wso2</groupId>
- <artifactId>andes-client</artifactId>
- <version>0.13.wso2v8</version>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>src/test/resources/test-conf</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <inherited>false</inherited>
- <configuration>
- <systemProperties>
- <maven.test.haltafterfailure>false</maven.test.haltafterfailure>
- <sec.verifier.dir>${basedir}/target/security-verifier/</sec.verifier.dir>
- <extracted.dir>stratos-parent-${project.version}</extracted.dir>
- <emma.home>${basedir}/target/emma</emma.home>
- </systemProperties>
- <suiteXmlFiles>
- <suiteXmlFile>src/test/resources/stratos-testing.xml</suiteXmlFile>
- </suiteXmlFiles>
- <workingDirectory>${basedir}/target</workingDirectory>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-emma-dependencies</id>
- <phase>compile</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/emma</outputDirectory>
- <includeTypes>jar</includeTypes>
- <includeArtifactIds>emma,org.wso2.carbon.integration.framework</includeArtifactIds>
- </configuration>
- </execution>
- <execution>
- <id>copy-secVerifier</id>
- <phase>compile</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${basedir}/target/security-verifier</outputDirectory>
- <includeTypes>aar</includeTypes>
- <includeArtifactIds>SecVerifier</includeArtifactIds>
- <stripVersion>true</stripVersion>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <modules>
+ <module>test-common</module>
+ <module>test-integration</module>
+ </modules>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
deleted file mode 100644
index b460a78..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/RestConstants.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.integration.tests;
-
-/**
- * Constant class to keep track of rest endpoint context
- */
-public class RestConstants {
- public static final String API = "api";
- public static final String AUTOSCALING_POLICIES = "/" + API + "/autoscalingPolicies";
- public static final String USERS = "/" + API + "/users";
- public static final String TENANTS = "/" + API + "/tenants";
- public static final String DEPLOYMENT_POLICIES = "/" + API + "/deploymentPolicies";
- public static final String NETWORK_PARTITIONS = "/" + API + "/networkPartitions";
- public static final String CARTRIDGES = "/" + API + "/cartridges";
- public static final String CARTRIDGE_GROUPS = "/" + API + "/cartridgeGroups";
- public static final String APPLICATION_POLICIES = "/" + API + "/applicationPolicies";
- public static final String APPLICATIONS = "/" + API + "/applications";
- public static final String APPLICATIONS_RUNTIME = "/runtime";
- public static final String APPLICATIONS_DEPLOY = "/deploy";
- public static final String APPLICATIONS_UNDEPLOY = "/undeploy";
-
- public static final String AUTOSCALING_POLICIES_PATH = "/autoscaling-policies/";
- public static final String AUTOSCALING_POLICIES_NAME = "autoscalingPolicy";
- public static final String CARTRIDGE_GROUPS_PATH = "/cartridges-groups/";
- public static final String CARTRIDGE_GROUPS_NAME = "cartridgeGroup";
- public static final String CARTRIDGES_PATH = "/cartridges/mock/";
- public static final String CARTRIDGES_NAME = "cartridge";
- public static final String NETWORK_PARTITIONS_PATH = "/network-partitions/mock/";
- public static final String NETWORK_PARTITIONS_NAME = "networkPartition";
- public static final String USERS_NAME = "users";
- public static final String DEPLOYMENT_POLICIES_PATH = "/deployment-policies/";
- public static final String DEPLOYMENT_POLICIES_NAME = "deploymentPolicy";
- public static final String APPLICATIONS_PATH = "/applications/";
- public static final String APPLICATIONS_NAME = "application";
- public static final String APPLICATION_POLICIES_PATH = "/application-policies/";
- public static final String APPLICATION_POLICIES_NAME = "applicationPolicy";
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
deleted file mode 100755
index ea3d8f9..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/StratosTestServerManager.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.integration.tests;
-
-import org.apache.activemq.broker.BrokerService;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.stratos.common.test.TestLogAppender;
-import org.apache.stratos.integration.tests.rest.IntegrationMockClient;
-import org.apache.stratos.integration.tests.rest.RestClient;
-import org.testng.annotations.AfterSuite;
-import org.testng.annotations.BeforeSuite;
-import org.wso2.carbon.integration.framework.TestServerManager;
-import org.wso2.carbon.integration.framework.utils.FrameworkSettings;
-import org.wso2.carbon.integration.framework.utils.ServerUtils;
-import org.wso2.carbon.integration.framework.utils.TestUtil;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Properties;
-
-import static org.testng.Assert.assertNotNull;
-
-/**
- * Prepare activemq, Stratos server for tests, enables mock iaas, starts servers and stop them after the tests.
- */
-public class StratosTestServerManager extends TestServerManager {
- private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
- private static Properties integrationProperties;
- public static final String BASE_PATH = StratosTestServerManager.class.getResource("/").getPath();
- public static final String STRATOS_DISTRIBUTION_NAME = "distribution.path";
- public final static String PORT_OFFSET = "carbon.port.offset";
- public static final String ACTIVEMQ_BIND_ADDRESS = "activemq.bind.address";
- public static final String STRATOS_ENDPOINT = "stratos.endpoint";
- public static final String ADMIN_USERNAME = "stratos.admin.username";
- public static final String ADMIN_PASSWORD = "stratos.admin.password";
- public static final String MOCK_IAAS_XML_FILE = "mock-iaas.xml";
- public static final String SCALING_DROOL_FILE = "scaling.drl";
- public static final String JNDI_PROPERTIES_FILE = "jndi.properties";
- public static final String JMS_OUTPUT_ADAPTER_FILE = "JMSOutputAdaptor.xml";
-
- protected String distributionName;
- protected int portOffset;
- protected String adminUsername;
- protected String adminPassword;
- protected String stratosEndpoint;
- protected String activemqBindAddress;
- protected RestClient restClient;
- private BrokerService broker = new BrokerService();
- private TestLogAppender testLogAppender = new TestLogAppender();
- private ServerUtils serverUtils;
- private String carbonHome;
- protected IntegrationMockClient mockIaasApiClient;
-
- public StratosTestServerManager() {
- super(BASE_PATH + getIntegrationTestProperty(STRATOS_DISTRIBUTION_NAME),
- Integer.parseInt(getIntegrationTestProperty(PORT_OFFSET)));
-
- distributionName = integrationProperties.getProperty(STRATOS_DISTRIBUTION_NAME);
- portOffset = Integer.parseInt(integrationProperties.getProperty(PORT_OFFSET));
- adminUsername = integrationProperties.getProperty(ADMIN_USERNAME);
- adminPassword = integrationProperties.getProperty(ADMIN_PASSWORD);
- stratosEndpoint = integrationProperties.getProperty(STRATOS_ENDPOINT);
- activemqBindAddress = integrationProperties.getProperty(ACTIVEMQ_BIND_ADDRESS);
- serverUtils = new ServerUtils();
- restClient = new RestClient(stratosEndpoint, adminUsername, adminPassword);
- mockIaasApiClient = new IntegrationMockClient(stratosEndpoint + "/mock-iaas/api");
- }
-
- private static String getIntegrationTestProperty(String key) {
- if (integrationProperties == null) {
- integrationProperties = new Properties();
- try {
- integrationProperties
- .load(StratosTestServerManager.class.getResourceAsStream("/integration-test.properties"));
- log.info("Stratos integration properties: " + integrationProperties.toString());
- }
- catch (IOException e) {
- log.error("Error loading integration-test.properties file from classpath. Please make sure that file " +
- "exists in classpath.", e);
- }
- }
- return integrationProperties.getProperty(key);
- }
-
- @Override
- @BeforeSuite(timeOut = 600000)
- public String startServer() throws IOException {
- Logger.getRootLogger().addAppender(testLogAppender);
- Logger.getRootLogger().setLevel(Level.INFO);
-
- try {
- // Start ActiveMQ
- long time1 = System.currentTimeMillis();
- log.info("Starting ActiveMQ...");
- broker.setDataDirectory(StratosTestServerManager.class.getResource("/").getPath() +
- File.separator + ".." + File.separator + "activemq-data");
- broker.setBrokerName("testBroker");
- broker.addConnector(activemqBindAddress);
- broker.start();
- long time2 = System.currentTimeMillis();
- log.info(String.format("ActiveMQ started in %d sec", (time2 - time1) / 1000));
- }
- catch (Exception e) {
- throw new RuntimeException("Could not start ActiveMQ", e);
- }
-
- try {
- log.info("Setting up Stratos server...");
- long time3 = System.currentTimeMillis();
- String carbonZip = getCarbonZip();
- if (carbonZip == null) {
- carbonZip = System.getProperty("carbon.zip");
- }
-
- if (carbonZip == null) {
- throw new IllegalArgumentException("carbon zip file is null");
- } else {
- carbonHome = this.serverUtils.setUpCarbonHome(carbonZip);
- TestUtil.copySecurityVerificationService(carbonHome);
- this.copyArtifacts(carbonHome);
- log.info("Stratos server setup completed");
-
- log.info("Starting Stratos server...");
- this.serverUtils.startServerUsingCarbonHome(carbonHome, carbonHome, "stratos", portOffset, null);
- FrameworkSettings.init();
-
- while (!serverStarted()) {
- log.info("Waiting for topology to be initialized...");
- Thread.sleep(5000);
- }
-
- while (!mockServiceStarted()) {
- log.info("Waiting for mock service to be initialized...");
- Thread.sleep(1000);
- }
-
- long time4 = System.currentTimeMillis();
- log.info(String.format("Stratos server started in %d sec", (time4 - time3) / 1000));
- return carbonHome;
- }
- }
- catch (Exception e) {
- throw new RuntimeException("Could not start Stratos server", e);
- }
- }
-
- private boolean mockServiceStarted() {
- for (String message : testLogAppender.getMessages()) {
- if (message.contains("Mock IaaS service component activated")) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- @AfterSuite(timeOut = 600000)
- public void stopServer() throws Exception {
- super.stopServer();
- /*
- while (!serverStopped()) {
- log.info("Waiting for server to be shutdown...");
- Thread.sleep(1000);
- }
- log.info("Stopped Apache Stratos server.");
- */
- broker.stop();
- log.info("Stopped ActiveMQ server.");
- }
-
- protected void copyArtifacts(String carbonHome) throws IOException {
- copyConfigFile(carbonHome, MOCK_IAAS_XML_FILE);
- copyConfigFile(carbonHome, JNDI_PROPERTIES_FILE);
- copyConfigFile(carbonHome, SCALING_DROOL_FILE, "repository/conf/drools");
- copyConfigFile(carbonHome, JMS_OUTPUT_ADAPTER_FILE, "repository/deployment/server/outputeventadaptors");
- }
-
- private void copyConfigFile(String carbonHome, String sourceFilePath) throws IOException {
- copyConfigFile(carbonHome, sourceFilePath, "repository/conf");
- }
-
- private void copyConfigFile(String carbonHome, String sourceFilePath, String destinationFolder) throws IOException {
- log.info("Copying file: " + sourceFilePath);
- URL fileURL = getClass().getResource("/" + sourceFilePath);
- assertNotNull(fileURL);
- File srcFile = new File(fileURL.getFile());
- File destFile = new File(carbonHome + "/" + destinationFolder + "/" + sourceFilePath);
- FileUtils.copyFile(srcFile, destFile);
- log.info(sourceFilePath + " file copied");
- }
-
- private boolean serverStopped() {
- for (String message : testLogAppender.getMessages()) {
- if (message.contains("Halting JVM")) {
- return true;
- }
- }
- return false;
- }
-
-
- private boolean serverStarted() {
- for (String message : testLogAppender.getMessages()) {
- if (message.contains("Topology initialized")) {
- return true;
- }
- }
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/395be450/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
deleted file mode 100644
index 3a1e6c6..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/TopologyHandler.java
+++ /dev/null
@@ -1,697 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.integration.tests;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.autoscaler.stub.pojo.ApplicationContext;
-import org.apache.stratos.common.client.AutoscalerServiceClient;
-import org.apache.stratos.common.threading.StratosThreadPool;
-import org.apache.stratos.integration.tests.rest.IntegrationMockClient;
-import org.apache.stratos.messaging.domain.application.*;
-import org.apache.stratos.messaging.domain.instance.ClusterInstance;
-import org.apache.stratos.messaging.domain.instance.GroupInstance;
-import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.messaging.domain.topology.Member;
-import org.apache.stratos.messaging.domain.topology.MemberStatus;
-import org.apache.stratos.messaging.domain.topology.Service;
-import org.apache.stratos.messaging.event.Event;
-import org.apache.stratos.messaging.event.application.*;
-import org.apache.stratos.messaging.event.topology.*;
-import org.apache.stratos.messaging.listener.application.*;
-import org.apache.stratos.messaging.listener.topology.*;
-import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
-import org.apache.stratos.messaging.message.receiver.application.ApplicationsEventReceiver;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-
-import java.io.File;
-import java.rmi.RemoteException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-
-import static junit.framework.Assert.*;
-
-/**
- * To start the Topology receivers
- */
-public class TopologyHandler {
- private static final Log log = LogFactory.getLog(TopologyHandler.class);
-
- public static final int APPLICATION_ACTIVATION_TIMEOUT = 360000;
- public static final int APPLICATION_UNDEPLOYMENT_TIMEOUT = 120000;
- public static final int MEMBER_TERMINATION_TIMEOUT = 120000;
- public static final int APPLICATION_TOPOLOGY_TIMEOUT = 90000;
- public static final String APPLICATION_STATUS_CREATED = "Created";
- public static final String APPLICATION_STATUS_UNDEPLOYING = "Undeploying";
- private ApplicationsEventReceiver applicationsEventReceiver;
- private TopologyEventReceiver topologyEventReceiver;
- public static TopologyHandler topologyHandler;
- private Map<String, Long> terminatedMembers = new ConcurrentHashMap<String, Long>();
- private Map<String, Long> terminatingMembers = new ConcurrentHashMap<String, Long>();
- private Map<String, Long> createdMembers = new ConcurrentHashMap<String, Long>();
- private Map<String, Long> inActiveMembers = new ConcurrentHashMap<String, Long>();
- private Map<String, Long> activateddMembers = new ConcurrentHashMap<String, Long>();
-
- private TopologyHandler() {
- // Set jndi.properties.dir system property for initializing event receivers
- System.setProperty("jndi.properties.dir", getResourcesFolderPath());
- System.setProperty("autoscaler.service.url", "https://localhost:9443/services/AutoscalerService");
- initializeApplicationEventReceiver();
- initializeTopologyEventReceiver();
- assertApplicationTopologyInitialized();
- assertTopologyInitialized();
- addTopologyEventListeners();
- addApplicationEventListeners();
- }
-
- public static TopologyHandler getInstance() {
- if (topologyHandler == null) {
- synchronized (TopologyHandler.class) {
- if (topologyHandler == null) {
- topologyHandler = new TopologyHandler();
- }
- }
- }
- return topologyHandler;
- }
-
-
- /**
- * Initialize application event receiver
- */
- private void initializeApplicationEventReceiver() {
- if (applicationsEventReceiver == null) {
- applicationsEventReceiver = new ApplicationsEventReceiver();
- ExecutorService executorService = StratosThreadPool.getExecutorService("STRATOS_TEST_SERVER", 1);
- applicationsEventReceiver.setExecutorService(executorService);
- applicationsEventReceiver.execute();
- }
- }
-
- /**
- * Initialize Topology event receiver
- */
- private void initializeTopologyEventReceiver() {
- if (topologyEventReceiver == null) {
- topologyEventReceiver = new TopologyEventReceiver();
- ExecutorService executorService = StratosThreadPool.getExecutorService("STRATOS_TEST_SERVER1", 1);
- topologyEventReceiver.setExecutorService(executorService);
- topologyEventReceiver.execute();
- }
- }
-
- /**
- * Assert application Topology initialization
- */
- private void assertApplicationTopologyInitialized() {
- long startTime = System.currentTimeMillis();
- boolean applicationTopologyInitialized = ApplicationManager.getApplications().isInitialized();
- while (!applicationTopologyInitialized) {
- try {
- Thread.sleep(1000);
- }
- catch (InterruptedException ignore) {
- }
- applicationTopologyInitialized = ApplicationManager.getApplications().isInitialized();
- if ((System.currentTimeMillis() - startTime) > APPLICATION_TOPOLOGY_TIMEOUT) {
- break;
- }
- }
- assertEquals(String.format("Application Topology didn't get initialized "), applicationTopologyInitialized,
- true);
- }
-
- /**
- * Assert Topology initialization
- */
- private void assertTopologyInitialized() {
- long startTime = System.currentTimeMillis();
- boolean topologyInitialized = TopologyManager.getTopology().isInitialized();
- while (!topologyInitialized) {
- try {
- Thread.sleep(1000);
- }
- catch (InterruptedException ignore) {
- }
- topologyInitialized = TopologyManager.getTopology().isInitialized();
- if ((System.currentTimeMillis() - startTime) > APPLICATION_TOPOLOGY_TIMEOUT) {
- break;
- }
- }
- assertEquals(String.format("Topology didn't get initialized "), topologyInitialized, true);
- }
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- public void assertApplicationStatus(String applicationName, ApplicationStatus status) {
- long startTime = System.currentTimeMillis();
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- while (!((application != null) && (application.getStatus() == status))) {
- try {
- Thread.sleep(1000);
- }
- catch (InterruptedException ignore) {
- }
- application = ApplicationManager.getApplications().getApplication(applicationName);
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- assertNotNull(String.format("Application is not found: [application-id] %s", applicationName), application);
- assertEquals(String.format("Application status did not change to %s: [application-id] %s", status.toString(),
- applicationName), status, application.getStatus());
- }
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- public void assertGroupActivation(String applicationName) {
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- assertNotNull(String.format("Application is not found: [application-id] %s",
- applicationName), application);
-
- Collection<Group> groups = application.getAllGroupsRecursively();
- for (Group group : groups) {
- assertEquals(group.getInstanceContextCount() >= group.getGroupMinInstances(), true);
- }
- }
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- public void assertClusterActivation(String applicationName) {
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- assertNotNull(String.format("Application is not found: [application-id] %s",
- applicationName), application);
-
- Set<ClusterDataHolder> clusterDataHolderSet = application.getClusterDataRecursively();
- for (ClusterDataHolder clusterDataHolder : clusterDataHolderSet) {
- String serviceName = clusterDataHolder.getServiceType();
- String clusterId = clusterDataHolder.getClusterId();
- Service service = TopologyManager.getTopology().getService(serviceName);
- assertNotNull(String.format("Service is not found: [application-id] %s [service] %s",
- applicationName, serviceName), service);
-
- Cluster cluster = service.getCluster(clusterId);
- assertNotNull(String.format("Cluster is not found: [application-id] %s [service] %s [cluster-id] %s",
- applicationName, serviceName, clusterId), cluster);
- for (Member member : cluster.getMembers()) {
- log.info(String.format(
- "Member [member-id] %s in [status] %s found in [cluster-instance] %s of [cluster-id] %s",
- member.getMemberId(), member.getStatus(), member.getClusterInstanceId(),
- member.getClusterId()));
- }
- boolean clusterActive = false;
- int activeInstances;
- for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) {
- log.info("Checking for active members in cluster instance: " + instance.getInstanceId());
- activeInstances = 0;
- for (Member member : cluster.getMembers()) {
- if (member.getClusterInstanceId().equals(instance.getInstanceId())) {
- if (member.getStatus().equals(MemberStatus.Active)) {
- activeInstances++;
- }
- }
- }
- log.info("Active instance count of " + activeInstances + " found for [cluster-instance] " + instance
- .getInstanceId() + " with [min-count] " + clusterDataHolder.getMinInstances());
- clusterActive = (activeInstances >= clusterDataHolder.getMinInstances());
- assertTrue(String.format("Cluster status did not change to active: [cluster-id] %s", clusterId),
- clusterActive);
- }
- }
- }
-
- /**
- * Get all the members that belongs to the cluster identified by cartridge name and application name in the
- * topology
- *
- * @param cartridgeName
- * @param applicationName
- */
- public Map<String, Member> getMembersForCluster(String cartridgeName, String applicationName) {
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- assertNotNull(String.format("Application is not found: [application-id] %s", applicationName), application);
- Set<ClusterDataHolder> clusterDataHolderSet = application.getClusterDataRecursively();
- Map<String, Member> memberMap = new HashMap<String, Member>();
- for (ClusterDataHolder clusterDataHolder : clusterDataHolderSet) {
- String serviceName = clusterDataHolder.getServiceType();
- if (cartridgeName.equals(serviceName)) {
- String clusterId = clusterDataHolder.getClusterId();
- Service service = TopologyManager.getTopology().getService(serviceName);
- assertNotNull(String.format("Service is not found: [application-id] %s [service] %s",
- applicationName, serviceName), service);
-
- Cluster cluster = service.getCluster(clusterId);
- assertNotNull(String.format("Cluster is not found: [application-id] %s [service] %s [cluster-id] %s",
- applicationName, serviceName, clusterId), cluster);
- for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) {
- for (Member member : cluster.getMembers()) {
- memberMap.put(member.getMemberId(), member);
- }
- }
- }
- }
- return memberMap;
- }
-
- /**
- * Terminate a member in mock iaas directly without involving Stratos REST API
- * This is similar to manually terminating an instance in an IaaS. This could be used to simulate member failures
- *
- * @param memberId
- * @param mockIaasApiClient
- */
- public void terminateMemberInMockIaas(String memberId, IntegrationMockClient mockIaasApiClient) {
- boolean memberTerminated = false;
- memberTerminated = mockIaasApiClient.terminateInstance(memberId);
- assertTrue(String.format("Member [member-id] %s couldn't be terminated from the mock IaaS", memberId),
- memberTerminated);
- }
-
- public void assertMemberTermination(String memberId) {
- long startTime = System.currentTimeMillis();
- assertNotNull(String.format("Member id is not found: [member-id] %s", memberId));
- boolean hasMemberRemoved = false;
- while (!hasMemberRemoved) {
- // Wait until the member gets removed by MemberTerminatedEvent topology receiver
- if (getTerminatingMembers().get(memberId) == null &&
- getInActiveMembers().get(memberId) == null &&
- getActivateddMembers().get(memberId) == null &&
- getCreatedMembers().get(memberId) == null) {
- getTerminatedMembers().remove(memberId);
- hasMemberRemoved = true;
- } else {
- if (getTerminatedMembers().get(memberId) - startTime > MEMBER_TERMINATION_TIMEOUT) {
- break;
- }
- }
- try {
- Thread.sleep(1000);
- }
- catch (InterruptedException e) {
- log.error("Could not sleep", e);
- }
- }
- assertTrue(String.format("Member [member-id] %s did not get removed from the topology", memberId),
- hasMemberRemoved);
- }
-
- public void assertClusterMinMemberCount(String applicationName, int minMembers) {
- long startTime = System.currentTimeMillis();
-
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- assertNotNull(String.format("Application is not found: [application-id] %s",
- applicationName), application);
-
- Set<ClusterDataHolder> clusterDataHolderSet = application.getClusterDataRecursively();
- for (ClusterDataHolder clusterDataHolder : clusterDataHolderSet) {
- String serviceName = clusterDataHolder.getServiceType();
- String clusterId = clusterDataHolder.getClusterId();
- Service service = TopologyManager.getTopology().getService(serviceName);
- assertNotNull(String.format("Service is not found: [application-id] %s [service] %s",
- applicationName, serviceName), service);
-
- Cluster cluster = service.getCluster(clusterId);
- assertNotNull(String.format("Cluster is not found: [application-id] %s [service] %s [cluster-id] %s",
- applicationName, serviceName, clusterId), cluster);
- boolean clusterActive = false;
-
- for (ClusterInstance instance : cluster.getInstanceIdToInstanceContextMap().values()) {
- int activeInstances = 0;
- for (Member member : cluster.getMembers()) {
- if (member.getClusterInstanceId().equals(instance.getInstanceId())) {
- if (member.getStatus().equals(MemberStatus.Active)) {
- activeInstances++;
- }
- }
- }
- clusterActive = activeInstances >= minMembers;
-
- while (!clusterActive) {
- try {
- Thread.sleep(1000);
- }
- catch (InterruptedException ignore) {
- }
- service = TopologyManager.getTopology().getService(serviceName);
- assertNotNull(String.format("Service is not found: [application-id] %s [service] %s",
- applicationName, serviceName), service);
-
- cluster = service.getCluster(clusterId);
- activeInstances = 0;
- for (Member member : cluster.getMembers()) {
- if (member.getClusterInstanceId().equals(instance.getInstanceId())) {
- if (member.getStatus().equals(MemberStatus.Active)) {
- activeInstances++;
- }
- }
- }
- clusterActive = activeInstances >= minMembers;
- assertNotNull(
- String.format("Cluster is not found: [application-id] %s [service] %s [cluster-id] %s",
- applicationName, serviceName, clusterId), cluster);
-
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- }
- assertEquals(String.format("Cluster status did not change to active: [cluster-id] %s", clusterId),
- clusterActive, true);
- }
-
- }
-
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- public boolean assertApplicationUndeploy(String applicationName) {
- long startTime = System.currentTimeMillis();
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- ApplicationContext applicationContext = null;
- try {
- applicationContext = AutoscalerServiceClient.getInstance().getApplication(applicationName);
- }
- catch (RemoteException e) {
- log.error("Error while getting the application context for [application] " + applicationName);
- }
- while (((application != null) && application.getInstanceContextCount() > 0) ||
- (applicationContext == null || applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING))) {
- try {
- Thread.sleep(1000);
- }
- catch (InterruptedException ignore) {
- }
- application = ApplicationManager.getApplications().getApplication(applicationName);
- try {
- applicationContext = AutoscalerServiceClient.getInstance().getApplication(applicationName);
- }
- catch (RemoteException e) {
- log.error("Error while getting the application context for [application] " + applicationName);
- }
- if ((System.currentTimeMillis() - startTime) > APPLICATION_UNDEPLOYMENT_TIMEOUT) {
- break;
- }
- }
-
- assertNotNull(String.format("Application is not found: [application-id] %s",
- applicationName), application);
- assertNotNull(String.format("Application Context is not found: [application-id] %s",
- applicationName), applicationContext);
-
- //Force undeployment after the graceful deployment
- if (application.getInstanceContextCount() > 0 ||
- applicationContext.getStatus().equals(APPLICATION_STATUS_UNDEPLOYING)) {
- return false;
- }
- assertEquals(
- String.format("Application status did not change to Created: [application-id] %s", applicationName),
- APPLICATION_STATUS_CREATED, applicationContext.getStatus());
- return true;
- }
-
- /**
- * Assert application activation
- *
- * @param applicationName
- */
- public void assertGroupInstanceCount(String applicationName, String groupAlias, int count) {
- long startTime = System.currentTimeMillis();
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- if (application != null) {
- Group group = application.getGroupRecursively(groupAlias);
- while (group.getInstanceContextCount() != count) {
- try {
- Thread.sleep(1000);
- }
- catch (InterruptedException ignore) {
- }
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- for (GroupInstance instance : group.getInstanceIdToInstanceContextMap().values()) {
- while (!instance.getStatus().equals(GroupStatus.Active)) {
- try {
- Thread.sleep(1000);
- }
- catch (InterruptedException ignore) {
- }
- if ((System.currentTimeMillis() - startTime) > APPLICATION_ACTIVATION_TIMEOUT) {
- break;
- }
- }
- }
- assertEquals(
- String.format("Application status did not change to active: [application-id] %s", applicationName),
- group.getInstanceContextCount(), count);
- }
- assertNotNull(String.format("Application is not found: [application-id] %s", applicationName), application);
-
- }
-
- public void assertApplicationNotExists(String applicationName) {
- Application application = ApplicationManager.getApplications().getApplication(applicationName);
- assertNull(String.format("Application is found in the topology : [application-id] %s", applicationName),
- application);
- }
-
- /**
- * Get resources folder path
- *
- * @return
- */
- private String getResourcesFolderPath() {
- String path = getClass().getResource("/").getPath();
- return StringUtils.removeEnd(path, File.separator);
- }
-
- private void addTopologyEventListeners() {
- topologyEventReceiver.addEventListener(new MemberTerminatedEventListener() {
- @Override
- protected void onEvent(Event event) {
- MemberTerminatedEvent memberTerminatedEvent = (MemberTerminatedEvent) event;
- getTerminatedMembers().put(memberTerminatedEvent.getMemberId(), System.currentTimeMillis());
- getActivateddMembers().remove(((MemberTerminatedEvent) event).getMemberId());
- getCreatedMembers().remove(((MemberTerminatedEvent) event).getMemberId());
- getInActiveMembers().remove(((MemberTerminatedEvent) event).getMemberId());
- getTerminatingMembers().remove(((MemberTerminatedEvent) event).getMemberId());
- }
- });
-
-
- topologyEventReceiver.addEventListener(new ClusterInstanceCreatedEventListener() {
- @Override
- protected void onEvent(Event event) {
- ClusterInstanceCreatedEvent event1 = (ClusterInstanceCreatedEvent) event;
- String clusterId = event1.getClusterId();
- getCreatedMembers().put(clusterId, System.currentTimeMillis());
- }
- });
-
- topologyEventReceiver.addEventListener(new ClusterInstanceActivatedEventListener() {
- @Override
- protected void onEvent(Event event) {
- ClusterInstanceActivatedEvent event1 = (ClusterInstanceActivatedEvent) event;
- String clusterId = event1.getClusterId();
- getActivateddMembers().put(clusterId, System.currentTimeMillis());
-
- }
- });
-
- topologyEventReceiver.addEventListener(new ClusterInstanceInactivateEventListener() {
- @Override
- protected void onEvent(Event event) {
- ClusterInstanceInactivateEvent event1 = (ClusterInstanceInactivateEvent) event;
- String clusterId = event1.getClusterId();
- getInActiveMembers().put(clusterId, System.currentTimeMillis());
- }
- });
-
- topologyEventReceiver.addEventListener(new ClusterInstanceTerminatedEventListener() {
- @Override
- protected void onEvent(Event event) {
- ClusterInstanceTerminatedEvent event1 = (ClusterInstanceTerminatedEvent) event;
- String clusterId = event1.getClusterId();
- getTerminatedMembers().put(clusterId, System.currentTimeMillis());
- }
- });
-
- topologyEventReceiver.addEventListener(new ClusterInstanceTerminatingEventListener() {
- @Override
- protected void onEvent(Event event) {
- ClusterInstanceTerminatingEvent event1 = (ClusterInstanceTerminatingEvent) event;
- String clusterId = event1.getClusterId();
- getTerminatingMembers().put(clusterId, System.currentTimeMillis());
- }
- });
-
-
- }
-
- private void addApplicationEventListeners() {
-
- applicationsEventReceiver.addEventListener(new GroupInstanceCreatedEventListener() {
- @Override
- protected void onEvent(Event event) {
- GroupInstanceCreatedEvent event1 = (GroupInstanceCreatedEvent) event;
- String appId = event1.getAppId();
- String groupId = event1.getGroupId();
- String instanceId = event1.getGroupInstance().getInstanceId();
- String id = generateId(appId, groupId, instanceId);
- getCreatedMembers().put(id, System.currentTimeMillis());
-
- }
- });
-
- applicationsEventReceiver.addEventListener(new GroupInstanceActivatedEventListener() {
- @Override
- protected void onEvent(Event event) {
- GroupInstanceActivatedEvent event1 = (GroupInstanceActivatedEvent) event;
- String appId = event1.getAppId();
- String groupId = event1.getGroupId();
- String instanceId = event1.getInstanceId();
- String id = generateId(appId, groupId, instanceId);
- getActivateddMembers().put(id, System.currentTimeMillis());
- }
- });
-
- applicationsEventReceiver.addEventListener(new GroupInstanceInactivateEventListener() {
- @Override
- protected void onEvent(Event event) {
- GroupInstanceInactivatedEvent event1 = (GroupInstanceInactivatedEvent) event;
- String appId = event1.getAppId();
- String groupId = event1.getGroupId();
- String instanceId = event1.getInstanceId();
- String id = generateId(appId, groupId, instanceId);
- getInActiveMembers().put(id, System.currentTimeMillis());
- }
- });
-
- applicationsEventReceiver.addEventListener(new GroupInstanceTerminatedEventListener() {
- @Override
- protected void onEvent(Event event) {
- GroupInstanceTerminatedEvent event1 = (GroupInstanceTerminatedEvent) event;
- String appId = event1.getAppId();
- String groupId = event1.getGroupId();
- String instanceId = event1.getInstanceId();
- String id = generateId(appId, groupId, instanceId);
- getTerminatedMembers().put(id, System.currentTimeMillis());
- }
- });
-
- applicationsEventReceiver.addEventListener(new GroupInstanceTerminatingEventListener() {
- @Override
- protected void onEvent(Event event) {
- GroupInstanceTerminatingEvent event1 = (GroupInstanceTerminatingEvent) event;
- String appId = event1.getAppId();
- String groupId = event1.getGroupId();
- String instanceId = event1.getInstanceId();
- String id = generateId(appId, groupId, instanceId);
- getTerminatingMembers().put(id, System.currentTimeMillis());
- }
- });
- }
-
- public String generateId(String appId, String groupId, String instanceId) {
- return appId + "-" + groupId + "-" + instanceId;
- }
-
- public String getClusterIdFromAlias(String applicationId, String alias) {
- Application application = ApplicationManager.getApplications().getApplication(applicationId);
- assertNotNull(application);
-
- ClusterDataHolder dataHolder = application.getClusterDataHolderRecursivelyByAlias(alias);
- assertNotNull(dataHolder);
-
- return dataHolder.getClusterId();
- }
-
-
- public void removeMembersFromMaps(String applicationId) {
- for (Map.Entry<String, Long> entry : getActivateddMembers().entrySet()) {
- if (entry.getKey().contains(applicationId)) {
- getActivateddMembers().remove(entry.getKey());
- }
- }
-
- for (Map.Entry<String, Long> entry : getTerminatedMembers().entrySet()) {
- if (entry.getKey().contains(applicationId)) {
- getTerminatedMembers().remove(entry.getKey());
- }
- }
- }
-
- public Map<String, Long> getTerminatedMembers() {
- return terminatedMembers;
- }
-
- public void setTerminatedMembers(Map<String, Long> terminatedMembers) {
- this.terminatedMembers = terminatedMembers;
- }
-
- public Map<String, Long> getTerminatingMembers() {
- return terminatingMembers;
- }
-
- public void setTerminatingMembers(Map<String, Long> terminatingMembers) {
- this.terminatingMembers = terminatingMembers;
- }
-
- public Map<String, Long> getCreatedMembers() {
- return createdMembers;
- }
-
- public void setCreatedMembers(Map<String, Long> createdMembers) {
- this.createdMembers = createdMembers;
- }
-
- public Map<String, Long> getInActiveMembers() {
- return inActiveMembers;
- }
-
- public void setInActiveMembers(Map<String, Long> inActiveMembers) {
- this.inActiveMembers = inActiveMembers;
- }
-
- public Map<String, Long> getActivateddMembers() {
- return activateddMembers;
- }
-
- public void setActivateddMembers(Map<String, Long> activateddMembers) {
- this.activateddMembers = activateddMembers;
- }
-}
\ No newline at end of file