use of org.onap.so.bpmn.core.domain.VnfResource in project so by onap.
the class ResourceRequestBuilderTest method getResourceInputTest.
@Test
public void getResourceInputTest() throws Exception {
VnfResource resource = new VnfResource();
resource.setResourceType(ResourceType.VNF);
resource.setResourceInput("{\"a\":\"key|default_value\"}");
HashMap serviceInput = new HashMap();
serviceInput.put("key", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null);
assertEquals(stringObjectMap.get("a"), "value");
}
use of org.onap.so.bpmn.core.domain.VnfResource in project so by onap.
the class ResourceRequestBuilderTest method getResourceInputDefaultValueTest.
@Test
public void getResourceInputDefaultValueTest() throws Exception {
VnfResource resource = new VnfResource();
resource.setResourceType(ResourceType.VNF);
resource.setResourceInput("{\"a\":\"key|default_value\"}");
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(resource, serviceInput, null);
assertEquals(stringObjectMap.get("a"), "default_value");
}
use of org.onap.so.bpmn.core.domain.VnfResource in project so by onap.
the class InstnaceResourceListTest method testSimpleVFResourceWithGroup.
@Test
public void testSimpleVFResourceWithGroup() throws IOException {
String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
VnfResource vnfResource = new VnfResource();
vnfResource.setResourceInput("{\"a\":\"ipaddress|127.0.0.1\"}");
createGroupKeyResource(vnfResource);
List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
Assert.assertEquals(2, instanceResourceList.size());
Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType());
Assert.assertEquals("wan", instanceResourceList.get(1).getModelInfo().getModelName());
}
use of org.onap.so.bpmn.core.domain.VnfResource in project so by onap.
the class DecomposeJsonUtilTest method testJsonToVnfResource.
@Test
public void testJsonToVnfResource() throws JsonDecomposingException {
vnfResource = createVnfResourceData();
VnfResource vnfResourceObj = DecomposeJsonUtil.jsonToVnfResource(vnfResource.toString());
assertEquals(vnfResource.getResourceId(), vnfResourceObj.getResourceId());
}
use of org.onap.so.bpmn.core.domain.VnfResource in project so by onap.
the class DecomposeJsonUtilTest method testJsonToVnfResource_JsonDecomposingException.
@Test
public void testJsonToVnfResource_JsonDecomposingException() throws JsonDecomposingException {
expectedException.expect(JsonDecomposingException.class);
// wrong object
networkResource = createNetworkResourceData();
VnfResource vnfResourceObj = DecomposeJsonUtil.jsonToVnfResource(networkResource.toString());
}
Aggregations