stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject [3/6] stratos git commit: Add the updated integration tests
Date Mon, 10 Aug 2015 11:03:19 GMT
Add the updated integration tests


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/4b96ba01
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/4b96ba01
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/4b96ba01

Branch: refs/heads/tenant-isolation
Commit: 4b96ba010f659685a64a8ba8e64b910b57e09086
Parents: 6ce6d54
Author: Gayan Gunarathne <gayang@wso2.com>
Authored: Mon Aug 10 16:16:14 2015 +0530
Committer: Gayan Gunarathne <gayang@wso2.com>
Committed: Mon Aug 10 16:16:14 2015 +0530

----------------------------------------------------------------------
 .../tests/ApplicationPolicyTest.java            |  144 ---
 .../integration/tests/ApplicationTest.java      |  220 ----
 .../tests/AutoscalingPolicyTest.java            |  143 ---
 .../integration/tests/CartridgeGroupTest.java   |  145 ---
 .../integration/tests/CartridgeTest.java        |  144 ---
 .../integration/tests/DeploymentPolicyTest.java |  146 ---
 .../integration/tests/NetworkPartitionTest.java |  144 ---
 .../integration/tests/RestConstants.java        |   15 +
 .../tests/SampleApplicationsTest.java           | 1035 ------------------
 .../tests/StratosArtifactsUtils.java            |   53 -
 .../tests/StratosTestServerManager.java         |   63 +-
 .../integration/tests/rest/RestClient.java      |  246 ++++-
 .../application-policy-1.json                   |   18 -
 .../simple/single-cartridge-app/README.md       |   25 -
 .../single-cartridge-app/g-sc-G123-1.json       |   86 --
 .../update/g-sc-G123-1.json                     |   86 --
 .../autoscaling-policy-1.json                   |   14 -
 .../autoscaling-policy-c0.json                  |   14 -
 .../update/autoscaling-policy-c0.json           |   14 -
 .../cartridges-groups/cartrdige-nested.json     |   50 -
 .../update/cartrdige-nested.json                |   50 -
 .../src/test/resources/cartridges/mock/c0.json  |  124 ---
 .../src/test/resources/cartridges/mock/c1.json  |   45 -
 .../src/test/resources/cartridges/mock/c2.json  |   45 -
 .../src/test/resources/cartridges/mock/c3.json  |   45 -
 .../resources/cartridges/mock/update/c0.json    |  124 ---
 .../deployment-policy-1.json                    |   32 -
 .../update/deployment-policy-1.json             |   36 -
 .../ec2/network-partition-1.json                |   19 -
 .../ec2/network-partition-2.json                |   19 -
 .../gce/network-partition-1.json                |   15 -
 .../kubernetes/network-partition-1.json         |   15 -
 .../kubernetes/network-partition-2.json         |   15 -
 .../kubernetes/network-partition-3.json         |   15 -
 .../mock/network-partition-1.json               |   15 -
 .../mock/network-partition-2.json               |   24 -
 .../mock/network-partition-3.json               |   15 -
 .../mock/network-partition-4.json               |   15 -
 .../mock/update/network-partition-1.json        |   28 -
 .../multi/ap-southeast-1-nw-partition.json      |   19 -
 .../multi/ap-southeast-2-nw-partition.json      |   25 -
 .../multi/openstack-nw-partition.json           |   21 -
 .../openstack/network-partition-1.json          |   15 -
 .../openstack/network-partition-2.json          |   15 -
 44 files changed, 300 insertions(+), 3296 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
