summaryrefslogtreecommitdiffstats
path: root/test-apis-ci/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'test-apis-ci/src/main')
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/capability/CapabilitiesTest.java313
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CapabilityDetails.java13
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CapabilityRestUtils.java19
3 files changed, 301 insertions, 44 deletions
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/capability/CapabilitiesTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/capability/CapabilitiesTest.java
index ecdb48619b..18e3997bab 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/capability/CapabilitiesTest.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/capability/CapabilitiesTest.java
@@ -16,36 +16,45 @@
package org.openecomp.sdc.ci.tests.capability;
+import fj.data.Either;
import org.junit.Rule;
import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.ComponentBaseTest;
import org.openecomp.sdc.ci.tests.datatypes.CapabilityDetails;
-import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.rest.BaseRestUtils;
import org.openecomp.sdc.ci.tests.utils.rest.CapabilityRestUtils;
-import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
+import static org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils.getResourceObject;
import static org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils.getServiceObject;
+import static org.testng.AssertJUnit.fail;
public class CapabilitiesTest extends ComponentBaseTest {
@Rule
- public static final TestName name = new TestName();
+ public static TestName name = new TestName();
- private ServiceReqDetails component;
- private User user = null;
+ private static User user = null;
+ private static Service service;
+ private static Resource resource;
+ private static Resource pnfResource;
public CapabilitiesTest() {
super(name, CapabilitiesTest.class.getName());
@@ -54,63 +63,297 @@ public class CapabilitiesTest extends ComponentBaseTest {
@BeforeTest
public void init() throws Exception {
user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
- component = ElementFactory.getDefaultService();
- component.setName("comp_cap" + Math.random());
- ServiceRestUtils.createService(component, user);
+
+ // Create default service
+ Either<Service, RestResponse> createDefaultServiceEither =
+ AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
+ if (createDefaultServiceEither.isRight()) {
+ fail("Error creating default service");
+ }
+ service = createDefaultServiceEither.left().value();
+
+ // Create default resource
+ Either<Resource, RestResponse> createDefaultResourceEither =
+ AtomicOperationUtils.createResourceByType(ResourceTypeEnum.VF, UserRoleEnum.DESIGNER, true);
+ if (createDefaultResourceEither.isRight()) {
+ fail("Error creating default resource");
+ }
+ resource = createDefaultResourceEither.left().value();
+
+ // Create default PNF resource
+ Either<Resource, RestResponse> createDefaultPNFResourceEither =
+ AtomicOperationUtils.createResourceByType(ResourceTypeEnum.PNF, UserRoleEnum.DESIGNER, true);
+ if (createDefaultPNFResourceEither.isRight()) {
+ fail("Error creating default pnf resource");
+ }
+ pnfResource = createDefaultPNFResourceEither.left().value();
}
@Test
- public void createCapabilityTest() throws Exception {
+ public void createCapabilityOnServiceTest() throws Exception {
CapabilityDetails capability = createCapability();
- RestResponse restResponse = CapabilityRestUtils.createCapability(component.getUniqueId(),
- Collections.singletonList(capability), user);
- logger.info("createCapability Response Code:" + restResponse.getErrorCode());
+ RestResponse restResponse = CapabilityRestUtils.createCapability(service, Collections.singletonList(capability),
+ user);
+ logger.info("createCapability On Service Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "createCapabilityOnServiceTest")
+ public void updateCapabilityOnServiceTest() throws Exception {
+
+ CapabilityDetails capability = createCapability();
+ capability.setMaxOccurrences("10");
+ capability.setMinOccurrences("4");
+ RestResponse restResponse = CapabilityRestUtils.updateCapability(service, Collections.singletonList(capability),
+ user);
+ logger.info("updateCapability On Service Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "updateCapabilityOnServiceTest")
+ public void getCapabilityFromServiceTest() throws Exception {
+ Service serviceObject = getServiceObject(service.getUniqueId());
+
+ List<org.openecomp.sdc.be.model.CapabilityDefinition> capabilityDefinitionList = serviceObject.getCapabilities()
+ .values().stream().flatMap(Collection::stream).collect(Collectors.toList());
+
+ RestResponse restResponse = CapabilityRestUtils.getCapability(service,
+ capabilityDefinitionList.get(0).getUniqueId(), user);
+ logger.info("getCapabilityTest from Service Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
}
+ @Test(dependsOnMethods = "getCapabilityFromServiceTest")
+ public void deleteCapabilityFromServiceTest() throws Exception {
+ Service serviceObject = getServiceObject(service.getUniqueId());
+
+ List<org.openecomp.sdc.be.model.CapabilityDefinition> capabilityDefinitionList = serviceObject.getCapabilities()
+ .values().stream().flatMap(Collection::stream).collect(Collectors.toList());
+ RestResponse restResponse = CapabilityRestUtils.deleteCapability(service,
+ capabilityDefinitionList.get(0).getUniqueId(), user);
+ logger.info("deleteCapabilityTest from Service Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
- @Test(dependsOnMethods = "createCapabilityTest")
- public void updateCapabilityTest() throws Exception {
+ @Test
+ public void createCapabilityWithPropertiesOnServiceTest() throws Exception {
+
+ CapabilityDetails capability = createCapability();
+ List<ComponentInstanceProperty> properties = new ArrayList<>();
+ ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
+ instanceProperty.setType("prop_type");
+ instanceProperty.setName("prop_name");
+ instanceProperty.setDescription("prop_description");
+ instanceProperty.setSchema(new SchemaDefinition());
+ properties.add(instanceProperty);
+ capability.setProperties(properties);
+ RestResponse restResponse = CapabilityRestUtils.createCapability(service, Collections.singletonList(capability),
+ user);
+ logger.info("createCapability On Service Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "createCapabilityWithPropertiesOnServiceTest")
+ public void updateCapabilityWithPropertiesOnServiceTest() throws Exception {
CapabilityDetails capability = createCapability();
capability.setMaxOccurrences("10");
capability.setMinOccurrences("4");
- RestResponse restResponse = CapabilityRestUtils.updateCapability(component.getUniqueId(),
- Collections.singletonList(capability), user);
- logger.info("updateCapability Response Code:" + restResponse.getErrorCode());
+
+ List<ComponentInstanceProperty> properties = new ArrayList<>();
+ ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
+ instanceProperty.setType("prop_type_updated");
+ instanceProperty.setName("prop_name_updated");
+ instanceProperty.setDescription("prop_description_prop_desc");
+ instanceProperty.setSchema(new SchemaDefinition());
+ properties.add(instanceProperty);
+ capability.setProperties(properties);
+ RestResponse restResponse = CapabilityRestUtils.updateCapability(service, Collections.singletonList(capability),
+ user);
+ logger.info("updateCapability On Service Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test
+ public void createCapabilityOnVfTest() throws Exception {
+
+ CapabilityDetails capability = createCapability();
+ RestResponse restResponse = CapabilityRestUtils.createCapability(resource, Collections.singletonList(capability),
+ user);
+ logger.info("createCapability On Vf Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "createCapabilityOnVfTest")
+ public void updateCapabilityOnVfTest() throws Exception {
+
+ CapabilityDetails capability = createCapability();
+ capability.setMaxOccurrences("10");
+ capability.setMinOccurrences("4");
+ RestResponse restResponse = CapabilityRestUtils.updateCapability(resource, Collections.singletonList(capability),
+ user);
+ logger.info("updateCapability On Vf Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "updateCapabilityOnVfTest")
+ public void getCapabilityFromVfTest() throws Exception {
+ Resource resourceObject = getResourceObject(resource.getUniqueId());
+
+ List<org.openecomp.sdc.be.model.CapabilityDefinition> capabilityDefinitionList = resourceObject.getCapabilities()
+ .values().stream().flatMap(Collection::stream).collect(Collectors.toList());
+
+ RestResponse restResponse = CapabilityRestUtils.getCapability(resource,
+ capabilityDefinitionList.get(0).getUniqueId(), user);
+ logger.info("getCapabilityTest from Vf Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "getCapabilityFromVfTest")
+ public void deleteCapabilityFromVfTest() throws Exception {
+ Resource resourceObject = getResourceObject(resource.getUniqueId());
+
+ List<org.openecomp.sdc.be.model.CapabilityDefinition> capabilityDefinitionList = resourceObject.getCapabilities()
+ .values().stream().flatMap(Collection::stream).collect(Collectors.toList());
+
+ RestResponse restResponse = CapabilityRestUtils.deleteCapability(resource,
+ capabilityDefinitionList.get(0).getUniqueId(), user);
+ logger.info("deleteCapabilityTest from Vf Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test
+ public void createCapabilityWithPropertiesOnVfTest() throws Exception {
+
+ CapabilityDetails capability = createCapability();
+ List<ComponentInstanceProperty> properties = new ArrayList<>();
+ ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
+ instanceProperty.setType("prop_type");
+ instanceProperty.setName("prop_name");
+ instanceProperty.setDescription("prop_description");
+ instanceProperty.setSchema(new SchemaDefinition());
+ properties.add(instanceProperty);
+ capability.setProperties(properties);
+ RestResponse restResponse = CapabilityRestUtils.createCapability(resource, Collections.singletonList(capability),
+ user);
+ logger.info("createCapability On Vf Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
}
- @Test(dependsOnMethods = "updateCapabilityTest")
- public void getCapabilityTest() throws Exception {
- Service service = getServiceObject(component.getUniqueId());
+ @Test(dependsOnMethods = "createCapabilityWithPropertiesOnVfTest")
+ public void updateCapabilityWithPropertiesOnVfTest() throws Exception {
- List<org.openecomp.sdc.be.model.CapabilityDefinition> capabilityDefinitionList = service.getCapabilities().values()
- .stream().flatMap(Collection::stream).collect(Collectors.toList());
+ CapabilityDetails capability = createCapability();
+ capability.setMaxOccurrences("10");
+ capability.setMinOccurrences("4");
- RestResponse restResponse = CapabilityRestUtils.getCapability(component.getUniqueId(),
- capabilityDefinitionList.get(0).getUniqueId(), user);
- logger.info("getCapabilityTest Response Code:" + restResponse.getErrorCode());
+ List<ComponentInstanceProperty> properties = new ArrayList<>();
+ ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
+ instanceProperty.setType("prop_type_updated");
+ instanceProperty.setName("prop_name_updated");
+ instanceProperty.setDescription("prop_description_prop_desc");
+ instanceProperty.setSchema(new SchemaDefinition());
+ properties.add(instanceProperty);
+ capability.setProperties(properties);
+ RestResponse restResponse = CapabilityRestUtils.updateCapability(resource, Collections.singletonList(capability),
+ user);
+ logger.info("updateCapability On Vf Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
}
- @Test(dependsOnMethods = "getCapabilityTest")
- public void deleteCapabilityTest() throws Exception {
- Service service = getServiceObject(component.getUniqueId());
- List<org.openecomp.sdc.be.model.CapabilityDefinition> capabilityDefinitionList = service.getCapabilities().values()
- .stream().flatMap(Collection::stream).collect(Collectors.toList());
+ @Test
+ public void createCapabilityOnPnfTest() throws Exception {
+
+ CapabilityDetails capability = createCapability();
+ RestResponse restResponse = CapabilityRestUtils.createCapability(pnfResource, Collections.singletonList(capability),
+ user);
+ logger.info("createCapability On Pnf Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "createCapabilityOnPnfTest")
+ public void updateCapabilityOnPnfTest() throws Exception {
- RestResponse restResponse = CapabilityRestUtils.deleteCapability(component.getUniqueId(),
- capabilityDefinitionList.get(0).getUniqueId(), user);
- logger.info("deleteCapabilityTest Response Code:" + restResponse.getErrorCode());
+ CapabilityDetails capability = createCapability();
+ capability.setMaxOccurrences("10");
+ capability.setMinOccurrences("4");
+ RestResponse restResponse = CapabilityRestUtils.updateCapability(pnfResource, Collections.singletonList(capability),
+ user);
+ logger.info("updateCapability On Pnf Response Code:" + restResponse.getErrorCode());
Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
}
- private CapabilityDetails createCapability() {
- CapabilityDetails capabilityDetails = new CapabilityDetails();
+ @Test(dependsOnMethods = "updateCapabilityOnPnfTest")
+ public void getCapabilityFromPnfTest() throws Exception {
+ Resource pnfResourceObject = getResourceObject(pnfResource.getUniqueId());
+
+ List<org.openecomp.sdc.be.model.CapabilityDefinition> capabilityDefinitionList = pnfResourceObject.getCapabilities()
+ .values().stream().flatMap(Collection::stream).collect(Collectors.toList());
+
+ RestResponse restResponse = CapabilityRestUtils.getCapability(pnfResource,
+ capabilityDefinitionList.get(0).getUniqueId(), user);
+ logger.info("getCapabilityTest from Pnf Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "getCapabilityFromPnfTest")
+ public void deleteCapabilityFromPnfTest() throws Exception {
+ Resource pnfResourceObject = getResourceObject(pnfResource.getUniqueId());
+
+ List<org.openecomp.sdc.be.model.CapabilityDefinition> capabilityDefinitionList = pnfResourceObject.getCapabilities()
+ .values().stream().flatMap(Collection::stream).collect(Collectors.toList());
+
+ RestResponse restResponse = CapabilityRestUtils.deleteCapability(pnfResource,
+ capabilityDefinitionList.get(0).getUniqueId(), user);
+ logger.info("deleteCapabilityTest from Pnf Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test
+ public void createCapabilityWithPropertiesOnPnfTest() throws Exception {
+
+ CapabilityDetails capability = createCapability();
+ List<ComponentInstanceProperty> properties = new ArrayList<>();
+ ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
+ instanceProperty.setType("prop_type");
+ instanceProperty.setName("prop_name");
+ instanceProperty.setDescription("prop_description");
+ instanceProperty.setSchema(new SchemaDefinition());
+ properties.add(instanceProperty);
+ capability.setProperties(properties);
+ RestResponse restResponse = CapabilityRestUtils.createCapability(pnfResource, Collections.singletonList(capability),
+ user);
+ logger.info("createCapability On Pnf Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+ @Test(dependsOnMethods = "createCapabilityWithPropertiesOnPnfTest")
+ public void updateCapabilityWithPropertiesOnPnfTest() throws Exception {
+
+ CapabilityDetails capability = createCapability();
+ capability.setMaxOccurrences("10");
+ capability.setMinOccurrences("4");
+
+ List<ComponentInstanceProperty> properties = new ArrayList<>();
+ ComponentInstanceProperty instanceProperty = new ComponentInstanceProperty();
+ instanceProperty.setType("prop_type_updated");
+ instanceProperty.setName("prop_name_updated");
+ instanceProperty.setDescription("prop_description_prop_desc");
+ instanceProperty.setSchema(new SchemaDefinition());
+ properties.add(instanceProperty);
+ capability.setProperties(properties);
+ RestResponse restResponse = CapabilityRestUtils.updateCapability(pnfResource,
+ Collections.singletonList(capability), user);
+ logger.info("updateCapability On Pnf Response Code:" + restResponse.getErrorCode());
+ Assert.assertEquals((int) restResponse.getErrorCode(), BaseRestUtils.STATUS_CODE_SUCCESS);
+ }
+
+
+ private CapabilityDetails createCapability() {
+ CapabilityDetails capabilityDetails = new CapabilityDetails();
capabilityDetails.setName("cap" + Math.random());
capabilityDetails.setType("tosca.capabilities.network.Bindable");
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CapabilityDetails.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CapabilityDetails.java
index 954a16a63d..bbed28b654 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CapabilityDetails.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CapabilityDetails.java
@@ -16,11 +16,16 @@
package org.openecomp.sdc.ci.tests.datatypes;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+
+import java.util.List;
+
public class CapabilityDetails {
private String name;
private String type;
private String maxOccurrences;
private String minOccurrences;
+ private List<ComponentInstanceProperty> properties;
public String getName() {
return name;
@@ -53,4 +58,12 @@ public class CapabilityDetails {
public void setMinOccurrences(String minOccurrences) {
this.minOccurrences = minOccurrences;
}
+
+ public List<ComponentInstanceProperty> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(List<ComponentInstanceProperty> properties) {
+ this.properties = properties;
+ }
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CapabilityRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CapabilityRestUtils.java
index 1959aa8b9a..488ed249f5 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CapabilityRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/CapabilityRestUtils.java
@@ -17,6 +17,8 @@
package org.openecomp.sdc.ci.tests.utils.rest;
import com.google.gson.Gson;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.ci.tests.api.Urls;
import org.openecomp.sdc.ci.tests.config.Config;
@@ -27,14 +29,13 @@ import java.util.List;
public class CapabilityRestUtils extends BaseRestUtils {
private static Gson gson = new Gson();
- private static final String COMPONENT_TYPE = "services";
- public static RestResponse createCapability(String componentId,
+ public static RestResponse createCapability(Component component,
List<CapabilityDetails> capabilityDetailsList,
User user) throws Exception{
Config config = Config.instance();
String url = String.format(Urls.CREATE_CAPABILITY, config.getCatalogBeHost(), config.getCatalogBePort(),
- COMPONENT_TYPE, componentId);
+ ComponentTypeEnum.findParamByType(component.getComponentType()), component.getUniqueId());
String data = "{ \"capabilities\" : {" + "\"" +capabilityDetailsList.get(0).getType()+ "\"" +" : "
+ gson.toJson(capabilityDetailsList) + " } }";
@@ -42,12 +43,12 @@ public class CapabilityRestUtils extends BaseRestUtils {
return sendPost(url, data , user.getUserId(), acceptHeaderData);
}
- public static RestResponse updateCapability(String componentId,
+ public static RestResponse updateCapability(Component component,
List<CapabilityDetails> capabilityDetailsList,
User user) throws Exception{
Config config = Config.instance();
String url = String.format(Urls.UPDATE_CAPABILITY, config.getCatalogBeHost(), config.getCatalogBePort(),
- COMPONENT_TYPE, componentId);
+ ComponentTypeEnum.findParamByType(component.getComponentType()), component.getUniqueId());
String data = "{ \"capabilities\" : {" + "\"" +capabilityDetailsList.get(0).getType()+ "\"" +" : "
+ gson.toJson(capabilityDetailsList) + " } }";
@@ -55,21 +56,21 @@ public class CapabilityRestUtils extends BaseRestUtils {
return sendPost(url, data , user.getUserId(), acceptHeaderData);
}
- public static RestResponse deleteCapability(String componentId,
+ public static RestResponse deleteCapability(Component component,
String requirementId,
User user) throws Exception{
Config config = Config.instance();
String url = String.format(Urls.DELETE_CAPABILITY, config.getCatalogBeHost(), config.getCatalogBePort(),
- COMPONENT_TYPE, componentId, requirementId);
+ ComponentTypeEnum.findParamByType(component.getComponentType()), component.getUniqueId(), requirementId);
return sendDelete(url, user.getUserId());
}
- public static RestResponse getCapability(String componentId,
+ public static RestResponse getCapability(Component component,
String requirementId,
User user) throws Exception{
Config config = Config.instance();
String url = String.format(Urls.GET_CAPABILITY, config.getCatalogBeHost(), config.getCatalogBePort(),
- COMPONENT_TYPE, componentId, requirementId);
+ ComponentTypeEnum.findParamByType(component.getComponentType()), component.getUniqueId(), requirementId);
return sendDelete(url, user.getUserId());
}