You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/12/07 11:19:50 UTC
[21/50] [abbrv] stratos git commit: Cleaning up test cases. Remove
duplicate assertions. Fix formatting.
http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTestCase.java
deleted file mode 100644
index 38e440f..0000000
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeGroupTestCase.java
+++ /dev/null
@@ -1,251 +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.group;
-
-import com.google.gson.reflect.TypeToken;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.beans.cartridge.CartridgeGroupBean;
-import org.apache.stratos.integration.common.RestConstants;
-import org.apache.stratos.integration.tests.StratosIntegrationTest;
-import org.testng.annotations.Test;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.AssertJUnit.*;
-
-/**
- * Test to handle Cartridge group CRUD operations
- */
-public class CartridgeGroupTestCase extends StratosIntegrationTest {
- private static final Log log = LogFactory.getLog(CartridgeGroupTestCase.class);
- private static final String RESOURCES_PATH = "/cartridge-group-test";
-
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.cartridge.deployment", "smoke"})
- public void testCartridgeGroup() throws Exception {
- boolean addedC1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH +
- "/" + "c4-cartridge-group-test.json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
- assertTrue(String.format("Cartridge did not added: [cartridge-name] %s",
- "c4-cartridge-group-test"), addedC1);
-
- boolean addedC2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH +
- "/" + "c5-cartridge-group-test.json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
- assertTrue(String.format("Cartridge did not added: [cartridge-name] %s",
- "c5-cartridge-group-test"), addedC2);
-
- boolean addedC3 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH +
- "/" + "c6-cartridge-group-test.json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
- assertTrue(String.format("Cartridge did not added: [cartridge-name] %s",
- "c6-cartridge-group-test"), addedC3);
-
- boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
- "/" + "g4-g5-g6-cartridge-group-test.json", RestConstants.CARTRIDGE_GROUPS,
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge Group did not added: [cartridge-group-name] %s",
- "g4-g5-g6-cartridge-group-test"), added);
-
- CartridgeGroupBean bean = (CartridgeGroupBean) restClient.
- getEntity(RestConstants.CARTRIDGE_GROUPS, "G4-cartridge-group-test",
- CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
- assertEquals(bean.getName(), "G4-cartridge-group-test",
- String.format("Cartridge Group name did not match: [cartridge-group-name] %s",
- "g4-g5-g6-cartridge-group-test.json"));
-
- boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
- "/" + "g4-g5-g6-cartridge-group-test-v1.json",
- RestConstants.CARTRIDGE_GROUPS, RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge Group did not updated: [cartridge-group-name] %s",
- "g4-g5-g6-cartridge-group-test"), updated);
-
- CartridgeGroupBean updatedBean = (CartridgeGroupBean) restClient.
- getEntity(RestConstants.CARTRIDGE_GROUPS, "G4-cartridge-group-test",
- CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
- assertEquals(updatedBean.getName(), "G4-cartridge-group-test",
- String.format("Updated Cartridge Group didn't match: [cartridge-group-name] %s",
- "g4-g5-g6-cartridge-group-test"));
-
- boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c4-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertFalse(String.format("Cartridge can be removed while it is used in " +
- "cartridge group: [cartridge-name] %s", "c4-cartridge-group-test"), removedC1);
-
- boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c5-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertFalse(String.format("Cartridge can be removed while it is used in " +
- "cartridge group: [cartridge-name] %s",
- "c5-cartridge-group-test"), removedC2);
-
- boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c6-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertFalse(String.format("Cartridge can be removed while it is used in " +
- "cartridge group: [cartridge-name] %s",
- "c6-cartridge-group-test"), removedC3);
-
- boolean removed = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, "G4-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge Group did not removed: [cartridge-group-name] %s",
- "g4-g5-g6-cartridge-group-test"), removed);
-
- CartridgeGroupBean beanRemoved = (CartridgeGroupBean) restClient.
- getEntity(RestConstants.CARTRIDGE_GROUPS, "G4-cartridge-group-test",
- CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
- assertEquals(beanRemoved, null,
- String.format("Cartridge Group did not removed completely: [cartridge-group-name] %s",
- "g4-g5-g6-cartridge-group-test"));
-
- removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c4-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge can not be removed : [cartridge-name] %s",
- "c4-cartridge-group-test"), removedC1);
-
- removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c5-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge can not be removed : [cartridge-name] %s",
- "c5-cartridge-group-test"), removedC2);
-
- removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c6-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge can not be removed : [cartridge-name] %s",
- "c6-cartridge-group-test"), removedC3);
- }
-
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.cartridge.deployment", "smoke"})
- public void testCartridgeGroupList() throws Exception {
- boolean addedC1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH +
- "/" + "c4-cartridge-group-test.json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
- assertTrue(String.format("Cartridge did not added: [cartridge-name] %s",
- "c4-cartridge-group-test"), addedC1);
-
- boolean addedC2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH +
- "/" + "c5-cartridge-group-test.json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
- assertTrue(String.format("Cartridge did not added: [cartridge-name] %s",
- "c5-cartridge-group-test"), addedC2);
-
- boolean addedC3 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH +
- "/" + "c6-cartridge-group-test.json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
- assertTrue(String.format("Cartridge did not added: [cartridge-name] %s",
- "c6-cartridge-group-test"), addedC3);
-
- String group1 = "group-1-cartridge-group-test";
- String group2 = "group-2-cartridge-group-test";
-
- boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
- "/" + group1 + ".json", RestConstants.CARTRIDGE_GROUPS,
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge Group did not added: [cartridge-group-name] %s",
- group1), added);
-
- added = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGE_GROUPS_PATH +
- "/" + group2 + ".json", RestConstants.CARTRIDGE_GROUPS,
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge Group did not added: [cartridge-group-name] %s",
- group1), added);
-
- Type listType = new TypeToken<ArrayList<CartridgeGroupBean>>() {
- }.getType();
-
- List<CartridgeGroupBean> cartridgeGroupList = (List<CartridgeGroupBean>) restClient.
- listEntity(RestConstants.CARTRIDGE_GROUPS,
- listType, RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(cartridgeGroupList.size() >= 2);
-
- CartridgeGroupBean bean1 = null;
- for (CartridgeGroupBean cartridgeGroupBean : cartridgeGroupList) {
- if (cartridgeGroupBean.getName().equals(group1)) {
- bean1 = cartridgeGroupBean;
- }
- }
- assertNotNull(bean1);
-
- CartridgeGroupBean bean2 = null;
- for (CartridgeGroupBean cartridgeGroupBean : cartridgeGroupList) {
- if (cartridgeGroupBean.getName().equals(group2)) {
- bean2 = cartridgeGroupBean;
- }
- }
- assertNotNull(bean2);
-
- boolean removed = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, group1,
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge Group did not removed: [cartridge-group-name] %s",
- group1), removed);
-
- CartridgeGroupBean beanRemoved = (CartridgeGroupBean) restClient.
- getEntity(RestConstants.CARTRIDGE_GROUPS, group1,
- CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
- assertNull(String.format("Cartridge Group did not removed completely: " +
- "[cartridge-group-name] %s",
- group1), beanRemoved);
-
- boolean removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c4-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertFalse(String.format("Cartridge can be removed while it is used in " +
- "cartridge group: [cartridge-name] %s", "c4-cartridge-group-test"), removedC1);
-
- boolean removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c5-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertFalse(String.format("Cartridge can be removed while it is used in " +
- "cartridge group: [cartridge-name] %s",
- "c5-cartridge-group-test"), removedC2);
-
- boolean removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c6-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertFalse(String.format("Cartridge can be removed while it is used in " +
- "cartridge group: [cartridge-name] %s",
- "c6-cartridge-group-test"), removedC3);
-
- removed = restClient.removeEntity(RestConstants.CARTRIDGE_GROUPS, group2,
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge Group did not removed: [cartridge-group-name] %s",
- group2), removed);
-
- beanRemoved = (CartridgeGroupBean) restClient.
- getEntity(RestConstants.CARTRIDGE_GROUPS, group2,
- CartridgeGroupBean.class, RestConstants.CARTRIDGE_GROUPS_NAME);
- assertNull(String.format("Cartridge Group did not removed completely: " +
- "[cartridge-group-name] %s",
- group2), beanRemoved);
-
- removedC1 = restClient.removeEntity(RestConstants.CARTRIDGES, "c4-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge can not be removed : [cartridge-name] %s",
- "c4-cartridge-group-test"), removedC1);
-
- removedC2 = restClient.removeEntity(RestConstants.CARTRIDGES, "c5-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge can not be removed : [cartridge-name] %s",
- "c5-cartridge-group-test"), removedC2);
-
- removedC3 = restClient.removeEntity(RestConstants.CARTRIDGES, "c6-cartridge-group-test",
- RestConstants.CARTRIDGE_GROUPS_NAME);
- assertTrue(String.format("Cartridge can not be removed : [cartridge-name] %s",
- "c6-cartridge-group-test"), removedC3);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTestCase.java
deleted file mode 100644
index 4e9484a..0000000
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/group/CartridgeTestCase.java
+++ /dev/null
@@ -1,183 +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.group;
-
-import com.google.gson.reflect.TypeToken;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.beans.PropertyBean;
-import org.apache.stratos.common.beans.cartridge.CartridgeBean;
-import org.apache.stratos.integration.common.RestConstants;
-import org.apache.stratos.integration.tests.StratosIntegrationTest;
-import org.testng.annotations.Test;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-/**
- * Test to handle Cartridge CRUD operations
- */
-public class CartridgeTestCase extends StratosIntegrationTest {
- private static final Log log = LogFactory.getLog(CartridgeTestCase.class);
- private static final String RESOURCES_PATH = "/cartridge-test";
-
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.cartridge.deployment", "smoke"})
- public void testCartridge() throws Exception {
- String cartridgeType = "c0-cartridge-test";
- boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
- cartridgeType + ".json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
- assertTrue(added);
- CartridgeBean bean = (CartridgeBean) restClient.
- getEntity(RestConstants.CARTRIDGES, cartridgeType,
- CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
- assertEquals(bean.getCategory(), "Application");
- assertEquals(bean.getHost(), "qmog.cisco.com");
- for (PropertyBean property : bean.getProperty()) {
- if (property.getName().equals("payload_parameter.CEP_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com");
- } else if (property.getName().equals("payload_parameter.CEP_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com");
- } else if (property.getName().equals("payload_parameter.QTCM_NETWORK_COUNT")) {
- assertEquals(property.getValue(), "1");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin");
- } else if (property.getName().equals("payload_parameter.QTCM_DNS_SEGMENT")) {
- assertEquals(property.getValue(), "test");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_SECURE_PORT")) {
- assertEquals(property.getValue(), "7711");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_PORT")) {
- assertEquals(property.getValue(), "7611");
- } else if (property.getName().equals("payload_parameter.CEP_PORT")) {
- assertEquals(property.getValue(), "7611");
- } else if (property.getName().equals("payload_parameter.MB_PORT")) {
- assertEquals(property.getValue(), "61616");
- }
- }
-
-
- boolean updated = restClient.updateEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
- cartridgeType + "-v1.json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
- assertTrue(updated);
- CartridgeBean updatedBean = (CartridgeBean) restClient.
- getEntity(RestConstants.CARTRIDGES, cartridgeType,
- CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
- assertEquals(updatedBean.getType(), "c0-cartridge-test");
- assertEquals(updatedBean.getCategory(), "Data");
- assertEquals(updatedBean.getHost(), "qmog.cisco.com12");
- for (PropertyBean property : updatedBean.getProperty()) {
- if (property.getName().equals("payload_parameter.CEP_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com123");
- } else if (property.getName().equals("payload_parameter.CEP_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin123");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_IP")) {
- assertEquals(property.getValue(), "octl.qmog.cisco.com123");
- } else if (property.getName().equals("payload_parameter.QTCM_NETWORK_COUNT")) {
- assertEquals(property.getValue(), "3");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_ADMIN_PASSWORD")) {
- assertEquals(property.getValue(), "admin123");
- } else if (property.getName().equals("payload_parameter.QTCM_DNS_SEGMENT")) {
- assertEquals(property.getValue(), "test123");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_SECURE_PORT")) {
- assertEquals(property.getValue(), "7712");
- } else if (property.getName().equals("payload_parameter.MONITORING_SERVER_PORT")) {
- assertEquals(property.getValue(), "7612");
- } else if (property.getName().equals("payload_parameter.CEP_PORT")) {
- assertEquals(property.getValue(), "7612");
- } else if (property.getName().equals("payload_parameter.MB_PORT")) {
- assertEquals(property.getValue(), "61617");
- }
- }
-
- boolean removed = restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType,
- RestConstants.CARTRIDGES_NAME);
- assertTrue(removed);
-
- CartridgeBean beanRemoved = (CartridgeBean) restClient.
- getEntity(RestConstants.CARTRIDGES, cartridgeType,
- CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
- assertNull(beanRemoved);
- }
-
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.cartridge.deployment", "smoke"})
- public void testCartridgeList() throws Exception {
- String cartridgeType1 = "c1-cartridge-test";
- String cartridgeType2 = "c2-cartridge-test";
- boolean added1 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
- cartridgeType1 + ".json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
- assertTrue(added1);
-
- boolean added2 = restClient.addEntity(RESOURCES_PATH + RestConstants.CARTRIDGES_PATH + "/" +
- cartridgeType2 + ".json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
- assertTrue(added2);
-
- Type listType = new TypeToken<ArrayList<CartridgeBean>>() {
- }.getType();
-
- List<CartridgeBean> cartridgeList = (List<CartridgeBean>) restClient.listEntity(RestConstants.CARTRIDGES,
- listType, RestConstants.CARTRIDGES_NAME);
- assertTrue(cartridgeList.size() >= 2);
-
- CartridgeBean bean1 = null;
- for (CartridgeBean cartridgeBean : cartridgeList) {
- if (cartridgeBean.getType().equals(cartridgeType1)) {
- bean1 = cartridgeBean;
- }
- }
- assertNotNull(bean1);
-
- CartridgeBean bean2 = null;
- for (CartridgeBean cartridgeBean : cartridgeList) {
- if (cartridgeBean.getType().equals(cartridgeType1)) {
- bean2 = cartridgeBean;
- }
- }
- assertNotNull(bean2);
-
- boolean removed = restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType1,
- RestConstants.CARTRIDGES_NAME);
- assertTrue(removed);
-
- CartridgeBean beanRemoved = (CartridgeBean) restClient.
- getEntity(RestConstants.CARTRIDGES, cartridgeType1,
- CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
- assertEquals(beanRemoved, null);
-
- removed = restClient.removeEntity(RestConstants.CARTRIDGES, cartridgeType2,
- RestConstants.CARTRIDGES_NAME);
- assertTrue(removed);
-
- beanRemoved = (CartridgeBean) restClient.
- getEntity(RestConstants.CARTRIDGES, cartridgeType2,
- CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
- assertNull(beanRemoved);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/iaas/IaaSProviderTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/iaas/IaaSProviderTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/iaas/IaaSProviderTestCase.java
index ba4a3f6..093ecc8 100644
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/iaas/IaaSProviderTestCase.java
+++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/iaas/IaaSProviderTestCase.java
@@ -19,6 +19,8 @@
package org.apache.stratos.integration.tests.iaas;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.stratos.common.beans.IaasProviderInfoBean;
import org.apache.stratos.integration.tests.StratosIntegrationTest;
import org.testng.annotations.Test;
@@ -34,22 +36,28 @@ import static org.testng.AssertJUnit.assertTrue;
/**
* IaaS provider related test cases
*/
+
+@Test(groups = { "iaas" })
public class IaaSProviderTestCase extends StratosIntegrationTest {
+ private static final Log log = LogFactory.getLog(IaaSProviderTestCase.class);
+
private static final String RESOURCES_PATH = "/api";
private static final String IDENTIFIER = "/iaasProviders";
-
- @Test(timeOut = APPLICATION_TEST_TIMEOUT, groups = {"stratos.cartridge.iaas"})
+
+ @Test(timeOut = DEFAULT_APPLICATION_TEST_TIMEOUT)
public void testListIaaSProviders() throws Exception {
- assertTrue(true);
-
- IaasProviderInfoBean iaasProviderInfo = (IaasProviderInfoBean) restClient.getEntity(RESOURCES_PATH,
- IDENTIFIER, IaasProviderInfoBean.class, "IaaSProvider");
+ log.info("Running IaaSProviderTestCase.testListIaaSProviders test method...");
+ long startTime = System.currentTimeMillis();
+ assertTrue(true);
+
+ IaasProviderInfoBean iaasProviderInfo = (IaasProviderInfoBean) restClient
+ .getEntity(RESOURCES_PATH, IDENTIFIER, IaasProviderInfoBean.class, "IaaSProvider");
assertNotNull(iaasProviderInfo);
List<String> iaasList = iaasProviderInfo.getIaasProviders();
for (String iaas : iaasList) {
- assertThat(iaas, either(containsString("kubernetes")).or(containsString("mock")) );
- }
+ assertThat(iaas, either(containsString("kubernetes")).or(containsString("mock")));
+ }
+ long duration = System.currentTimeMillis() - startTime;
+ log.info(String.format("IaaSProviderTestCase completed in [duration] %s ms", duration));
}
-
-
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/iaas/IaasProviderAttributeTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/iaas/IaasProviderAttributeTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/iaas/IaasProviderAttributeTestCase.java
index b6c4553..d90014e 100644
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/iaas/IaasProviderAttributeTestCase.java
+++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/iaas/IaasProviderAttributeTestCase.java
@@ -28,7 +28,6 @@ import org.apache.stratos.integration.common.RestConstants;
import org.apache.stratos.integration.common.ServerLogClient;
import org.apache.stratos.integration.common.TopologyHandler;
import org.apache.stratos.integration.tests.StratosIntegrationTest;
-import org.apache.stratos.messaging.domain.application.ApplicationStatus;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -39,6 +38,7 @@ import java.util.List;
import static org.testng.Assert.*;
import static org.testng.AssertJUnit.assertTrue;
+@Test(groups = { "iaas" })
public class IaasProviderAttributeTestCase extends StratosIntegrationTest {
private static final Log log = LogFactory.getLog(IaasProviderAttributeTestCase.class);
@@ -51,34 +51,36 @@ public class IaasProviderAttributeTestCase extends StratosIntegrationTest {
private static final String UPDATED_CARTRIDGE = "cartridge-iaasprovider-attribute-test-updated";
private static final String APPLICATION = "app-iaasprovider-attribute-test";
private ServerLogClient serverLogClient;
+ private long startTime;
@BeforeClass
- public void setup () throws Exception {
+ public void setup() throws Exception {
serverLogClient = new ServerLogClient(stratosSecuredBackendURL + "/services/", adminUsername, adminPassword);
}
- @Test(timeOut = IAAS_PROVIDER_TEST_TIMEOUT, groups = {"stratos.cartridge.iaas", "all"})
- public void testIaasProviderAttributes () throws Exception {
+ @Test(timeOut = DEFAULT_APPLICATION_TEST_TIMEOUT)
+ public void testIaasProviderAttributes() throws Exception {
+ log.info("Running IaasProviderAttributeTestCase.testIaasProviderAttributes test method...");
+ startTime = System.currentTimeMillis();
// add autoscaling policy
log.info("Adding autoscaling policy [autoscale policy id] " + AUTOSCALING_POLICY);
boolean addedScalingPolicy = restClient.addEntity(RESOURCES_PATH + RestConstants.
- AUTOSCALING_POLICIES_PATH + "/" + AUTOSCALING_POLICY + ".json",
- RestConstants.AUTOSCALING_POLICIES, RestConstants.AUTOSCALING_POLICIES_NAME);
+ AUTOSCALING_POLICIES_PATH + "/" + AUTOSCALING_POLICY + ".json", RestConstants
+ .AUTOSCALING_POLICIES,
+ RestConstants.AUTOSCALING_POLICIES_NAME);
assertTrue(addedScalingPolicy);
// add network partition
log.info("Adding network partition [network partition id] " + NETWORK_PARTITION);
boolean addedN1 = restClient.addEntity(RESOURCES_PATH + "/network-partitions" + "/" +
- NETWORK_PARTITION + ".json", RestConstants.NETWORK_PARTITIONS,
- RestConstants.NETWORK_PARTITIONS_NAME);
+ NETWORK_PARTITION + ".json", RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(addedN1);
// add deployment policy
log.info("Adding deployment policy [deployment policy id] " + DEPLOYMENT_POLICY);
boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.DEPLOYMENT_POLICIES_PATH + "/" +
- DEPLOYMENT_POLICY + ".json", RestConstants.DEPLOYMENT_POLICIES,
- RestConstants.DEPLOYMENT_POLICIES_NAME);
+ DEPLOYMENT_POLICY + ".json", RestConstants.DEPLOYMENT_POLICIES, RestConstants.DEPLOYMENT_POLICIES_NAME);
assertTrue(addedDep);
// add application policy
@@ -89,8 +91,9 @@ public class IaasProviderAttributeTestCase extends StratosIntegrationTest {
assertTrue(addAppPolicy);
// deploy a default cartridge
- boolean defaultCartridgeAdded = restClient.addEntity(RESOURCES_PATH + "/cartridges/" + CARTRIDGE + ".json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ boolean defaultCartridgeAdded = restClient
+ .addEntity(RESOURCES_PATH + "/cartridges/" + CARTRIDGE + ".json", RestConstants.CARTRIDGES,
+ RestConstants.CARTRIDGES_NAME);
assertTrue("Default cartridge not deployed properly", defaultCartridgeAdded);
// deploy application
@@ -100,16 +103,16 @@ public class IaasProviderAttributeTestCase extends StratosIntegrationTest {
assertEquals(addedApp, true);
// Test Iaas Provider attributes
- CartridgeBean defaultCartridgeBean = (CartridgeBean) restClient.getEntity(RestConstants.CARTRIDGES, CARTRIDGE, CartridgeBean.class,
- RestConstants.CARTRIDGES_NAME);
+ CartridgeBean defaultCartridgeBean = (CartridgeBean) restClient
+ .getEntity(RestConstants.CARTRIDGES, CARTRIDGE, CartridgeBean.class, RestConstants.CARTRIDGES_NAME);
assertEquals(CARTRIDGE, defaultCartridgeBean.getType());
List<IaasProviderBean> iaasProviders = defaultCartridgeBean.getIaasProvider();
assertNotNull(iaasProviders, "No Iaas Providers found in default cartridge definition");
IaasProviderBean mockIaasProvider = getMockIaasProvider(iaasProviders);
assertNotNull(mockIaasProvider, "Mock Iaas Provider not found in default cartridge definition");
- assertNotNull(mockIaasProvider.getProperty(), "No properties found in Iaas Provider " +
- "config of default cartridge definition");
+ assertNotNull(mockIaasProvider.getProperty(),
+ "No properties found in Iaas Provider " + "config of default cartridge definition");
///applications/{applicationId}/deploy/{applicationPolicyId}
log.info("Deploying application [application id] app-iaasprovider-attribute-test using [application policy id] "
@@ -127,14 +130,15 @@ public class IaasProviderAttributeTestCase extends StratosIntegrationTest {
TopologyHandler topologyHandler = TopologyHandler.getInstance();
log.info("Waiting for application status to become ACTIVE...");
- topologyHandler.assertApplicationStatus(applicationBean.getApplicationId(), ApplicationStatus.Active);
+ TopologyHandler.getInstance().assertApplicationActiveStatus(applicationBean.getApplicationId());
// create a ServerLogClientInstance and get logs
boolean found = false;
LogEvent[] logEvents = serverLogClient.getAllLogLines();
if (logEvents.length > 0) {
for (LogEvent log : logEvents) {
- if (!log.getMessage().contains("cartridge_property_value_1") && log.getMessage().contains("cc_property_value_1")) {
+ if (!log.getMessage().contains("cartridge_property_value_1") && log.getMessage()
+ .contains("cc_property_value_1")) {
found = true;
break;
}
@@ -148,8 +152,7 @@ public class IaasProviderAttributeTestCase extends StratosIntegrationTest {
String resourcePathUndeploy = RestConstants.APPLICATIONS + "/app-iaasprovider-attribute-test" +
RestConstants.APPLICATIONS_UNDEPLOY;
- boolean undeployedApp = restClient.undeployEntity(resourcePathUndeploy, RestConstants
- .APPLICATIONS_NAME);
+ boolean undeployedApp = restClient.undeployEntity(resourcePathUndeploy, RestConstants.APPLICATIONS_NAME);
assertTrue(undeployedApp);
log.info("Undeployed application 'app-iaasprovider-attribute-test'");
@@ -159,12 +162,14 @@ public class IaasProviderAttributeTestCase extends StratosIntegrationTest {
RestConstants.APPLICATIONS_UNDEPLOY + "?force=true", RestConstants.APPLICATIONS);
boolean forceUndeployed = topologyHandler.assertApplicationUndeploy("app-iaasprovider-attribute-test");
- assertTrue(String.format("Forceful undeployment failed for the application %s",
- "app-iaasprovider-attribute-test"), forceUndeployed);
+ assertTrue(
+ String.format("Forceful undeployment failed for the application %s", "app-iaasprovider-attribute-test"),
+ forceUndeployed);
// update cartridge
- boolean updated = restClient.updateEntity(RESOURCES_PATH + "/cartridges/" + UPDATED_CARTRIDGE + ".json",
- RestConstants.CARTRIDGES, RestConstants.CARTRIDGES_NAME);
+ boolean updated = restClient
+ .updateEntity(RESOURCES_PATH + "/cartridges/" + UPDATED_CARTRIDGE + ".json", RestConstants.CARTRIDGES,
+ RestConstants.CARTRIDGES_NAME);
assertTrue(updated);
log.info("Updated cartridge 'cartridge-iaasprovider-attribute-test'");
@@ -176,7 +181,7 @@ public class IaasProviderAttributeTestCase extends StratosIntegrationTest {
log.info("Re-deployed application 'app-iaasprovider-attribute-test'");
log.info("Waiting for application status to become ACTIVE...");
- topologyHandler.assertApplicationStatus(applicationBean.getApplicationId(), ApplicationStatus.Active);
+ TopologyHandler.getInstance().assertApplicationActiveStatus(applicationBean.getApplicationId());
logEvents = serverLogClient.getAllLogLines();
found = false;
@@ -193,8 +198,10 @@ public class IaasProviderAttributeTestCase extends StratosIntegrationTest {
}
@AfterClass
- public void tearDown () throws Exception {
+ public void tearDown() throws Exception {
terminateAndRemoveAllArtifacts();
+ long duration = System.currentTimeMillis() - startTime;
+ log.info(String.format("IaasProviderAttributeTestCase completed in [duration] %s ms", duration));
}
private IaasProviderBean getMockIaasProvider(List<IaasProviderBean> iaasProviders) {
@@ -206,7 +213,7 @@ public class IaasProviderAttributeTestCase extends StratosIntegrationTest {
return null;
}
- private void terminateAndRemoveAllArtifacts () throws Exception {
+ private void terminateAndRemoveAllArtifacts() throws Exception {
TopologyHandler topologyHandler = TopologyHandler.getInstance();
http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTestCase.java
index 2ae3207..8862301 100644
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTestCase.java
+++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/ApplicationPolicyTestCase.java
@@ -40,31 +40,37 @@ import static org.testng.AssertJUnit.assertTrue;
/**
* Test to handle Network partition CRUD operations
*/
+@Test(groups = { "policies" })
public class ApplicationPolicyTestCase extends StratosIntegrationTest {
private static final Log log = LogFactory.getLog(ApplicationPolicyTestCase.class);
private static final String RESOURCES_PATH = "/application-policy-test";
+ private long startTime;
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.policy.management", "smoke"})
+ @Test(timeOut = DEFAULT_TEST_TIMEOUT,
+ priority = 1)
public void testApplicationPolicy() throws Exception {
+ log.info("Running ApplicationPolicyTestCase.testApplicationPolicy test method...");
+ startTime = System.currentTimeMillis();
+
String applicationPolicyId = "application-policy-application-policy-test";
boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
- "network-partition-application-policy-test-1" + ".json",
- RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ "network-partition-application-policy-test-1" + ".json", RestConstants.NETWORK_PARTITIONS,
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(addedN1);
boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
- "network-partition-application-policy-test-2" + ".json",
- RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ "network-partition-application-policy-test-2" + ".json", RestConstants.NETWORK_PARTITIONS,
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(addedN2);
boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
- applicationPolicyId + ".json",
- RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME);
+ applicationPolicyId + ".json", RestConstants.APPLICATION_POLICIES,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertTrue(addedDep);
ApplicationPolicyBean bean = (ApplicationPolicyBean) restClient.
- getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
- ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
+ getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId, ApplicationPolicyBean.class,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertEquals(bean.getId(), applicationPolicyId);
assertEquals(bean.getAlgorithm(), "one-after-another",
String.format("The expected algorithm %s is not found in %s", "one-after-another",
@@ -85,33 +91,34 @@ public class ApplicationPolicyTestCase extends StratosIntegrationTest {
assertEquals(propertyBean.getValue(),
"network-partition-application-policy-test-1,network-partition-application-policy-test-2",
String.format("The networkPartitionGroups algorithm %s is not found in %s",
- "network-partition-application-policy-test-1, network-partition-application-policy-test-2",
- applicationPolicyId));
+ "network-partition-application-policy-test-1, "
+ + "network-partition-application-policy-test-2", applicationPolicyId));
algoFound = true;
}
}
if (!algoFound) {
- assertNull(String.format("The networkPartitionGroups property is not found in %s",
- applicationPolicyId));
+ assertNull(String.format("The networkPartitionGroups property is not found in %s", applicationPolicyId));
}
- boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+ boolean removedNet = restClient
+ .removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1",
+ RestConstants.NETWORK_PARTITIONS_NAME);
//Trying to remove the used network partition
assertFalse(removedNet);
- boolean removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
- applicationPolicyId, RestConstants.APPLICATION_POLICIES_NAME);
+ boolean removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertTrue(removedDep);
ApplicationPolicyBean beanRemovedDep = (ApplicationPolicyBean) restClient.
- getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId,
- ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
+ getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId, ApplicationPolicyBean.class,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertNull(beanRemovedDep);
- boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+ boolean removedN1 = restClient
+ .removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1",
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(removedN1);
NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClient.
@@ -119,8 +126,9 @@ public class ApplicationPolicyTestCase extends StratosIntegrationTest {
NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
assertNull(beanRemovedN1);
- boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-application-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+ boolean removedN2 = restClient
+ .removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-2",
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(removedN2);
NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClient.
@@ -129,37 +137,37 @@ public class ApplicationPolicyTestCase extends StratosIntegrationTest {
assertNull(beanRemovedN2);
}
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.policy.management", "smoke"})
+ @Test(timeOut = DEFAULT_TEST_TIMEOUT,
+ priority = 2)
public void testApplicationPolicyList() throws Exception {
String applicationPolicyId1 = "application-policy-application-policy-test-1";
String applicationPolicyId2 = "application-policy-application-policy-test-2";
boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
- "network-partition-application-policy-test-1" + ".json",
- RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ "network-partition-application-policy-test-1" + ".json", RestConstants.NETWORK_PARTITIONS,
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(addedN1);
boolean addedN2 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
- "network-partition-application-policy-test-2" + ".json",
- RestConstants.NETWORK_PARTITIONS, RestConstants.NETWORK_PARTITIONS_NAME);
+ "network-partition-application-policy-test-2" + ".json", RestConstants.NETWORK_PARTITIONS,
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(addedN2);
boolean addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
- applicationPolicyId1 + ".json",
- RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME);
+ applicationPolicyId1 + ".json", RestConstants.APPLICATION_POLICIES,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertTrue(addedDep);
addedDep = restClient.addEntity(RESOURCES_PATH + RestConstants.APPLICATION_POLICIES_PATH + "/" +
- applicationPolicyId2 + ".json",
- RestConstants.APPLICATION_POLICIES, RestConstants.APPLICATION_POLICIES_NAME);
+ applicationPolicyId2 + ".json", RestConstants.APPLICATION_POLICIES,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertTrue(addedDep);
Type listType = new TypeToken<ArrayList<ApplicationPolicyBean>>() {
}.getType();
List<ApplicationPolicyBean> applicationPolicyList = (List<ApplicationPolicyBean>) restClient.
- listEntity(RestConstants.APPLICATION_POLICIES,
- listType, RestConstants.APPLICATION_POLICIES_NAME);
+ listEntity(RestConstants.APPLICATION_POLICIES, listType, RestConstants.APPLICATION_POLICIES_NAME);
assertTrue(applicationPolicyList.size() >= 2);
ApplicationPolicyBean bean1 = null;
@@ -178,31 +186,33 @@ public class ApplicationPolicyTestCase extends StratosIntegrationTest {
}
assertNotNull(bean2);
- boolean removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
- applicationPolicyId1, RestConstants.APPLICATION_POLICIES_NAME);
+ boolean removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId1,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertTrue(removedDep);
ApplicationPolicyBean beanRemovedDep = (ApplicationPolicyBean) restClient.
- getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId1,
- ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
+ getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId1, ApplicationPolicyBean.class,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertNull(beanRemovedDep);
- boolean removedNet = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+ boolean removedNet = restClient
+ .removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1",
+ RestConstants.NETWORK_PARTITIONS_NAME);
//Trying to remove the used network partition
assertFalse(removedNet);
- removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES,
- applicationPolicyId2, RestConstants.APPLICATION_POLICIES_NAME);
+ removedDep = restClient.removeEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId2,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertTrue(removedDep);
beanRemovedDep = (ApplicationPolicyBean) restClient.
- getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId2,
- ApplicationPolicyBean.class, RestConstants.APPLICATION_POLICIES_NAME);
+ getEntity(RestConstants.APPLICATION_POLICIES, applicationPolicyId2, ApplicationPolicyBean.class,
+ RestConstants.APPLICATION_POLICIES_NAME);
assertNull(beanRemovedDep);
- boolean removedN1 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-application-policy-test-1", RestConstants.NETWORK_PARTITIONS_NAME);
+ boolean removedN1 = restClient
+ .removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-1",
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(removedN1);
NetworkPartitionBean beanRemovedN1 = (NetworkPartitionBean) restClient.
@@ -210,13 +220,16 @@ public class ApplicationPolicyTestCase extends StratosIntegrationTest {
NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
assertNull(beanRemovedN1);
- boolean removedN2 = restClient.removeEntity(RestConstants.NETWORK_PARTITIONS,
- "network-partition-application-policy-test-2", RestConstants.NETWORK_PARTITIONS_NAME);
+ boolean removedN2 = restClient
+ .removeEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-2",
+ RestConstants.NETWORK_PARTITIONS_NAME);
assertTrue(removedN2);
NetworkPartitionBean beanRemovedN2 = (NetworkPartitionBean) restClient.
getEntity(RestConstants.NETWORK_PARTITIONS, "network-partition-application-policy-test-2",
NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
assertNull(beanRemovedN2);
+ long duration = System.currentTimeMillis() - startTime;
+ log.info(String.format("IaaSProviderTestCase completed in [duration] %s ms", duration));
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTestCase.java
index 24da49f..a6fc43b 100644
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTestCase.java
+++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/AutoscalingPolicyTestCase.java
@@ -35,11 +35,12 @@ import static org.testng.AssertJUnit.*;
/**
* Test to handle autoscaling policy CRUD operations
*/
+@Test(groups = { "policies" })
public class AutoscalingPolicyTestCase extends StratosIntegrationTest {
private static final Log log = LogFactory.getLog(AutoscalingPolicyTestCase.class);
private static final String RESOURCES_PATH = "/autoscaling-policy-test";
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.policy.management", "smoke"})
+ @Test(timeOut = DEFAULT_TEST_TIMEOUT)
public void testAutoscalingPolicy() throws Exception {
String policyId = "autoscaling-policy-autoscaling-policy-test";
boolean added = restClient
@@ -87,7 +88,7 @@ public class AutoscalingPolicyTestCase extends StratosIntegrationTest {
policyId), beanRemoved);
}
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.policy.management", "smoke"})
+ @Test(timeOut = DEFAULT_TEST_TIMEOUT)
public void testAutoscalingPolicyList() throws Exception {
String policyId1 = "autoscaling-policy-autoscaling-policy-test-1";
String policyId2 = "autoscaling-policy-autoscaling-policy-test-2";
http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTestCase.java
index 866132a..854c84d 100644
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTestCase.java
+++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/DeploymentPolicyTestCase.java
@@ -40,11 +40,12 @@ import static org.testng.AssertJUnit.*;
/**
* Test to handle Deployment policy CRUD operations
*/
+@Test(groups = { "policies" })
public class DeploymentPolicyTestCase extends StratosIntegrationTest {
private static final Log log = LogFactory.getLog(DeploymentPolicyTestCase.class);
private static final String RESOURCES_PATH = "/deployment-policy-test";
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.policy.management", "smoke"})
+ @Test(timeOut = DEFAULT_TEST_TIMEOUT)
public void testDeploymentPolicy() throws Exception {
String deploymentPolicyId = "deployment-policy-deployment-policy-test";
boolean addedN1 = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
@@ -166,7 +167,7 @@ public class DeploymentPolicyTestCase extends StratosIntegrationTest {
assertNull(beanRemovedN2);
}
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.policy.management", "smoke"})
+ @Test(timeOut = DEFAULT_TEST_TIMEOUT)
public void testDeploymentPolicyList() throws Exception {
String deploymentPolicyId1 = "deployment-policy-deployment-policy-test-1";
String deploymentPolicyId2 = "deployment-policy-deployment-policy-test-2";
@@ -258,4 +259,4 @@ public class DeploymentPolicyTestCase extends StratosIntegrationTest {
DeploymentPolicyBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
assertNull(beanRemovedN2);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTestCase.java
index ce8e4f5..9ddbafc 100644
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTestCase.java
+++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/policies/NetworkPartitionTestCase.java
@@ -38,11 +38,12 @@ import static org.testng.AssertJUnit.*;
/**
* Test to handle Network partition CRUD operations
*/
+@Test(groups = { "policies" })
public class NetworkPartitionTestCase extends StratosIntegrationTest {
private static final Log log = LogFactory.getLog(NetworkPartitionTestCase.class);
private static final String RESOURCES_PATH = "/network-partition-test";
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.policy.management", "smoke"})
+ @Test(timeOut = DEFAULT_TEST_TIMEOUT)
public void testNetworkPartition() throws Exception {
String networkPartitionId = "network-partition-network-partition-test";
boolean added = restClient.addEntity(RESOURCES_PATH + RestConstants.NETWORK_PARTITIONS_PATH + "/" +
@@ -89,7 +90,7 @@ public class NetworkPartitionTestCase extends StratosIntegrationTest {
assertNull(beanRemoved);
}
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"stratos.policy.management", "smoke"})
+ @Test(timeOut = DEFAULT_TEST_TIMEOUT)
public void testNetworkPartitionList() throws Exception {
String networkPartitionId1 = "network-partition-network-partition-test-1";
String networkPartitionId2 = "network-partition-network-partition-test-2";
@@ -144,4 +145,4 @@ public class NetworkPartitionTestCase extends StratosIntegrationTest {
NetworkPartitionBean.class, RestConstants.NETWORK_PARTITIONS_NAME);
assertNull(beanRemoved);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTestCase.java
index e64926f..e9696e1 100644
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTestCase.java
+++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/TenantTestCase.java
@@ -28,15 +28,15 @@ import static junit.framework.Assert.assertTrue;
/**
* Handling users
*/
+@Test(groups = { "users", "disabled" })
public class TenantTestCase extends StratosIntegrationTest {
private static final String RESOURCES_PATH = "/user-test";
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"user.management", "smoke", "disabled"})
+ @Test(timeOut = DEFAULT_TEST_TIMEOUT)
public void addUser() throws Exception {
String tenantId = "tenant-1";
boolean addedUser1 = restClient.addEntity(RESOURCES_PATH + "/" +
- tenantId + ".json",
- RestConstants.USERS, RestConstants.USERS_NAME);
+ tenantId + ".json", RestConstants.USERS, RestConstants.USERS_NAME);
assertTrue(addedUser1);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a22f27a6/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/UserTestCase.java
----------------------------------------------------------------------
diff --git a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/UserTestCase.java b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/UserTestCase.java
index 24d8a5b..4ee721f 100644
--- a/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/UserTestCase.java
+++ b/products/stratos/modules/integration/test-integration/src/test/java/org/apache/stratos/integration/tests/users/UserTestCase.java
@@ -35,11 +35,12 @@ import static org.testng.AssertJUnit.*;
/**
* Handling users
*/
+@Test(groups = { "users" })
public class UserTestCase extends StratosIntegrationTest {
private static final Log log = LogFactory.getLog(UserTestCase.class);
private static final String RESOURCES_PATH = "/user-test";
- @Test(timeOut = GLOBAL_TEST_TIMEOUT, groups = {"user.management", "smoke"})
+ @Test(timeOut = DEFAULT_TEST_TIMEOUT)
public void addUser() throws Exception {
String userId = "user-1";
boolean addedUser1 = restClient.addEntity(RESOURCES_PATH + "/" +
@@ -101,4 +102,4 @@ public class UserTestCase extends StratosIntegrationTest {
}
assertNull(bean1);
}
-}
\ No newline at end of file
+}