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/10/11 22:28:00 UTC
[5/5] stratos git commit: Rename startup test case artifacts
Rename startup test case artifacts
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/6781d75c
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/6781d75c
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/6781d75c
Branch: refs/heads/stratos-4.1.x
Commit: 6781d75cf2e509217268cd030b8578427a90b41d
Parents: 8d46fab
Author: Akila Perera <ra...@gmail.com>
Authored: Mon Oct 12 01:57:27 2015 +0530
Committer: Akila Perera <ra...@gmail.com>
Committed: Mon Oct 12 01:57:27 2015 +0530
----------------------------------------------------------------------
.../autoscaler/pojo/policy/PolicyManager.java | 2 +-
.../autoscaler/registry/RegistryManager.java | 92 ++++---
.../services/impl/AutoscalerServiceImpl.java | 252 +++++++++----------
.../SampleApplicationStartupTestCase.java | 153 +++++------
.../src/test/resources/common/log4j.properties | 1 +
...-policy-sample-application-startup-test.json | 17 ++
...ication-policy-sample-applications-test.json | 17 --
.../sample-application-startup-test.json | 24 ++
.../sample-applications-test-1.json | 24 --
...-policy-sample-application-startup-test.json | 14 ++
...scaling-policy-sample-applications-test.json | 14 --
.../c1-sample-application-startup-test.json | 45 ++++
.../mock/c1-sample-applications-test.json | 45 ----
...-policy-sample-application-startup-test.json | 18 ++
...loyment-policy-sample-applications-test.json | 18 --
...rtition-sample-application-startup-test.json | 15 ++
...rk-partition-sample-applications-test-1.json | 15 --
17 files changed, 387 insertions(+), 379 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/PolicyManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/PolicyManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/PolicyManager.java
index 3336776..44288a5 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/PolicyManager.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/pojo/policy/PolicyManager.java
@@ -243,7 +243,7 @@ public class PolicyManager {
public void undeployAutoscalePolicy(String policyId) throws InvalidPolicyException {
if (autoscalePolicyListMap.containsKey(policyId)) {
if (log.isDebugEnabled()) {
- log.debug("Removing policy :" + policyId);
+ log.debug("Removing policy:" + policyId);
}
autoscalePolicyListMap.remove(policyId);
RegistryManager.getInstance().removeAutoscalerPolicy(policyId);
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
index 09a47a2..925c4ff 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
@@ -159,7 +159,8 @@ public class RegistryManager {
}
public void persistDeploymentPolicy(DeploymentPolicy deploymentPolicy) {
- String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.DEPLOYMENT_POLICY_RESOURCE + "/" + deploymentPolicy.getDeploymentPolicyID();
+ String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.DEPLOYMENT_POLICY_RESOURCE
+ + "/" + deploymentPolicy.getDeploymentPolicyID();
persist(deploymentPolicy, resourcePath);
if (log.isDebugEnabled()) {
log.debug(String.format("Deployment policy written to registry: %s", deploymentPolicy.toString()));
@@ -203,8 +204,7 @@ public class RegistryManager {
public String[] getApplicationResourcePaths() {
try {
startTenantFlow();
- Object obj = retrieve(AutoscalerConstants.AUTOSCALER_RESOURCE +
- AutoscalerConstants.APPLICATIONS_RESOURCE);
+ Object obj = retrieve(AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.APPLICATIONS_RESOURCE);
if (obj != null) {
if (obj instanceof String[]) {
@@ -275,8 +275,8 @@ public class RegistryManager {
public String[] getApplicationContextResourcePaths() {
try {
startTenantFlow();
- Object obj = retrieve(AutoscalerConstants.AUTOSCALER_RESOURCE +
- AutoscalerConstants.APPLICATION_CONTEXTS_RESOURCE);
+ Object obj = retrieve(
+ AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.APPLICATION_CONTEXTS_RESOURCE);
if (obj != null) {
if (obj instanceof String[]) {
@@ -336,25 +336,27 @@ public class RegistryManager {
if (servicegroup == null || StringUtils.isEmpty(servicegroup.getName())) {
throw new IllegalArgumentException("Cartridge group or group name can not be null");
}
- String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.SERVICE_GROUP + "/" + servicegroup.getName();
+ String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.SERVICE_GROUP + "/"
+ + servicegroup.getName();
persist(servicegroup, resourcePath);
if (log.isDebugEnabled()) {
- log.debug(String.format("Persisted cartridge group %s at path %s", servicegroup.getName(), resourcePath));
+ log.debug(
+ String.format("Persisted cartridge group %s at path %s", servicegroup.getName(), resourcePath));
}
} finally {
endTenantFlow();
}
}
-
public void updateServiceGroup(ServiceGroup serviceGroup) throws InvalidServiceGroupException, RegistryException {
try {
if (serviceGroup == null || StringUtils.isEmpty(serviceGroup.getName())) {
throw new IllegalArgumentException("Cartridge group or group name cannot be null");
}
if (getServiceGroup(serviceGroup.getName()) == null) {
- throw new InvalidServiceGroupException(String.format("Cartridge group does not exist: " +
- "[cartridge-group] %s", serviceGroup.getName()));
+ throw new InvalidServiceGroupException(
+ String.format("Cartridge group does not exist: " + "[cartridge-group] %s",
+ serviceGroup.getName()));
}
persistServiceGroup(serviceGroup);
@@ -363,15 +365,16 @@ public class RegistryManager {
log.debug(String.format("Updated cartridge group: [group-name] %s", serviceGroup.getName()));
}
} catch (Exception e) {
- String message = (String.format("Unable to update cartridge group [group-name] %s",
- serviceGroup.getName()));
+ String message = (String
+ .format("Unable to update cartridge group [group-name] %s", serviceGroup.getName()));
log.error(message, e);
throw new RegistryException(message, e);
}
}
public boolean serviceGroupExist(String serviceGroupName) {
- String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.SERVICE_GROUP + "/" + serviceGroupName;
+ String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.SERVICE_GROUP + "/"
+ + serviceGroupName;
return resourceExist(resourcePath);
}
@@ -384,7 +387,8 @@ public class RegistryManager {
try {
startTenantFlow();
List<AutoscalePolicy> asPolicyList = new ArrayList<AutoscalePolicy>();
- String[] partitionsResourceList = (String[]) retrieve(AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.AS_POLICY_RESOURCE);
+ String[] partitionsResourceList = (String[]) retrieve(
+ AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.AS_POLICY_RESOURCE);
if (partitionsResourceList != null) {
AutoscalePolicy asPolicy;
@@ -396,7 +400,8 @@ public class RegistryManager {
if (dataObj instanceof AutoscalePolicy) {
asPolicy = (AutoscalePolicy) dataObj;
if (log.isDebugEnabled()) {
- log.debug(String.format("Autoscaler policy read from registry: [id] %s [name] %s [description] %s",
+ log.debug(String.format(
+ "Autoscaler policy read from registry: [id] %s [name] %s [description] %s",
asPolicy.getId(), asPolicy.getDisplayName(), asPolicy.getDescription()));
}
asPolicyList.add(asPolicy);
@@ -404,8 +409,7 @@ public class RegistryManager {
return null;
}
} catch (Exception e) {
- String msg = "Unable to retrieve resource from registry: [resource-path] "
- + resourcePath;
+ String msg = "Unable to retrieve resource from registry: [resource-path] " + resourcePath;
log.warn(msg, e);
}
}
@@ -427,8 +431,8 @@ public class RegistryManager {
startTenantFlow();
List<DeploymentPolicy> depPolicyList = new ArrayList<DeploymentPolicy>();
RegistryManager registryManager = RegistryManager.getInstance();
- String[] depPolicyResourceList = (String[]) registryManager.retrieve(AutoscalerConstants.AUTOSCALER_RESOURCE
- + AutoscalerConstants.DEPLOYMENT_POLICY_RESOURCE);
+ String[] depPolicyResourceList = (String[]) registryManager
+ .retrieve(AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.DEPLOYMENT_POLICY_RESOURCE);
if (depPolicyResourceList != null) {
DeploymentPolicy depPolicy;
@@ -447,7 +451,9 @@ public class RegistryManager {
return null;
}
} catch (Exception e) {
- String msg = "Unable to retrieve data from Registry. Hence, any historical deployment policies will not get reflected.";
+ String msg
+ = "Unable to retrieve data from Registry. Hence, any historical deployment "
+ + "policies will not get reflected.";
log.warn(msg, e);
}
}
@@ -484,8 +490,7 @@ public class RegistryManager {
return null;
}
} catch (Exception e) {
- String msg = "Unable to retrieve resource from registry: [resource-path] "
- + resourcePath;
+ String msg = "Unable to retrieve resource from registry: [resource-path] " + resourcePath;
log.warn(msg, e);
}
}
@@ -500,7 +505,8 @@ public class RegistryManager {
public List<NetworkPartitionAlgorithmContext> retrieveNetworkPartitionAlgorithmContexts() {
try {
startTenantFlow();
- List<NetworkPartitionAlgorithmContext> algorithmContexts = new ArrayList<NetworkPartitionAlgorithmContext>();
+ List<NetworkPartitionAlgorithmContext> algorithmContexts
+ = new ArrayList<NetworkPartitionAlgorithmContext>();
String[] networkPartitionAlgoCtxtResourceList = (String[]) retrieve(
AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.NETWORK_PARTITION_ALGO_CTX_RESOURCE);
@@ -514,15 +520,15 @@ public class RegistryManager {
if (dataObj instanceof NetworkPartitionAlgorithmContext) {
algorithmContext = (NetworkPartitionAlgorithmContext) dataObj;
if (log.isDebugEnabled()) {
- log.debug(String.format("Network partition algorithm context read from registry %s", algorithmContext.toString()));
+ log.debug(String.format("Network partition algorithm context read from registry %s",
+ algorithmContext.toString()));
}
algorithmContexts.add(algorithmContext);
} else {
return null;
}
} catch (Exception e) {
- String msg = "Unable to retrieve resource from registry: [resource-path] "
- + resourcePath;
+ String msg = "Unable to retrieve resource from registry: [resource-path] " + resourcePath;
log.warn(msg, e);
}
}
@@ -537,7 +543,8 @@ public class RegistryManager {
public ServiceGroup getServiceGroup(String name) throws Exception {
try {
startTenantFlow();
- String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.SERVICE_GROUP + "/" + name;
+ String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.SERVICE_GROUP + "/"
+ + name;
Object serializedObj = instance.retrieve(resourcePath);
ServiceGroup group = null;
if (serializedObj != null) {
@@ -585,9 +592,11 @@ public class RegistryManager {
serviceGroupList.add(serviceGroup);
}
} catch (IOException e) {
- throw new AutoScalerException("Error occurred while retrieving cartridge group from registry");
+ throw new AutoScalerException(
+ "Error occurred while retrieving cartridge group from registry");
} catch (ClassNotFoundException e) {
- throw new AutoScalerException("Error occurred while retrieving cartridge group from registry");
+ throw new AutoScalerException(
+ "Error occurred while retrieving cartridge group from registry");
}
}
}
@@ -626,11 +635,11 @@ public class RegistryManager {
public void removeAutoscalerPolicy(String policyID) {
try {
startTenantFlow();
- String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.AS_POLICY_RESOURCE + "/" +
- policyID;
+ String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.AS_POLICY_RESOURCE + "/"
+ + policyID;
delete(resourcePath);
if (log.isDebugEnabled()) {
- log.debug(String.format("Autoscaler policy deleted from registry: [id]", policyID));
+ log.debug(String.format("Autoscaling policy deleted from registry: [id] %s", policyID));
}
} finally {
endTenantFlow();
@@ -638,23 +647,25 @@ public class RegistryManager {
}
public void removeDeploymentPolicy(String deploymentPolicyID) {
- String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.DEPLOYMENT_POLICY_RESOURCE + "/" +
+ String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.DEPLOYMENT_POLICY_RESOURCE
+ + "/" +
deploymentPolicyID;
this.delete(resourcePath);
if (log.isDebugEnabled()) {
- log.debug(String.format("Deployment policy deleted from registry: [id] %s",
- deploymentPolicyID));
+ log.debug(String.format("Deployment policy deleted from registry: [id] %s", deploymentPolicyID));
}
}
public void removeApplicationPolicy(String applicationPolicyId) {
try {
startTenantFlow();
- String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.APPLICATION_POLICY_RESOURCE + "/" +
+ String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE
+ + AutoscalerConstants.APPLICATION_POLICY_RESOURCE + "/" +
applicationPolicyId;
delete(resourcePath);
if (log.isDebugEnabled()) {
- log.debug(String.format("Application policy deleted from registry [application-policy-id] %s", applicationPolicyId));
+ log.debug(String.format("Application policy deleted from registry [application-policy-id] %s",
+ applicationPolicyId));
}
} finally {
endTenantFlow();
@@ -664,11 +675,14 @@ public class RegistryManager {
public void removeNetworkPartitionAlgorithmContext(String applicationPolicyId) {
try {
startTenantFlow();
- String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + AutoscalerConstants.NETWORK_PARTITION_ALGO_CTX_RESOURCE + "/" +
+ String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE
+ + AutoscalerConstants.NETWORK_PARTITION_ALGO_CTX_RESOURCE + "/" +
applicationPolicyId;
delete(resourcePath);
if (log.isDebugEnabled()) {
- log.debug(String.format("Network partition algorithm context deleted from registry [application-policy-id] %s", applicationPolicyId));
+ log.debug(String.format(
+ "Network partition algorithm context deleted from registry [application-policy-id] %s",
+ applicationPolicyId));
}
} finally {
endTenantFlow();
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
index 605367f..e6a97a9 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java
@@ -93,8 +93,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
@Override
- public boolean addAutoScalingPolicy(AutoscalePolicy autoscalePolicy)
- throws AutoScalingPolicyAlreadyExistException {
+ public boolean addAutoScalingPolicy(AutoscalePolicy autoscalePolicy) throws AutoScalingPolicyAlreadyExistException {
return PolicyManager.getInstance().addAutoscalePolicy(autoscalePolicy);
}
@@ -104,14 +103,13 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
@Override
- public boolean removeAutoScalingPolicy(String autoscalePolicyId) throws UnremovablePolicyException,
- PolicyDoesNotExistException {
+ public boolean removeAutoScalingPolicy(String autoscalePolicyId)
+ throws UnremovablePolicyException, PolicyDoesNotExistException {
if (AutoscalerUtil.removableAutoScalerPolicy(autoscalePolicyId)) {
return PolicyManager.getInstance().removeAutoscalePolicy(autoscalePolicyId);
} else {
- throw new UnremovablePolicyException("This autoscaler policy cannot be removed, " +
- "since it is used in " +
- "applications.");
+ throw new UnremovablePolicyException(
+ "This autoscaler policy cannot be removed, since it is used in applications.");
}
}
@@ -122,12 +120,10 @@ public class AutoscalerServiceImpl implements AutoscalerService {
@Override
public boolean addApplication(ApplicationContext applicationContext)
- throws ApplicationDefinitionException, CartridgeGroupNotFoundException,
- CartridgeNotFoundException {
+ throws ApplicationDefinitionException, CartridgeGroupNotFoundException, CartridgeNotFoundException {
if (log.isInfoEnabled()) {
- log.info(String.format("Adding application: [application-id] %s",
- applicationContext.getApplicationId()));
+ log.info(String.format("Adding application: [application-id] %s", applicationContext.getApplicationId()));
}
ApplicationParser applicationParser = new DefaultApplicationParser();
@@ -135,8 +131,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
ApplicationHolder.persistApplication(application);
List<ApplicationClusterContext> applicationClusterContexts = applicationParser.getApplicationClusterContexts();
- ApplicationClusterContext[] applicationClusterContextsArray = applicationClusterContexts.toArray(
- new ApplicationClusterContext[applicationClusterContexts.size()]);
+ ApplicationClusterContext[] applicationClusterContextsArray = applicationClusterContexts
+ .toArray(new ApplicationClusterContext[applicationClusterContexts.size()]);
applicationContext.getComponents().setApplicationClusterContexts(applicationClusterContextsArray);
applicationContext.setStatus(ApplicationContext.STATUS_CREATED);
@@ -154,13 +150,11 @@ public class AutoscalerServiceImpl implements AutoscalerService {
@Override
public boolean updateApplication(ApplicationContext applicationContext)
- throws ApplicationDefinitionException, CartridgeGroupNotFoundException,
- CartridgeNotFoundException {
+ throws ApplicationDefinitionException, CartridgeGroupNotFoundException, CartridgeNotFoundException {
String applicationId = applicationContext.getApplicationId();
if (log.isInfoEnabled()) {
- log.info(String.format("Updating application: [application-id] %s",
- applicationContext.getApplicationId()));
+ log.info(String.format("Updating application: [application-id] %s", applicationContext.getApplicationId()));
}
if (AutoscalerContext.getInstance().getApplicationContext(applicationId) == null) {
@@ -196,8 +190,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
applicationContext.setStatus(existingApplicationContext.getStatus());
List<ApplicationClusterContext> applicationClusterContexts = applicationParser.getApplicationClusterContexts();
- ApplicationClusterContext[] applicationClusterContextsArray = applicationClusterContexts.toArray(
- new ApplicationClusterContext[applicationClusterContexts.size()]);
+ ApplicationClusterContext[] applicationClusterContextsArray = applicationClusterContexts
+ .toArray(new ApplicationClusterContext[applicationClusterContexts.size()]);
applicationContext.getComponents().setApplicationClusterContexts(applicationClusterContextsArray);
//updating the applicationContext
@@ -207,8 +201,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
ApplicationsEventPublisher.sendApplicationUpdated(application);
if (log.isInfoEnabled()) {
- log.info(String.format("Application updated successfully: [application-id] %s",
- applicationId));
+ log.info(String.format("Application updated successfully: [application-id] %s", applicationId));
}
return true;
}
@@ -259,14 +252,13 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
// adding network partition algorithm context to registry
- NetworkPartitionAlgorithmContext algorithmContext =
- new NetworkPartitionAlgorithmContext(applicationId, applicationPolicyId, 0);
+ NetworkPartitionAlgorithmContext algorithmContext = new NetworkPartitionAlgorithmContext(applicationId,
+ applicationPolicyId, 0);
AutoscalerContext.getInstance().addNetworkPartitionAlgorithmContext(algorithmContext);
if (!applicationContext.isMultiTenant()) {
// Add application signup for single tenant applications
- addApplicationSignUp(applicationContext, application.getKey(),
- findApplicationClusterIds(application));
+ addApplicationSignUp(applicationContext, application.getKey(), findApplicationClusterIds(application));
}
applicationContext.setStatus(ApplicationContext.STATUS_DEPLOYED);
AutoscalerContext.getInstance().updateApplicationContext(applicationContext);
@@ -275,8 +267,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
ApplicationBuilder.handleApplicationDeployment(application,
applicationContext.getComponents().getApplicationClusterContexts());
- log.info("Waiting for application clusters to be created: [application-id] " +
- applicationId);
+ log.info("Waiting for application clusters to be created: [application-id] " + applicationId);
return true;
} catch (Exception e) {
@@ -315,7 +306,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
* @param clusterIds
*/
private void addApplicationSignUp(ApplicationContext applicationContext, String applicationKey,
- List<String> clusterIds) {
+ List<String> clusterIds) {
try {
if (log.isInfoEnabled()) {
@@ -345,8 +336,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
}
- ArtifactRepository[] artifactRepositoryArray = artifactRepositoryList.toArray(
- new ArtifactRepository[artifactRepositoryList.size()]);
+ ArtifactRepository[] artifactRepositoryArray = artifactRepositoryList
+ .toArray(new ArtifactRepository[artifactRepositoryList.size()]);
applicationSignUp.setArtifactRepositories(artifactRepositoryArray);
// Encrypt artifact repository passwords
@@ -361,14 +352,13 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
}
} catch (Exception e) {
- String message =
- "Could not add application signup: [application-id]" + applicationContext.getApplicationId();
+ String message = "Could not add application signup: [application-id]" + applicationContext
+ .getApplicationId();
log.error(message, e);
throw new RuntimeException(message, e);
}
}
-
private CartridgeContext[] getCartridgeContextsOfGroupsRecursively(GroupContext[] passedGroupContexts) {
List<CartridgeContext> cartridgeContextsList = new ArrayList<CartridgeContext>();
@@ -381,8 +371,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
}
if (groupContext.getGroupContexts() != null) {
- for (CartridgeContext cartridgeContext :
- getCartridgeContextsOfGroupsRecursively(groupContext.getGroupContexts())) {
+ for (CartridgeContext cartridgeContext : getCartridgeContextsOfGroupsRecursively(
+ groupContext.getGroupContexts())) {
cartridgeContextsList.add(cartridgeContext);
}
@@ -400,8 +390,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
StratosManagerServiceClient serviceClient = StratosManagerServiceClient.getInstance();
- ApplicationSignUp applicationSignUp[] =
- serviceClient.getApplicationSignUps(applicationContext.getApplicationId());
+ ApplicationSignUp applicationSignUp[] = serviceClient
+ .getApplicationSignUps(applicationContext.getApplicationId());
if (applicationSignUp != null) {
for (ApplicationSignUp appSignUp : applicationSignUp) {
if (appSignUp != null) {
@@ -428,13 +418,12 @@ public class AutoscalerServiceImpl implements AutoscalerService {
for (ArtifactRepository artifactRepository : applicationSignUp.getArtifactRepositories()) {
String repoPassword = artifactRepository.getRepoPassword();
if ((artifactRepository != null) && (StringUtils.isNotBlank(repoPassword))) {
- String encryptedRepoPassword = CommonUtil.encryptPassword(repoPassword,
- applicationKey);
+ String encryptedRepoPassword = CommonUtil.encryptPassword(repoPassword, applicationKey);
artifactRepository.setRepoPassword(encryptedRepoPassword);
if (log.isDebugEnabled()) {
- log.debug(String.format("Artifact repository password encrypted: [application-id] %s " +
- "[tenant-id] %d [repo-url] %s", applicationSignUp.getApplicationId(),
+ log.debug(String.format("Artifact repository password encrypted: [application-id] %s "
+ + "[tenant-id] %d [repo-url] %s", applicationSignUp.getApplicationId(),
applicationSignUp.getTenantId(), artifactRepository.getRepoUrl()));
}
}
@@ -443,7 +432,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
private void updateArtifactRepositoryList(List<ArtifactRepository> artifactRepositoryList,
- CartridgeContext[] cartridgeContexts) {
+ CartridgeContext[] cartridgeContexts) {
if (cartridgeContexts == null) {
return;
@@ -451,8 +440,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
for (CartridgeContext cartridgeContext : cartridgeContexts) {
SubscribableInfoContext subscribableInfoContext = cartridgeContext.getSubscribableInfoContext();
- ArtifactRepositoryContext artifactRepositoryContext =
- subscribableInfoContext.getArtifactRepositoryContext();
+ ArtifactRepositoryContext artifactRepositoryContext = subscribableInfoContext
+ .getArtifactRepositoryContext();
if (artifactRepositoryContext != null) {
ArtifactRepository artifactRepository = new ArtifactRepository();
@@ -468,15 +457,16 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
}
- public boolean undeployApplication(String applicationId, boolean force) throws RemoteException,
- StratosManagerServiceApplicationSignUpExceptionException, UnremovableApplicationException {
+ public boolean undeployApplication(String applicationId, boolean force)
+ throws RemoteException, StratosManagerServiceApplicationSignUpExceptionException,
+ UnremovableApplicationException {
AutoscalerContext asCtx = AutoscalerContext.getInstance();
ApplicationMonitor appMonitor = asCtx.getAppMonitor(applicationId);
if (appMonitor == null) {
- log.info(String.format("Could not find application monitor for the application %s, " +
- "hence returning", applicationId));
+ log.info(String.format("Could not find application monitor for the application %s, " + "hence returning",
+ applicationId));
return false;
}
@@ -496,8 +486,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
if (!force) {
// Graceful un-deployment flow
if (appMonitor.isTerminating()) {
- log.info("Application monitor is already in terminating, graceful " +
- "un-deployment is has already been attempted thus not invoking again");
+ log.info("Application monitor is already in terminating, graceful "
+ + "un-deployment is has already been attempted thus not invoking again");
return false;
} else {
log.info(String.format("Gracefully un-deploying the [application] %s ", applicationId));
@@ -514,9 +504,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
"[application-id] %s", applicationId));
return false;
} else {
- log.info(String.format("Previous graceful un-deployment is in progress for " +
- "[application-id] %s , thus terminating instances directly",
- applicationId));
+ log.info(String.format("Previous graceful un-deployment is in progress for "
+ + "[application-id] %s , thus terminating instances directly", applicationId));
appMonitor.setForce(true);
terminateAllMembersAndClustersForcefully(applicationId);
}
@@ -573,8 +562,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
@Override
public boolean deleteApplication(String applicationId) {
try {
- ApplicationContext applicationContext =
- AutoscalerContext.getInstance().getApplicationContext(applicationId);
+ ApplicationContext applicationContext = AutoscalerContext.getInstance()
+ .getApplicationContext(applicationId);
Application application = ApplicationHolder.getApplications().getApplication(applicationId);
if ((applicationContext == null) || (application == null)) {
String msg = String.format("Application cannot be deleted, application not found: [application-id] %s",
@@ -582,16 +571,15 @@ public class AutoscalerServiceImpl implements AutoscalerService {
throw new RuntimeException(msg);
}
-
if (ApplicationContext.STATUS_DEPLOYED.equals(applicationContext.getStatus())) {
- String msg = String.format("Application is in deployed state, please undeploy it before deleting: " +
- "[application-id] %s", applicationId);
+ String msg = String.format("Application is in deployed state, please undeploy it before deleting: "
+ + "[application-id] %s", applicationId);
throw new AutoScalerException(msg);
}
if (application.getInstanceContextCount() > 0) {
- String message = String.format("Application cannot be deleted, undeployment process is still in " +
- "progress: [application-id] %s", applicationId);
+ String message = String.format("Application cannot be deleted, undeployment process is still in "
+ + "progress: [application-id] %s", applicationId);
log.error(message);
throw new RuntimeException(message);
}
@@ -707,8 +695,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
String groupName = cartridgeGroup.getName();
if (!RegistryManager.getInstance().serviceGroupExist(groupName)) {
- throw new InvalidServiceGroupException(String.format("Cartridge group does not exist: [cartridge-group] %s",
- cartridgeGroup.getName()));
+ throw new InvalidServiceGroupException(
+ String.format("Cartridge group does not exist: [cartridge-group] %s", cartridgeGroup.getName()));
}
Dependencies dependencies = cartridgeGroup.getDependencies();
@@ -743,12 +731,11 @@ public class AutoscalerServiceImpl implements AutoscalerService {
try {
RegistryManager.getInstance().updateServiceGroup(cartridgeGroup);
} catch (org.wso2.carbon.registry.core.exceptions.RegistryException e) {
- String message = (String.format("Cannot update cartridge group: [group-name] %s",
- cartridgeGroup.getName()));
+ String message = (String
+ .format("Cannot update cartridge group: [group-name] %s", cartridgeGroup.getName()));
throw new RuntimeException(message, e);
}
-
if (log.isInfoEnabled()) {
log.info(String.format("Cartridge group successfully updated: [group-name] %s", cartridgeGroup.getName()));
}
@@ -806,8 +793,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
return null;
} catch (Exception e) {
- String message = String.format("Could not find cluster id: [application-id] %s [alias] %s",
- applicationId, alias);
+ String message = String
+ .format("Could not find cluster id: [application-id] %s [alias] %s", applicationId, alias);
throw new AutoScalerException(message, e);
} finally {
ApplicationHolder.releaseReadLock();
@@ -832,8 +819,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
@Override
- public String[] getApplicationNetworkPartitions(String applicationId)
- throws AutoScalerException {
+ public String[] getApplicationNetworkPartitions(String applicationId) throws AutoScalerException {
List<String> networkPartitionIds = AutoscalerUtil.getNetworkPartitionIdsReferedInApplication(applicationId);
if (networkPartitionIds == null) {
return null;
@@ -879,8 +865,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
if (removableApplicationPolicy(applicationPolicyId)) {
return PolicyManager.getInstance().removeApplicationPolicy(applicationPolicyId);
} else {
- throw new UnremovablePolicyException("This application policy cannot be removed, since it is used in " +
- "applications.");
+ throw new UnremovablePolicyException(
+ "This application policy cannot be removed, since it is used in " + "applications.");
}
}
@@ -905,11 +891,11 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
String applicationPolicyId = applicationPolicy.getId();
- ApplicationPolicy existingApplicationPolicy =
- PolicyManager.getInstance().getApplicationPolicy(applicationPolicyId);
+ ApplicationPolicy existingApplicationPolicy = PolicyManager.getInstance()
+ .getApplicationPolicy(applicationPolicyId);
if (existingApplicationPolicy == null) {
- String msg =
- String.format("No such application policy found [application-policy-id] %s", applicationPolicyId);
+ String msg = String
+ .format("No such application policy found [application-policy-id] %s", applicationPolicyId);
log.error(msg);
throw new ApplicatioinPolicyNotExistsException(msg);
}
@@ -937,8 +923,9 @@ public class AutoscalerServiceImpl implements AutoscalerService {
try {
application = ApplicationHolder.getApplications().getApplication(applicationId);
if (application == null) {
- log.warn(String.format("Could not find application, thus no members to be terminated " +
- "[application-id] %s", applicationId));
+ log.warn(String.format(
+ "Could not find application, thus no members to be terminated " + "[application-id] %s",
+ applicationId));
return;
}
} finally {
@@ -954,13 +941,12 @@ public class AutoscalerServiceImpl implements AutoscalerService {
if (applicationMonitor.hasInstance()) {
Map<String, Monitor> monitors = applicationMonitor.
getAliasToActiveChildMonitorsMap();
- AutoscalerUtil.handleForceTermination(monitors.values(),
- applicationMonitor, applicationId);
+ AutoscalerUtil.handleForceTermination(monitors.values(), applicationMonitor, applicationId);
Collection<Instance> applicationInstances = applicationMonitor.getInstances();
for (Instance instance : applicationInstances) {
- ApplicationBuilder.handleApplicationInstanceTerminatedEvent(applicationId,
- instance.getInstanceId());
+ ApplicationBuilder
+ .handleApplicationInstanceTerminatedEvent(applicationId, instance.getInstanceId());
}
Set<ClusterDataHolder> allClusters = application.getClusterDataRecursively();
@@ -984,8 +970,9 @@ public class AutoscalerServiceImpl implements AutoscalerService {
clusterMonitor.destroy();
} else {
if (log.isDebugEnabled()) {
- log.debug(String.format("Cluster monitor cannot be found for [application] %s " +
- "[cluster] %s", applicationId, clusterId));
+ log.debug(String.format(
+ "Cluster monitor cannot be found for [application] %s " + "[cluster] %s",
+ applicationId, clusterId));
}
}
if (cluster != null) {
@@ -1003,13 +990,14 @@ public class AutoscalerServiceImpl implements AutoscalerService {
for (String memberIdToTerminate : memberListToTerminate) {
try {
log.info(String.format(
- "Terminating member forcefully [member-id] %s of the cluster [cluster-id] %s " +
- "[application-id] %s", memberIdToTerminate, clusterId, application));
- AutoscalerCloudControllerClient.getInstance().terminateInstanceForcefully(memberIdToTerminate);
+ "Terminating member forcefully [member-id] %s of the cluster [cluster-id] %s "
+ + "[application-id] %s", memberIdToTerminate, clusterId, application));
+ AutoscalerCloudControllerClient.getInstance()
+ .terminateInstanceForcefully(memberIdToTerminate);
} catch (Exception e) {
- log.error(
- String.format("Forceful termination of member %s has failed, but continuing forceful " +
- "deletion of other members", memberIdToTerminate));
+ log.error(String.format(
+ "Forceful termination of member %s has failed, but continuing forceful "
+ + "deletion of other members", memberIdToTerminate));
}
}
}
@@ -1033,16 +1021,11 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
}
-
-
-
-
}
-
@Override
- public boolean addDeployementPolicy(DeploymentPolicy deploymentPolicy) throws RemoteException,
- InvalidDeploymentPolicyException, DeploymentPolicyAlreadyExistsException {
+ public boolean addDeployementPolicy(DeploymentPolicy deploymentPolicy)
+ throws RemoteException, InvalidDeploymentPolicyException, DeploymentPolicyAlreadyExistsException {
validateDeploymentPolicy(deploymentPolicy);
@@ -1068,8 +1051,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
return true;
}
- private void validateDeploymentPolicy(DeploymentPolicy deploymentPolicy) throws
- InvalidDeploymentPolicyException, RemoteException {
+ private void validateDeploymentPolicy(DeploymentPolicy deploymentPolicy)
+ throws InvalidDeploymentPolicyException, RemoteException {
// deployment policy can't be null
if (null == deploymentPolicy) {
@@ -1091,10 +1074,10 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
// deployment policy should contain at least one network partition reference
- if (null == deploymentPolicy.getNetworkPartitionRefs() ||
- deploymentPolicy.getNetworkPartitionRefs().length == 0) {
- String msg = String.format("Deployment policy does not have any network partition references: " +
- "[deployment-policy-id] %s", deploymentPolicyId);
+ if (null == deploymentPolicy.getNetworkPartitionRefs()
+ || deploymentPolicy.getNetworkPartitionRefs().length == 0) {
+ String msg = String.format("Deployment policy does not have any network partition references: "
+ + "[deployment-policy-id] %s", deploymentPolicyId);
log.error(msg);
throw new InvalidDeploymentPolicyException(msg);
}
@@ -1104,8 +1087,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
// network partition id can't be null or empty
String networkPartitionId = networkPartitionRef.getId();
if (StringUtils.isBlank(networkPartitionId)) {
- String msg = String.format("Network partition id is blank: [deployment-policy-id] %s",
- deploymentPolicyId);
+ String msg = String
+ .format("Network partition id is blank: [deployment-policy-id] %s", deploymentPolicyId);
log.error(msg);
throw new InvalidDeploymentPolicyException(msg);
}
@@ -1114,8 +1097,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
NetworkPartition networkPartition = CloudControllerServiceClient.getInstance()
.getNetworkPartition(networkPartitionId);
if (networkPartition == null) {
- String msg = String.format("Network partition is not found: [deployment-policy-id] %s " +
- "[network-partition-id] %s", deploymentPolicyId, networkPartitionId);
+ String msg = String.format("Network partition is not found: [deployment-policy-id] %s "
+ + "[network-partition-id] %s", deploymentPolicyId, networkPartitionId);
log.error(msg);
throw new InvalidDeploymentPolicyException(msg);
}
@@ -1131,9 +1114,9 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
}
if (isPartitionFound == false) {
- String msg = String.format("Partition Id is not found: [deployment-policy-id] %s " +
- "[network-partition-id] %s [partition-id] %s",
- deploymentPolicyId, networkPartitionId, partitionId);
+ String msg = String.format("Partition Id is not found: [deployment-policy-id] %s "
+ + "[network-partition-id] %s [partition-id] %s", deploymentPolicyId,
+ networkPartitionId, partitionId);
log.error(msg);
throw new InvalidDeploymentPolicyException(msg);
}
@@ -1142,9 +1125,9 @@ public class AutoscalerServiceImpl implements AutoscalerService {
// partition algorithm can't be null or empty
String partitionAlgorithm = networkPartitionRef.getPartitionAlgo();
if (StringUtils.isBlank(partitionAlgorithm)) {
- String msg = String.format("Partition algorithm is blank: [deployment-policy-id] %s " +
- "[network-partition-id] %s [partition-algorithm] %s",
- deploymentPolicyId, networkPartitionId, partitionAlgorithm);
+ String msg = String.format("Partition algorithm is blank: [deployment-policy-id] %s "
+ + "[network-partition-id] %s [partition-algorithm] %s", deploymentPolicyId,
+ networkPartitionId, partitionAlgorithm);
log.error(msg);
throw new InvalidDeploymentPolicyException(msg);
}
@@ -1173,9 +1156,9 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
@Override
- public boolean updateDeploymentPolicy(DeploymentPolicy deploymentPolicy) throws RemoteException,
- InvalidDeploymentPolicyException, DeploymentPolicyNotExistsException, InvalidPolicyException,
- CloudControllerConnectionException {
+ public boolean updateDeploymentPolicy(DeploymentPolicy deploymentPolicy)
+ throws RemoteException, InvalidDeploymentPolicyException, DeploymentPolicyNotExistsException,
+ InvalidPolicyException, CloudControllerConnectionException {
validateDeploymentPolicy(deploymentPolicy);
@@ -1203,15 +1186,15 @@ public class AutoscalerServiceImpl implements AutoscalerService {
return true;
}
- private void updateClusterMonitors(DeploymentPolicy deploymentPolicy) throws InvalidDeploymentPolicyException,
- CloudControllerConnectionException {
+ private void updateClusterMonitors(DeploymentPolicy deploymentPolicy)
+ throws InvalidDeploymentPolicyException, CloudControllerConnectionException {
for (ClusterMonitor clusterMonitor : AutoscalerContext.getInstance().getClusterMonitors().values()) {
//Following if statement checks the relevant clusters for the updated deployment policy
if (deploymentPolicy.getDeploymentPolicyID().equals(clusterMonitor.getDeploymentPolicyId())) {
for (NetworkPartitionRef networkPartition : deploymentPolicy.getNetworkPartitionRefs()) {
- NetworkPartitionContext clusterLevelNetworkPartitionContext
- = clusterMonitor.getClusterContext().getNetworkPartitionCtxt(networkPartition.getId());
+ NetworkPartitionContext clusterLevelNetworkPartitionContext = clusterMonitor.getClusterContext()
+ .getNetworkPartitionCtxt(networkPartition.getId());
if (clusterLevelNetworkPartitionContext != null) {
try {
addNewPartitionsToClusterMonitor(clusterLevelNetworkPartitionContext, networkPartition,
@@ -1219,9 +1202,9 @@ public class AutoscalerServiceImpl implements AutoscalerService {
clusterMonitor.getClusterContext().getServiceId());
} catch (RemoteException e) {
- String message =
- "Connection to cloud controller failed, Cluster monitor update failed for" +
- " [deployment-policy] " + deploymentPolicy.getDeploymentPolicyID();
+ String message = "Connection to cloud controller failed, Cluster monitor update failed for"
+ +
+ " [deployment-policy] " + deploymentPolicy.getDeploymentPolicyID();
log.error(message);
throw new CloudControllerConnectionException(message, e);
} catch (CloudControllerServiceInvalidPartitionExceptionException e) {
@@ -1247,7 +1230,7 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
private void removeOldPartitionsFromClusterMonitor(NetworkPartitionContext clusterLevelNetworkPartitionContext,
- NetworkPartitionRef networkPartition) {
+ NetworkPartitionRef networkPartition) {
for (InstanceContext instanceContext : clusterLevelNetworkPartitionContext.getInstanceIdToInstanceContextMap()
.values()) {
@@ -1261,8 +1244,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
//It has found that this partition context which is in cluster monitor is removed in updated policy
clusterLevelPartitionContext.setIsObsoletePartition(true);
- Iterator<MemberContext> memberContextIterator =
- clusterLevelPartitionContext.getActiveMembers().iterator();
+ Iterator<MemberContext> memberContextIterator = clusterLevelPartitionContext.getActiveMembers()
+ .iterator();
while (memberContextIterator.hasNext()) {
clusterLevelPartitionContext.moveActiveMemberToTerminationPendingMembers(
@@ -1272,8 +1255,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
memberContextIterator = clusterLevelPartitionContext.getPendingMembers().iterator();
while (memberContextIterator.hasNext()) {
- clusterLevelPartitionContext.movePendingMemberToObsoleteMembers(
- memberContextIterator.next().getMemberId());
+ clusterLevelPartitionContext
+ .movePendingMemberToObsoleteMembers(memberContextIterator.next().getMemberId());
}
}
@@ -1282,10 +1265,9 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
private void addNewPartitionsToClusterMonitor(NetworkPartitionContext clusterLevelNetworkPartitionContext,
- NetworkPartitionRef networkPartitionRef, String deploymentPolicyID,
- String cartridgeType) throws RemoteException,
- CloudControllerServiceInvalidPartitionExceptionException,
- CloudControllerServiceInvalidCartridgeTypeExceptionException {
+ NetworkPartitionRef networkPartitionRef, String deploymentPolicyID, String cartridgeType)
+ throws RemoteException, CloudControllerServiceInvalidPartitionExceptionException,
+ CloudControllerServiceInvalidCartridgeTypeExceptionException {
boolean validationOfNetworkPartitionRequired = false;
for (PartitionRef partition : networkPartitionRef.getPartitionRefs()) {
@@ -1314,8 +1296,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
}
@Override
- public boolean removeDeployementPolicy(String deploymentPolicyID) throws DeploymentPolicyNotExistsException,
- UnremovablePolicyException {
+ public boolean removeDeployementPolicy(String deploymentPolicyID)
+ throws DeploymentPolicyNotExistsException, UnremovablePolicyException {
if (log.isInfoEnabled()) {
log.info("Removing deployment policy: [deployment-policy_id] " + deploymentPolicyID);
}
@@ -1327,8 +1309,8 @@ public class AutoscalerServiceImpl implements AutoscalerService {
if (AutoscalerUtil.removableDeploymentPolicy(deploymentPolicyID)) {
PolicyManager.getInstance().removeDeploymentPolicy(deploymentPolicyID);
} else {
- throw new UnremovablePolicyException("This deployment policy cannot be removed, since it is used in an " +
- "application.");
+ throw new UnremovablePolicyException(
+ "This deployment policy cannot be removed, since it is used in an " + "application.");
}
if (log.isInfoEnabled()) {
log.info("Successfully removed deployment policy: [deployment_policy_id] " + deploymentPolicyID);
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationStartupTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationStartupTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationStartupTestCase.java
index 6d52df5..bc99bc9 100644
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationStartupTestCase.java
+++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/application/SampleApplicationStartupTestCase.java
@@ -45,89 +45,92 @@ public class SampleApplicationStartupTestCase extends StratosIntegrationTest {
private static final Log log = LogFactory.getLog(SampleApplicationStartupTestCase.class);
private static final String RESOURCES_PATH = "/sample-application-startup-test";
- @Test(timeOut = APPLICATION_TEST_TIMEOUT, description = "Application startup, activation and faulty member " +
- "detection", groups = {"stratos.application.startup", "smoke"})
+ @Test(timeOut = APPLICATION_TEST_TIMEOUT,
+ description = "Application startup, activation and faulty member " + "detection",
+ groups = { "stratos.application.startup", "smoke" })
public void testApplication() throws Exception {
- String autoscalingPolicyId = "autoscaling-policy-sample-applications-test";
+ String autoscalingPolicyId = "autoscaling-policy-sample-application-startup-test";
TopologyHandler topologyHandler = TopologyHandler.getInstance();
log.info("Adding autoscaling policy [autoscale policy id] " + autoscalingPolicyId);
- boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH
- + "/" + autoscalingPolicyId + ".json",
+ boolean addedScalingPolicy = restClient.addEntity(
+ RESOURCES_PATH + RestConstants.AUTOSCALING_POLICIES_PATH + "/" + autoscalingPolicyId + ".json",
RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
assertTrue(addedScalingPolicy);
- log.info("Adding cartridge [cartridge type] c1-sample-applications-test");
+ log.info("Adding cartridge [cartridge type] c1-sample-application-startup-test");
boolean addedC1 = restClient.addEntity(
- RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c1-sample-applications-test.json",
+ RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" + "c1-sample-application-startup-test.json",
RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
assertTrue(addedC1);
- log.info("Adding network partition [network partition id] network-partition-sample-applications-test-1");
+ log.info("Adding network partition [network partition id] sample-application-startup-test");
boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
- "network-partition-sample-applications-test-1.json",
- RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ "network-partition-sample-application-startup-test.json", RestConstants.NETWORK_PARTITIONS,
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(addedN1);
- log.info("Adding deployment policy [deployment policy id] deployment-policy-sample-applications-test");
+ log.info("Adding deployment policy [deployment policy id] deployment-policy-sample-application-startup-test");
boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
- "deployment-policy-sample-applications-test.json",
- RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
+ "deployment-policy-sample-application-startup-test.json", RestConstants.DEPLOYMENT_POLICIES,
+ RestConstants.DEPLOYMENT_POLICIES_NAME);
assertTrue(addedDep);
- log.info("Adding application [application id] sample-applications-test-1");
+ log.info("Adding application [application id] sample-application-startup-test");
boolean addedApp = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATIONS_PATH + "/" +
- "sample-applications-test-1.json", RestConstants.APPLICATIONS,
- RestConstants.APPLICATIONS_NAME);
+ "sample-application-startup-test.json", RestConstants.APPLICATIONS, RestConstants.APPLICATIONS_NAME);
assertEquals(addedApp, true);
- ApplicationBean bean = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
- "sample-applications-test-1", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
- assertEquals(bean.getApplicationId(), "sample-applications-test-1");
+ ApplicationBean bean = (ApplicationBean) restClient
+ .getEntity(RestConstants.APPLICATIONS, "sample-application-startup-test", ApplicationBean.class,
+ RestConstants.APPLICATIONS_NAME);
+ assertEquals(bean.getApplicationId(), "sample-application-startup-test");
- log.info("Adding application policy [application policy id] application-policy-sample-applications-test");
+ log.info(
+ "Adding application policy [application policy id] application-policy-sample-application-startup-test");
boolean addAppPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
- "application-policy-sample-applications-test.json", RestConstants.APPLICATION_POLICIES,
+ "application-policy-sample-application-startup-test.json", RestConstants.APPLICATION_POLICIES,
RestConstants.APPLICATION_POLICIES_NAME);
assertTrue(addAppPolicy);
- ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient.getEntity(
- RestConstants.APPLICATION_POLICIES, "application-policy-sample-applications-test",
- ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
- assertEquals(policyBean.getId(), "application-policy-sample-applications-test");
+ ApplicationPolicyBean policyBean = (ApplicationPolicyBean) restClient
+ .getEntity(RestConstants.APPLICATION_POLICIES, "application-policy-sample-application-startup-test",
+ ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
+ assertEquals(policyBean.getId(), "application-policy-sample-application-startup-test");
// Used policies/cartridges should not removed...asserting validations when removing policies
log.info("Trying to remove the used autoscaling policy...");
- boolean removedUsedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
- autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ boolean removedUsedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyId,
+ RestConstants.AUTOSCALING_POLICIES_NAME);
assertFalse(removedUsedAuto);
log.info("Trying to remove the used network partition...");
- boolean removedUsedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-sample-applications-test-1",
- RestConstants.NETWORK_PARTITIONS_NAME);
+ boolean removedUsedNet = restClient
+ .removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-sample-application-startup-test",
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertFalse(removedUsedNet);
log.info("Trying to remove the used deployment policy...");
- boolean removedUsedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
- "deployment-policy-sample-applications-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ boolean removedUsedDep = restClient
+ .removeEntity(RestConstants.DEPLOYMENT_POLICIES, "deployment-policy-sample-application-startup-test",
+ RestConstants.DEPLOYMENT_POLICIES_NAME);
assertFalse(removedUsedDep);
- log.info("Deploying application [application id] sample-applications-test-1 using [application policy id] " +
- "application-policy-sample-applications-test");
- String resourcePath = RestConstants.APPLICATIONS + "/sample-applications-test-1" +
- RestConstants.APPLICATIONS_DEPLOY + "/application-policy-sample-applications-test";
- boolean deployed = restClient.deployEntity(resourcePath,
- RestConstants.APPLICATIONS_NAME);
+ log.info("Deploying application [application id] sample-application-startup-test using [application policy id] "
+ + "application-policy-sample-application-startup-test");
+ String resourcePath = RestConstants.APPLICATIONS + "/sample-application-startup-test" +
+ RestConstants.APPLICATIONS_DEPLOY + "/application-policy-sample-application-startup-test";
+ boolean deployed = restClient.deployEntity(resourcePath, RestConstants.APPLICATIONS_NAME);
assertTrue(deployed);
log.info("Trying to remove the used application policy");
- boolean removedUsedAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
- "application-policy-sample-applications-test", RestConstants.APPLICATION_POLICIES_NAME);
+ boolean removedUsedAppPolicy = restClient
+ .removeEntity(RestConstants.APPLICATION_POLICIES, "application-policy-sample-application-startup-test",
+ RestConstants.APPLICATION_POLICIES_NAME);
assertFalse(removedUsedAppPolicy);
log.info("Trying to remove the deployed application without undeploying first");
- boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "sample-applications-test-1",
+ boolean removed = restClient.removeEntity(RestConstants.APPLICATIONS, "sample-application-startup-test",
RestConstants.APPLICATIONS_NAME);
assertFalse(removed);
@@ -137,10 +140,10 @@ public class SampleApplicationStartupTestCase extends StratosIntegrationTest {
log.info("Waiting for cluster status to become ACTIVE...");
topologyHandler.assertClusterActivation(bean.getApplicationId());
- log.info("Terminating members in [cluster id] c1-sample-applications-test in mock IaaS directly to simulate " +
- "faulty members...");
- Map<String, Member> memberMap = TopologyHandler.getInstance().getMembersForCluster
- ("c1-sample-applications-test", bean.getApplicationId());
+ log.info("Terminating members in [cluster id] c1-sample-application-startup-test in mock IaaS directly to "
+ + "simulate faulty members...");
+ Map<String, Member> memberMap = TopologyHandler.getInstance()
+ .getMembersForCluster("c1-sample-application-startup-test", bean.getApplicationId());
for (Map.Entry<String, Member> entry : memberMap.entrySet()) {
String memberId = entry.getValue().getMemberId();
TopologyHandler.getInstance().terminateMemberInMockIaas(memberId, mockIaasApiClient);
@@ -157,59 +160,67 @@ public class SampleApplicationStartupTestCase extends StratosIntegrationTest {
log.info("Waiting for cluster status to become ACTIVE...");
topologyHandler.assertClusterActivation(bean.getApplicationId());
- log.info("Un-deploying the application [application id] sample-applications-test-1");
- String resourcePathUndeploy = RestConstants.APPLICATIONS + "/sample-applications-test-1" +
+ log.info("Un-deploying the application [application id] sample-application-startup-test");
+ String resourcePathUndeploy = RestConstants.APPLICATIONS + "/sample-application-startup-test" +
RestConstants.APPLICATIONS_UNDEPLOY;
- boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy,
- RestConstants.APPLICATIONS_NAME);
+ boolean unDeployed = restClient.undeployEntity(resourcePathUndeploy, RestConstants.APPLICATIONS_NAME);
assertTrue(unDeployed);
- boolean undeploy = topologyHandler.assertApplicationUndeploy("sample-applications-test-1");
+ boolean undeploy = topologyHandler.assertApplicationUndeploy("sample-application-startup-test");
if (!undeploy) {
//Need to forcefully undeploy the application
- log.info("Force undeployment is going to start for the [application] sample-applications-test-1");
+ log.info("Force undeployment is going to start for the [application] sample-application-startup-test");
- restClient.undeployEntity(RestConstants.APPLICATIONS + "/sample-applications-test-1" +
+ restClient.undeployEntity(RestConstants.APPLICATIONS + "/sample-application-startup-test" +
RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
- boolean forceUndeployed = topologyHandler.assertApplicationUndeploy("sample-applications-test-1");
+ boolean forceUndeployed = topologyHandler.assertApplicationUndeploy("sample-application-startup-test");
assertTrue(String.format("Forceful undeployment failed for the application %s",
- "sample-applications-test-1"), forceUndeployed);
+ "sample-application-startup-test"), forceUndeployed);
}
- log.info("Removing the application [application id] sample-applications-test-1");
- boolean removedApp = restClient.removeEntity(RestConstants.APPLICATIONS, "sample-applications-test-1",
+ log.info("Removing the application [application id] sample-application-startup-test");
+ boolean removedApp = restClient.removeEntity(RestConstants.APPLICATIONS, "sample-application-startup-test",
RestConstants.APPLICATIONS_NAME);
assertTrue(removedApp);
- ApplicationBean beanRemoved = (ApplicationBean) restClient.getEntity(RestConstants.APPLICATIONS,
- "sample-applications-test-1", ApplicationBean.class, RestConstants.APPLICATIONS_NAME);
+ ApplicationBean beanRemoved = (ApplicationBean) restClient
+ .getEntity(RestConstants.APPLICATIONS, "sample-application-startup-test", ApplicationBean.class,
+ RestConstants.APPLICATIONS_NAME);
assertNull(beanRemoved);
- log.info("Removing the application policy [application policy id] application-policy-sample-applications-test");
- boolean removeAppPolicy = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
- "application-policy-sample-applications-test", RestConstants.APPLICATION_POLICIES_NAME);
+ log.info("Removing the application policy [application policy id] "
+ + "application-policy-sample-application-startup-test");
+ boolean removeAppPolicy = restClient
+ .removeEntity(RestConstants.APPLICATION_POLICIES, "application-policy-sample-application-startup-test",
+ RestConstants.APPLICATION_POLICIES_NAME);
assertTrue(removeAppPolicy);
- log.info("Removing the cartridge [cartridge type] c1-sample-applications-test");
- boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c1-sample-applications-test",
+ log.info("Removing the cartridge [cartridge type] c1-sample-application-startup-test");
+ boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c1-sample-application-startup-test",
RestConstants.CARTRIDGES_NAME);
assertTrue(removedC1);
log.info("Removing the autoscaling policy [autoscaling policy id] " + autoscalingPolicyId);
- boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES,
- autoscalingPolicyId, RestConstants.AUTOSCALING_POLICIES_NAME);
+ boolean removedAuto = restClient.removeEntity(RestConstants.AUTOSCALING_POLICIES, autoscalingPolicyId,
+ RestConstants.AUTOSCALING_POLICIES_NAME);
assertTrue(removedAuto);
- log.info("Removing the deployment policy [deployment policy id] deployment-policy-sample-applications-test");
- boolean removedDep = restClient.removeEntity(RestConstants.DEPLOYMENT_POLICIES,
- "deployment-policy-sample-applications-test", RestConstants.DEPLOYMENT_POLICIES_NAME);
+ log.info(
+ "Removing the deployment policy [deployment policy id] "
+ + "deployment-policy-sample-application-startup-test");
+ boolean removedDep = restClient
+ .removeEntity(RestConstants.DEPLOYMENT_POLICIES, "deployment-policy-sample-application-startup-test",
+ RestConstants.DEPLOYMENT_POLICIES_NAME);
assertTrue(removedDep);
- log.info("Removing the network partition [network partition id] network-partition-sample-applications-test-1");
- boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-sample-applications-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+ log.info(
+ "Removing the network partition [network partition id] "
+ + "network-partition-sample-application-startup-test");
+ boolean removedNet = restClient
+ .removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-sample-application-startup-test",
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(removedNet);
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/products/stratos/modules/integration/test-integration/src/test/resources/common/log4j.properties
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/common/log4j.properties b/products/stratos/modules/integration/test-integration/src/test/resources/common/log4j.properties
index 44aa5c9..fb0da79 100644
--- a/products/stratos/modules/integration/test-integration/src/test/resources/common/log4j.properties
+++ b/products/stratos/modules/integration/test-integration/src/test/resources/common/log4j.properties
@@ -59,6 +59,7 @@ log4j.logger.org.apache.stratos.cloud.controller=DEBUG
log4j.logger.org.wso2.andes.client=ERROR
# Autoscaler rule logs
log4j.logger.org.apache.stratos.autoscaler.rule.RuleLog=DEBUG
+org.apache.stratos.cloud.controller.messaging.topology.TopologyManager=INFO
# Apache jclouds
#log4j.logger.jclouds.wire=DEBUG
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-application-startup-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-application-startup-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-application-startup-test.json
new file mode 100644
index 0000000..afeb213
--- /dev/null
+++ b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-application-startup-test.json
@@ -0,0 +1,17 @@
+{
+ "id": "application-policy-sample-application-startup-test",
+ "algorithm": "one-after-another",
+ "networkPartitions": [
+ "network-partition-sample-application-startup-test"
+ ],
+ "properties": [
+ {
+ "name": "networkPartitionGroups",
+ "value": "network-partition-sample-application-startup-test"
+ },
+ {
+ "name": "key-2",
+ "value": "value-2"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-applications-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-applications-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-applications-test.json
deleted file mode 100644
index df1ffb9..0000000
--- a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/application-policies/application-policy-sample-applications-test.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "id": "application-policy-sample-applications-test",
- "algorithm": "one-after-another",
- "networkPartitions": [
- "network-partition-sample-applications-test-1"
- ],
- "properties": [
- {
- "name": "networkPartitionGroups",
- "value": "network-partition-sample-applications-test-1"
- },
- {
- "name": "key-2",
- "value": "value-2"
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-application-startup-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-application-startup-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-application-startup-test.json
new file mode 100644
index 0000000..d9594ea
--- /dev/null
+++ b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-application-startup-test.json
@@ -0,0 +1,24 @@
+{
+ "alias": "sample-application-startup-test",
+ "applicationId": "sample-application-startup-test",
+ "components": {
+ "cartridges": [
+ {
+ "type": "c1-sample-application-startup-test",
+ "cartridgeMin": 3,
+ "cartridgeMax": 5,
+ "subscribableInfo": {
+ "alias": "c1-1x0-sample-applications-test",
+ "autoscalingPolicy": "autoscaling-policy-sample-application-startup-test",
+ "deploymentPolicy": "deployment-policy-sample-application-startup-test",
+ "artifactRepository": {
+ "privateRepo": false,
+ "repoUrl": "https://github.com/lakwarus/single-cartridge.git",
+ "repoUsername": "",
+ "repoPassword": ""
+ }
+ }
+ }
+ ]
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-applications-test-1.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-applications-test-1.json b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-applications-test-1.json
deleted file mode 100644
index ce02f6c..0000000
--- a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/applications/sample-applications-test-1.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "alias": "sample-applications-test-1",
- "applicationId": "sample-applications-test-1",
- "components": {
- "cartridges": [
- {
- "type": "c1-sample-applications-test",
- "cartridgeMin": 3,
- "cartridgeMax": 5,
- "subscribableInfo": {
- "alias": "c1-1x0-sample-applications-test",
- "autoscalingPolicy": "autoscaling-policy-sample-applications-test",
- "deploymentPolicy": "deployment-policy-sample-applications-test",
- "artifactRepository": {
- "privateRepo": false,
- "repoUrl": "https://github.com/lakwarus/single-cartridge.git",
- "repoUsername": "",
- "repoPassword": ""
- }
- }
- }
- ]
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-application-startup-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-application-startup-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-application-startup-test.json
new file mode 100644
index 0000000..e74d8b3
--- /dev/null
+++ b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-application-startup-test.json
@@ -0,0 +1,14 @@
+{
+ "id": "autoscaling-policy-sample-application-startup-test",
+ "loadThresholds": {
+ "requestsInFlight": {
+ "threshold": 35
+ },
+ "memoryConsumption": {
+ "threshold": 45
+ },
+ "loadAverage": {
+ "threshold": 25
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-applications-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-applications-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-applications-test.json
deleted file mode 100644
index 5bd90ab..0000000
--- a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/autoscaling-policies/autoscaling-policy-sample-applications-test.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "id": "autoscaling-policy-sample-applications-test",
- "loadThresholds": {
- "requestsInFlight": {
- "threshold": 35
- },
- "memoryConsumption": {
- "threshold": 45
- },
- "loadAverage": {
- "threshold": 25
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6781d75c/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/cartridges/mock/c1-sample-application-startup-test.json
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/cartridges/mock/c1-sample-application-startup-test.json b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/cartridges/mock/c1-sample-application-startup-test.json
new file mode 100755
index 0000000..cf182ec
--- /dev/null
+++ b/products/stratos/modules/integration/test-integration/src/test/resources/sample-application-startup-test/cartridges/mock/c1-sample-application-startup-test.json
@@ -0,0 +1,45 @@
+{
+ "type": "c1-sample-application-startup-test",
+ "provider": "apache",
+ "host": "stratos.apache.org",
+ "category": "data",
+ "displayName": "c1-sample-application-startup-test",
+ "description": "c1-sample-application-startup-test Cartridge",
+ "version": "7",
+ "multiTenant": "false",
+ "portMapping": [
+ {
+ "name": "http-22",
+ "protocol": "http",
+ "port": "22",
+ "proxyPort": "8280"
+ }
+ ],
+ "deployment": {
+ },
+ "iaasProvider": [
+ {
+ "type": "mock",
+ "imageId": "RegionOne/b4ca55e3-58ab-4937-82ce-817ebd10240e",
+ "networkInterfaces": [
+ {
+ "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e"
+ }
+ ],
+ "property": [
+ {
+ "name": "instanceType",
+ "value": "RegionOne/aa5f45a2-c6d6-419d-917a-9dd2e3888594"
+ },
+ {
+ "name": "keyPair",
+ "value": "mock-key"
+ },
+ {
+ "name": "securityGroups",
+ "value": "default"
+ }
+ ]
+ }
+ ]
+}