aboutsummaryrefslogtreecommitdiffstats
path: root/test-apis-ci
diff options
context:
space:
mode:
authorsiddharth0905 <siddharth.singh4@amdocs.com>2019-01-21 12:02:57 +0530
committersiddharth0905 <siddharth.singh4@amdocs.com>2019-01-21 14:25:45 +0530
commit7d8c592bdd302fe59fe12b134af941c2dd6ab058 (patch)
tree93e7edc52de79df21a2f327db23778f9fa012403 /test-apis-ci
parent6503c16035a75687c9edabd54449eeb4ec744906 (diff)
Operation on PNF
Operation on PNF Change-Id: I51448659eb5e730f42f30c6b5978809cfa1c9b6c Issue-ID: SDC-2054 Signed-off-by: siddharth0905 <siddharth.singh4@amdocs.com>
Diffstat (limited to 'test-apis-ci')
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java135
-rw-r--r--test-apis-ci/src/main/resources/ci/testSuites/resource.xml23
2 files changed, 120 insertions, 38 deletions
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java
index 8b2343c6c9..f26f175f9d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/interfaceoperation/InterfaceOperationsTest.java
@@ -4,9 +4,11 @@ import static org.testng.AssertJUnit.fail;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
-import fj.data.Either;
+
import java.util.HashMap;
import java.util.Map;
+
+import fj.data.Either;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
@@ -42,8 +44,11 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
private static Service service;
private static Resource resource;
+ private static Resource pnfResource;
private String resourceInterfaceUniqueId;
private String resourceOperationUniqueId;
+ private String pnfResourceInterfaceUniqueId;
+ private String pnfResourceOperationUniqueId;
private String serviceInterfaceUniqueId;
private String serviceOperationUniqueId;
@@ -68,9 +73,18 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
fail("Error creating default resource");
}
resource = createDefaultResourceEither.left().value();
+
+ // Create default PNF resource
+ Either<Resource, RestResponse> createDefaultPNFResourceEither =
+ AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true);
+ if (createDefaultPNFResourceEither.isRight()) {
+ fail("Error creating default pnf resource");
+ }
+ pnfResource = createDefaultPNFResourceEither.left().value();
}
- private Map<String, Object> buildInterfaceDefinitionForResource() {
+ private Map<String, Object> buildInterfaceDefinitionForResource(String resourceInterfaceUniqueId,
+ String resourceOperationUniqueId) {
Operation operation = new Operation();
operation.setName("TestOperationOnResource");
operation.setWorkflowId("WorkflowId");
@@ -85,10 +99,11 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
ListDataDefinition<OperationOutputDefinition> operationOutputDefinitionList = new ListDataDefinition<>();
operationOutputDefinitionList.add(createOperationOutputDefinition("TestOutput1"));
operation.setOutputs(operationOutputDefinitionList);
- return buildInterfaceDefinitionMap(operation, "TestInterface", resourceInterfaceUniqueId, resourceOperationUniqueId);
+ return buildInterfaceDefinitionMap(operation, "TestInterface", resourceInterfaceUniqueId,
+ resourceOperationUniqueId);
}
- private Map<String, Object> buildInterfaceDefinitionOfGlobalTypeForResource() {
+ private Map<String, Object> buildInterfaceDefinitionOfGlobalTypeForResource(Resource resource) {
Operation operation = new Operation();
operation.setName("create");
operation.setWorkflowId("WorkflowId");
@@ -103,7 +118,8 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
ListDataDefinition<OperationOutputDefinition> operationOutputDefinitionList = new ListDataDefinition<>();
operationOutputDefinitionList.add(createOperationOutputDefinition("TestOutput1"));
operation.setOutputs(operationOutputDefinitionList);
- return buildInterfaceDefinitionMap(operation,"tosca.interfaces.node.lifecycle.Standard", resourceInterfaceUniqueId, resourceOperationUniqueId);
+ return buildInterfaceDefinitionMap(operation, "tosca.interfaces.node.lifecycle.Standard",
+ resourceInterfaceUniqueId, resourceOperationUniqueId);
}
private OperationInputDefinition createOperationInputDefinition(String name, String inputId) {
@@ -123,8 +139,9 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
return operationOutputDefinition;
}
- private Map<String, Object> buildInterfaceDefinitionMap(Operation operation, String interfaceType, String interfaceId,
- String operationId) {
+ private Map<String, Object> buildInterfaceDefinitionMap(Operation operation, String interfaceType,
+ String interfaceId,
+ String operationId) {
if (operationId != null) {
operation.setUniqueId(operationId);
}
@@ -164,14 +181,16 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
operation.setWorkflowId("WorkflowId");
operation.setWorkflowVersionId("workflowVersionId");
operation.setWorkflowAssociationType("NONE");
- return buildInterfaceDefinitionMap(operation,"TestInterface", serviceInterfaceUniqueId, serviceOperationUniqueId);
+ return buildInterfaceDefinitionMap(operation, "TestInterface", serviceInterfaceUniqueId,
+ serviceOperationUniqueId);
}
@Test
public void addInterfaceOperationsOnResource() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
- .addInterfaceOperations(resource, buildInterfaceDefinitionForResource(),
- user);
+ .addInterfaceOperations(resource,
+ buildInterfaceDefinitionForResource(resourceInterfaceUniqueId, resourceOperationUniqueId),
+ user);
logger.info("addInterfaceOperationsOnResource Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
String interfaceDefinitionStr = ResponseParser.getListFromJson(restResponse, INTERFACES).get(0).toString();
@@ -184,8 +203,8 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
@Test(dependsOnMethods = "addInterfaceOperationsOnResource")
public void getInterfaceOperationsFromResource() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
- .getInterfaceOperations(resource, resourceInterfaceUniqueId,
- resourceOperationUniqueId, user);
+ .getInterfaceOperations(resource, resourceInterfaceUniqueId,
+ resourceOperationUniqueId, user);
logger.info("getInterfaceOperationsFromResource Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
}
@@ -193,26 +212,70 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
@Test(dependsOnMethods = "getInterfaceOperationsFromResource")
public void updateInterfaceOperationsOnResource() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
- .updateInterfaceOperations(resource, buildInterfaceDefinitionForResource(),
- user);
+ .updateInterfaceOperations(resource,
+ buildInterfaceDefinitionForResource(resourceInterfaceUniqueId, resourceOperationUniqueId),
+ user);
logger.info("updateInterfaceOperationsOnResource Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
}
- /*@Test(dependsOnMethods = "updateInterfaceOperationsOnResource")
+ @Test(dependsOnMethods = "updateInterfaceOperationsOnResource")
public void deleteInterfaceOperationsFromResource() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
- .deleteInterfaceOperations(resource, resourceInterfaceUniqueId,
- resourceOperationUniqueId, user);
+ .deleteInterfaceOperations(resource, resourceInterfaceUniqueId,
+ resourceOperationUniqueId, user);
logger.info("deleteInterfaceOperationsFromResource Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
- }*/
+ }
+
+ @Test
+ public void addInterfaceOperationsOnPNFResource() throws Exception {
+ RestResponse restResponse = InterfaceOperationsRestUtils
+ .addInterfaceOperations(pnfResource, buildInterfaceDefinitionForResource(pnfResourceInterfaceUniqueId,
+ pnfResourceOperationUniqueId), user);
+ logger.info("addInterfaceOperationsOnPNFResource Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ String interfaceDefinitionStr = ResponseParser.getListFromJson(restResponse, INTERFACES).get(0).toString();
+ InterfaceDefinition interfaceDefinition =
+ ResponseParser.convertInterfaceDefinitionResponseToJavaObject(interfaceDefinitionStr);
+ pnfResourceInterfaceUniqueId = interfaceDefinition.getUniqueId();
+ pnfResourceOperationUniqueId =
+ interfaceDefinition.getOperationsMap().keySet().stream().findFirst().orElse(null);
+ }
+
+ @Test(dependsOnMethods = "addInterfaceOperationsOnPNFResource")
+ public void getInterfaceOperationsFromPNFResource() throws Exception {
+ RestResponse restResponse = InterfaceOperationsRestUtils
+ .getInterfaceOperations(pnfResource, pnfResourceInterfaceUniqueId,
+ pnfResourceOperationUniqueId, user);
+ logger.info("getInterfaceOperationsFromPNFResource Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "getInterfaceOperationsFromPNFResource")
+ public void updateInterfaceOperationsOnPNFResource() throws Exception {
+ RestResponse restResponse = InterfaceOperationsRestUtils
+ .updateInterfaceOperations(pnfResource,
+ buildInterfaceDefinitionForResource(pnfResourceInterfaceUniqueId,
+ pnfResourceOperationUniqueId), user);
+ logger.info("updateInterfaceOperationsOnPNFResource Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "updateInterfaceOperationsOnPNFResource")
+ public void deleteInterfaceOperationsFromPNFResource() throws Exception {
+ RestResponse restResponse = InterfaceOperationsRestUtils
+ .deleteInterfaceOperations(pnfResource, pnfResourceInterfaceUniqueId,
+ pnfResourceOperationUniqueId, user);
+ logger.info("deleteInterfaceOperationsFromPNFResource Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
@Test
public void addInterfaceOperationsOnService() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
- .addInterfaceOperations(service, buildInterfaceDefinitionForService(),
- user);
+ .addInterfaceOperations(service, buildInterfaceDefinitionForService(),
+ user);
logger.info("addInterfaceOperationsOnService Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
String interfaceDefinitionStr = ResponseParser.getListFromJson(restResponse, INTERFACES).get(0).toString();
@@ -225,8 +288,8 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
@Test(dependsOnMethods = "addInterfaceOperationsOnService")
public void getInterfaceOperationsFromService() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
- .getInterfaceOperations(service, serviceInterfaceUniqueId,
- serviceOperationUniqueId, user);
+ .getInterfaceOperations(service, serviceInterfaceUniqueId,
+ serviceOperationUniqueId, user);
logger.info("getInterfaceOperationsFromService Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
}
@@ -234,8 +297,8 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
@Test(dependsOnMethods = "getInterfaceOperationsFromService")
public void updateInterfaceOperationsOnService() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
- .updateInterfaceOperations(service, buildInterfaceDefinitionForService(),
- user);
+ .updateInterfaceOperations(service, buildInterfaceDefinitionForService(),
+ user);
logger.info("updateInterfaceOperations Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
}
@@ -243,17 +306,18 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
@Test(dependsOnMethods = "updateInterfaceOperationsOnService")
public void deleteInterfaceOperationsFromService() throws Exception {
RestResponse restResponse = InterfaceOperationsRestUtils
- .deleteInterfaceOperations(service, serviceInterfaceUniqueId,
- serviceOperationUniqueId, user);
+ .deleteInterfaceOperations(service, serviceInterfaceUniqueId,
+ serviceOperationUniqueId, user);
logger.info("deleteInterfaceOperations Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
}
@Test
public void addInterfaceOperationsOfGlobalTypeOnResource() throws Exception {
- RestResponse restResponse = InterfaceOperationsRestUtils
- .addInterfaceOperations(resource, buildInterfaceDefinitionOfGlobalTypeForResource(),
- user);
+ RestResponse restResponse =
+ InterfaceOperationsRestUtils.addInterfaceOperations(resource,
+ buildInterfaceDefinitionOfGlobalTypeForResource(resource), user);
+
logger.info("addInterfaceOperationsOnResource Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
String interfaceDefinitionStr = ResponseParser.getListFromJson(restResponse, INTERFACES).get(0).toString();
@@ -261,4 +325,17 @@ public class InterfaceOperationsTest extends ComponentBaseTest {
ResponseParser.convertInterfaceDefinitionResponseToJavaObject(interfaceDefinitionStr);
}
+ @Test
+ public void addInterfaceOperationsOfGlobalTypeOnPNFResource() throws Exception {
+ RestResponse restResponse =
+ InterfaceOperationsRestUtils.addInterfaceOperations(pnfResource,
+ buildInterfaceDefinitionOfGlobalTypeForResource(pnfResource), user);
+
+ logger.info("addInterfaceOperationsOnPNFResource Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ String interfaceDefinitionStr = ResponseParser.getListFromJson(restResponse, INTERFACES).get(0).toString();
+ InterfaceDefinition interfaceDefinition =
+ ResponseParser.convertInterfaceDefinitionResponseToJavaObject(interfaceDefinitionStr);
+ }
+
}
diff --git a/test-apis-ci/src/main/resources/ci/testSuites/resource.xml b/test-apis-ci/src/main/resources/ci/testSuites/resource.xml
index 05080b25ac..313fbb26db 100644
--- a/test-apis-ci/src/main/resources/ci/testSuites/resource.xml
+++ b/test-apis-ci/src/main/resources/ci/testSuites/resource.xml
@@ -354,15 +354,20 @@
<include name="undoCheckOutProductByPm"/>
</methods>
</class>
- <class name="org.openecomp.sdc.ci.tests.execute.interfaceoperation.InterfaceOperationsTest">
- <methods>
- <include name="addInterfaceOperationsOfGlobalTypeOnResource"/>
- <include name="addInterfaceOperationsOnResource"/>
- <include name="getInterfaceOperationsFromResource"/>
- <include name="updateInterfaceOperationsOnResource"/>
- <include name="deleteInterfaceOperationsFromResource"/>
- </methods>
- </class>
+ <class name="org.openecomp.sdc.ci.tests.execute.interfaceoperation.InterfaceOperationsTest">
+ <methods>
+ <include name="addInterfaceOperationsOfGlobalTypeOnResource"/>
+ <include name="addInterfaceOperationsOnResource"/>
+ <include name="getInterfaceOperationsFromResource"/>
+ <include name="updateInterfaceOperationsOnResource"/>
+ <include name="deleteInterfaceOperationsFromResource"/>
+ <include name="addInterfaceOperationsOfGlobalTypeOnPNFResource"/>
+ <include name="addInterfaceOperationsOnPNFResource"/>
+ <include name="getInterfaceOperationsFromPNFResource"/>
+ <include name="updateInterfaceOperationsOnPNFResource"/>
+ <include name="deleteInterfaceOperationsFromPNFResource"/>
+ </methods>
+ </class>
<!-- Product tests end-->
</classes>
</test> <!-- Test -->