Search in sources :

Example 6 with VnfResource

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");
}
Also used : VnfResource(org.onap.so.bpmn.core.domain.VnfResource) HashMap(java.util.HashMap) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 7 with VnfResource

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");
}
Also used : VnfResource(org.onap.so.bpmn.core.domain.VnfResource) HashMap(java.util.HashMap) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 8 with VnfResource

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());
}
Also used : VnfResource(org.onap.so.bpmn.core.domain.VnfResource) GroupResource(org.onap.so.bpmn.core.domain.GroupResource) VnfcResource(org.onap.so.bpmn.core.domain.VnfcResource) VnfResource(org.onap.so.bpmn.core.domain.VnfResource) Resource(org.onap.so.bpmn.core.domain.Resource) ModuleResource(org.onap.so.bpmn.core.domain.ModuleResource) Test(org.junit.Test)

Example 9 with VnfResource

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());
}
Also used : VnfResource(org.onap.so.bpmn.core.domain.VnfResource) Test(org.junit.Test)

Example 10 with VnfResource

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());
}
Also used : VnfResource(org.onap.so.bpmn.core.domain.VnfResource) Test(org.junit.Test)

Aggregations

VnfResource (org.onap.so.bpmn.core.domain.VnfResource)20 Test (org.junit.Test)16 Resource (org.onap.so.bpmn.core.domain.Resource)11 GroupResource (org.onap.so.bpmn.core.domain.GroupResource)10 HashMap (java.util.HashMap)8 VnfcResource (org.onap.so.bpmn.core.domain.VnfcResource)7 BaseTest (org.onap.so.BaseTest)6 ModuleResource (org.onap.so.bpmn.core.domain.ModuleResource)6 ArrayList (java.util.ArrayList)3 Gson (com.google.gson.Gson)2 JsonArray (com.google.gson.JsonArray)2 JsonElement (com.google.gson.JsonElement)2 JsonObject (com.google.gson.JsonObject)2 List (java.util.List)2 Map (java.util.Map)2 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)2 WorkflowException (org.onap.so.bpmn.core.WorkflowException)2 AllottedResource (org.onap.so.bpmn.core.domain.AllottedResource)2 HomingSolution (org.onap.so.bpmn.core.domain.HomingSolution)2 NetworkResource (org.onap.so.bpmn.core.domain.NetworkResource)2