deleted file mode 100644
index c5ee5d1..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationPolicyTest.java
+++ /dev/null
@@ -1,144 +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 com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.stratos.common.beans.policy.deployment.ApplicationPolicyBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
-import org.apache.stratos.integration.tests.rest.RestClient;
-
-import java.net.URI;
-
-/**
- * Test to handle Network partition CRUD operations
- */
-public class ApplicationPolicyTest extends StratosArtifactsUtils {
-    private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
-    String applicationPolicies = "/application-policies/";
-    String applicationPoliciesUpdate = "/application-policies/update/";
-
-
-    public boolean addApplicationPolicy(String networkPartitionId, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(applicationPolicies + networkPartitionId);
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATION_POLICIES).build();
-
-            HttpResponse response = restClient.doPost(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public ApplicationPolicyBean getApplicationPolicy(String networkPartitionId, String endpoint,
-                                                    RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATION_POLICIES + "/" +
-                    networkPartitionId).build();
-            HttpResponse response = restClient.doGet(uri, "admin", "admin");
-            GsonBuilder gsonBuilder = new GsonBuilder();
-            Gson gson = gsonBuilder.create();
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return gson.fromJson(response.getContent(), ApplicationPolicyBean.class);
-                } else if (response.getStatusCode() == 404) {
-                    return null;
-                } else {
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean updateApplicationPolicy(String networkPartitionId, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(applicationPoliciesUpdate + networkPartitionId);
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATION_POLICIES).build();
-            HttpResponse response = restClient.doPut(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean removeApplicationPolicy(String networkPartitionId, String endpoint, RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATION_POLICIES + "/" +
-                    networkPartitionId).build();
-            HttpResponse response = restClient.doDelete(uri, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else if(response.getContent().contains("it is used")) {
-                    return false;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
deleted file mode 100644
index 27eb4b5..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/ApplicationTest.java
+++ /dev/null
@@ -1,220 +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 com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.stratos.common.beans.application.ApplicationBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
-import org.apache.stratos.integration.tests.rest.RestClient;
-
-import java.net.URI;
-
-/**
- * Test to handle autoscaling policy CRUD operations
- */
-public class ApplicationTest extends StratosArtifactsUtils {
-    private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
-    String applications = "/applications/simple/single-cartridge-app/";
-    String applicationsUpdate = "/applications/simple/single-cartridge-app/update/";
-
-
-    public boolean addApplication(String applicationId, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(applications + applicationId);
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS).build();
-
-            HttpResponse response = restClient.doPost(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean deployApplication(String applicationId, String applicationPolicyId,
-                                     String endpoint, RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS + "/" + applicationId +
-            RestConstants.APPLICATIONS_DEPLOY + "/" + applicationPolicyId).build();
-
-            HttpResponse response = restClient.doPost(uri, "", "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean undeployApplication(String applicationId,
-                                     String endpoint, RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS + "/" + applicationId +
-                    RestConstants.APPLICATIONS_UNDEPLOY).build();
-
-            HttpResponse response = restClient.doPost(uri, "", "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean forceUndeployApplication(String applicationId,
-                                       String endpoint, RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS + "/" + applicationId +
-                    RestConstants.APPLICATIONS_UNDEPLOY + "?force=true").build();
-
-            HttpResponse response = restClient.doPost(uri, "", "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public ApplicationBean getApplication(String applicationId, String endpoint,
-                                                    RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS + "/" +
-                    applicationId).build();
-            HttpResponse response = restClient.doGet(uri, "admin", "admin");
-            GsonBuilder gsonBuilder = new GsonBuilder();
-            Gson gson = gsonBuilder.create();
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return gson.fromJson(response.getContent(), ApplicationBean.class);
-                } else if (response.getStatusCode() == 404) {
-                    return null;
-                } else {
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean updateApplication(String applicationId, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(applicationsUpdate + applicationId);
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS).build();
-            HttpResponse response = restClient.doPut(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean removeApplication(String applicationId, String endpoint, RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.APPLICATIONS + "/" +
-                    applicationId).build();
-            HttpResponse response = restClient.doDelete(uri, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
deleted file mode 100644
index 52c4c0c..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/AutoscalingPolicyTest.java
+++ /dev/null
@@ -1,143 +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 com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
-import org.apache.stratos.integration.tests.rest.RestClient;
-
-import java.net.URI;
-
-/**
- * Test to handle autoscaling policy CRUD operations
- */
-public class AutoscalingPolicyTest extends StratosArtifactsUtils {
-    private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
-    String autoscalingPolicy = "/autoscaling-policies/";
-    String autoscalingPolicyUpdate = "/autoscaling-policies/update/";
-
-
-    public boolean addAutoscalingPolicy(String autoscalingPolicyName, String endpoint, RestClient restClient, String userName, String password) {
-        try {
-            String content = getJsonStringFromFile(autoscalingPolicy + autoscalingPolicyName);
-            URI uri = new URIBuilder(endpoint + RestConstants.AUTOSCALING_POLICIES).build();
-
-            HttpResponse response = restClient.doPost(uri, content, userName, password);
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public AutoscalePolicyBean getAutoscalingPolicy(String autoscalingPolicyName, String endpoint,
-                                                    RestClient restClient, String userName, String password) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.AUTOSCALING_POLICIES + "/" +
-                    autoscalingPolicyName).build();
-            HttpResponse response = restClient.doGet(uri, userName, password);
-            GsonBuilder gsonBuilder = new GsonBuilder();
-            Gson gson = gsonBuilder.create();
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return gson.fromJson(response.getContent(), AutoscalePolicyBean.class);
-                } else if (response.getStatusCode() == 404) {
-                    return null;
-                } else {
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean updateAutoscalingPolicy(String autoscalingPolicyName, String endpoint, RestClient restClient, String userName, String password) {
-        try {
-            String content = getJsonStringFromFile(autoscalingPolicyUpdate + autoscalingPolicyName);
-            URI uri = new URIBuilder(endpoint + RestConstants.AUTOSCALING_POLICIES).build();
-            HttpResponse response = restClient.doPut(uri, content, userName, password);
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean removeAutoscalingPolicy(String autoscalingPolicyName, String endpoint, RestClient restClient, String userName, String password) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.AUTOSCALING_POLICIES + "/" +
-                    autoscalingPolicyName).build();
-            HttpResponse response = restClient.doDelete(uri, userName, password);
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else if(response.getContent().contains("is in use")) {
-                    return false;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
deleted file mode 100644
index c299571..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeGroupTest.java
+++ /dev/null
@@ -1,145 +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 com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
-import org.apache.stratos.integration.tests.rest.RestClient;
-
-import java.net.URI;
-
-/**
- * Test to handle Network partition CRUD operations
- */
-public class CartridgeGroupTest extends StratosArtifactsUtils {
-    private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
-    String cartridgeGroups = "/cartridges-groups/";
-    String cartridgeGroupsUpdate = "/cartridges-groups/update/";
-
-
-    public boolean addCartridgeGroup(String groupName, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(cartridgeGroups + groupName);
-            URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGE_GROUPS).build();
-
-            HttpResponse response = restClient.doPost(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-	        log.info(response.getReason());
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public CartridgeGroupBean getCartridgeGroup(String groupName, String endpoint,
-                                                    RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGE_GROUPS + "/" +
-                    groupName).build();
-            HttpResponse response = restClient.doGet(uri, "admin", "admin");
-            GsonBuilder gsonBuilder = new GsonBuilder();
-            Gson gson = gsonBuilder.create();
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return gson.fromJson(response.getContent(), CartridgeGroupBean.class);
-                } else if (response.getStatusCode() == 404) {
-                    return null;
-                } else {
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean updateCartridgeGroup(String groupName, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(cartridgeGroupsUpdate + groupName);
-            URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGE_GROUPS).build();
-            HttpResponse response = restClient.doPut(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean removeCartridgeGroup(String groupName, String endpoint, RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGE_GROUPS + "/" +
-                    groupName).build();
-            HttpResponse response = restClient.doDelete(uri, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else if(response.getContent().contains("it is used")) {
-                    return false;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
deleted file mode 100644
index 522f0ee..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/CartridgeTest.java
+++ /dev/null
@@ -1,144 +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 com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.stratos.common.beans.cartridge.CartridgeBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
-import org.apache.stratos.integration.tests.rest.RestClient;
-
-import java.net.URI;
-
-/**
- * Test to handle Network partition CRUD operations
- */
-public class CartridgeTest extends StratosArtifactsUtils {
-    private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
-    String cartridges = "/cartridges/mock/";
-    String cartridgesUpdate = "/cartridges/mock/update/";
-
-
-    public boolean addCartridge(String cartridgeType, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(cartridges + cartridgeType);
-            URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGES).build();
-
-            HttpResponse response = restClient.doPost(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public CartridgeBean getCartridge(String cartridgeType, String endpoint,
-                                                    RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGES + "/" +
-                    cartridgeType).build();
-            HttpResponse response = restClient.doGet(uri, "admin", "admin");
-            GsonBuilder gsonBuilder = new GsonBuilder();
-            Gson gson = gsonBuilder.create();
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return gson.fromJson(response.getContent(), CartridgeBean.class);
-                } else if (response.getStatusCode() == 404) {
-                    return null;
-                } else {
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean updateCartridge(String cartridgeType, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(cartridgesUpdate + cartridgeType);
-            URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGES).build();
-            HttpResponse response = restClient.doPut(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean removeCartridge(String cartridgeType, String endpoint, RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.CARTRIDGES + "/" +
-                    cartridgeType).build();
-            HttpResponse response = restClient.doDelete(uri, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else if (response.getContent().contains("it is used")) {
-                    return false;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
deleted file mode 100644
index 6ee2dd1..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/DeploymentPolicyTest.java
+++ /dev/null
@@ -1,146 +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 com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
-import org.apache.stratos.integration.tests.rest.RestClient;
-
-import java.net.URI;
-
-/**
- * Test to handle Network partition CRUD operations
- */
-public class DeploymentPolicyTest extends StratosArtifactsUtils {
-    private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
-    String deploymentPolicies = "/deployment-policies/";
-    String deploymentPoliciesUpdate = "/deployment-policies/update/";
-
-
-    public boolean addDeploymentPolicy(String deploymentPolicyId, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(deploymentPolicies + deploymentPolicyId);
-            URI uri = new URIBuilder(endpoint + RestConstants.DEPLOYMENT_POLICIES).build();
-
-            HttpResponse response = restClient.doPost(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public DeploymentPolicyBean getDeploymentPolicy(String deploymentPolicyId, String endpoint,
-                                                    RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.DEPLOYMENT_POLICIES + "/" +
-                    deploymentPolicyId).build();
-            HttpResponse response = restClient.doGet(uri, "admin", "admin");
-            GsonBuilder gsonBuilder = new GsonBuilder();
-            Gson gson = gsonBuilder.create();
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return gson.fromJson(response.getContent(), DeploymentPolicyBean.class);
-                } else if (response.getStatusCode() == 404) {
-                    return null;
-                } else {
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean updateDeploymentPolicy(String deploymentPolicyId, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(deploymentPoliciesUpdate + deploymentPolicyId);
-            URI uri = new URIBuilder(endpoint + RestConstants.DEPLOYMENT_POLICIES).build();
-            HttpResponse response = restClient.doPut(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else if(response.getContent().contains("it is used")) {
-                    return false;
-                } else {
-                        GsonBuilder gsonBuilder = new GsonBuilder();
-                        Gson gson = gsonBuilder.create();
-                        ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                        if (errorResponse != null) {
-                            throw new RuntimeException(errorResponse.getErrorMessage());
-                        }
-                    }
-                }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean removeDeploymentPolicy(String deploymentPolicyId, String endpoint, RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.DEPLOYMENT_POLICIES + "/" +
-                    deploymentPolicyId).build();
-            HttpResponse response = restClient.doDelete(uri, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else if(response.getContent().contains("is in use")) {
-                    return false;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java b/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
deleted file mode 100644
index aa31562..0000000
--- a/products/stratos/modules/integration/src/test/java/org/apache/stratos/integration/tests/NetworkPartitionTest.java
+++ /dev/null
@@ -1,144 +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 com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
-import org.apache.stratos.integration.tests.rest.ErrorResponse;
-import org.apache.stratos.integration.tests.rest.HttpResponse;
-import org.apache.stratos.integration.tests.rest.RestClient;
-
-import java.net.URI;
-
-/**
- * Test to handle Network partition CRUD operations
- */
-public class NetworkPartitionTest extends StratosArtifactsUtils {
-    private static final Log log = LogFactory.getLog(StratosTestServerManager.class);
-    String networkPartitions = "/network-partitions/mock/";
-    String networkPartitionsUpdate = "/network-partitions/mock/update/";
-
-
-    public boolean addNetworkPartition(String networkPartitionId, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(networkPartitions + networkPartitionId);
-            URI uri = new URIBuilder(endpoint + RestConstants.NETWORK_PARTITIONS).build();
-
-            HttpResponse response = restClient.doPost(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public NetworkPartitionBean getNetworkPartition(String networkPartitionId, String endpoint,
-                                                    RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.NETWORK_PARTITIONS + "/" +
-                    networkPartitionId).build();
-            HttpResponse response = restClient.doGet(uri, "admin", "admin");
-            GsonBuilder gsonBuilder = new GsonBuilder();
-            Gson gson = gsonBuilder.create();
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return gson.fromJson(response.getContent(), NetworkPartitionBean.class);
-                } else if (response.getStatusCode() == 404) {
-                    return null;
-                } else {
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean updateNetworkPartition(String networkPartitionId, String endpoint, RestClient restClient) {
-        try {
-            String content = getJsonStringFromFile(networkPartitionsUpdate + networkPartitionId);
-            URI uri = new URIBuilder(endpoint + RestConstants.NETWORK_PARTITIONS).build();
-            HttpResponse response = restClient.doPut(uri, content, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-
-    public boolean removeNetworkPartition(String networkPartitionId, String endpoint, RestClient restClient) {
-        try {
-            URI uri = new URIBuilder(endpoint + RestConstants.NETWORK_PARTITIONS + "/" +
-                    networkPartitionId).build();
-            HttpResponse response = restClient.doDelete(uri, "admin", "admin");
-            if (response != null) {
-                if ((response.getStatusCode() >= 200) && (response.getStatusCode() < 300)) {
-                    return true;
-                } else if(response.getContent().contains("it is used")) {
-                    return false;
-                } else {
-                    GsonBuilder gsonBuilder = new GsonBuilder();
-                    Gson gson = gsonBuilder.create();
-                    ErrorResponse errorResponse = gson.fromJson(response.getContent(), ErrorResponse.class);
-                    if (errorResponse != null) {
-                        throw new RuntimeException(errorResponse.getErrorMessage());
-                    }
-                }
-            }
-            throw new RuntimeException("An unknown error occurred");
-        } catch (Exception e) {
-            String message = "Could not start mock instance";
-            throw new RuntimeException(message, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/4b96ba01/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
index 9678c4e..bf7de6c 100644
--- 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
@@ -34,4 +34,19 @@ public class RestConstants {
     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 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";
+
 }


Mime
View raw message