Search in sources :

Example 1 with MapperException

use of org.onap.so.client.exception.MapperException in project so by onap.

the class GeneralTopologyObjectMapperTest method buildVfModuleInformationTest_withModel.

@Test
public void buildVfModuleInformationTest_withModel() {
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("TestVfModuleId");
    ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
    modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID");
    modelInfoVfModule.setModelName("testModelName");
    modelInfoVfModule.setModelVersion("testModelVersion");
    modelInfoVfModule.setModelUUID("testModelUUID");
    modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID");
    vfModule.setModelInfoVfModule(modelInfoVfModule);
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    GenericVnf genericVnf = new GenericVnf();
    genericVnf.setVnfId("TestVnfId");
    RequestContext requestContext = new RequestContext();
    RequestParameters requestParameters = new RequestParameters();
    requestParameters.setUsePreload(true);
    requestContext.setRequestParameters(requestParameters);
    GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
    try {
        gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, true);
    } catch (MapperException ex) {
    }
    assertNotNull(gcRequestInput);
    assertNotNull(vfModule.getModelInfoVfModule());
    assertNotNull(gcRequestInput.getOnapModelInformation());
    assertEquals(modelInfoVfModule.getModelInvariantUUID(), gcRequestInput.getOnapModelInformation().getModelInvariantUuid());
    assertEquals(modelInfoVfModule.getModelName(), gcRequestInput.getOnapModelInformation().getModelName());
    assertEquals(modelInfoVfModule.getModelVersion(), gcRequestInput.getOnapModelInformation().getModelVersion());
    assertEquals(modelInfoVfModule.getModelUUID(), gcRequestInput.getOnapModelInformation().getModelUuid());
    assertEquals(modelInfoVfModule.getModelCustomizationUUID(), gcRequestInput.getOnapModelInformation().getModelCustomizationUuid());
    assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
    assertNotNull(gcRequestInput.getVfModuleId());
    assertTrue(gcRequestInput.getFromPreload());
}
Also used : ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) MapperException(org.onap.so.client.exception.MapperException) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) GenericResourceApiVfmoduleinformationVfModuleInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) RequestParameters(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters) Test(org.junit.Test)

Example 2 with MapperException

use of org.onap.so.client.exception.MapperException in project so by onap.

the class GeneralTopologyObjectMapperTest method buildVfModuleInformationTest_withNoModelNoRequestContext.

@Test
public void buildVfModuleInformationTest_withNoModelNoRequestContext() {
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("TestVfModuleId");
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    GenericVnf genericVnf = new GenericVnf();
    genericVnf.setVnfId("TestVnfId");
    GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
    try {
        gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, null, false);
    } catch (MapperException ex) {
    }
    assertNotNull(gcRequestInput);
    assertNull(vfModule.getModelInfoVfModule());
    assertNull(gcRequestInput.getOnapModelInformation());
    assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
    assertNotNull(gcRequestInput.getVfModuleId());
    assertTrue(gcRequestInput.getFromPreload());
}
Also used : GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) MapperException(org.onap.so.client.exception.MapperException) GenericResourceApiVfmoduleinformationVfModuleInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) Test(org.junit.Test)

Example 3 with MapperException

use of org.onap.so.client.exception.MapperException in project so by onap.

the class GeneralTopologyObjectMapperTest method buildVfModuleInformationTest_withNoModelIsFromPreload.

@Test
public void buildVfModuleInformationTest_withNoModelIsFromPreload() {
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("TestVfModuleId");
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    GenericVnf genericVnf = new GenericVnf();
    genericVnf.setVnfId("TestVnfId");
    RequestContext requestContext = new RequestContext();
    RequestParameters requestParameters = new RequestParameters();
    requestParameters.setUsePreload(true);
    requestContext.setRequestParameters(requestParameters);
    GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
    try {
        gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, false);
    } catch (MapperException ex) {
    }
    assertNotNull(gcRequestInput);
    assertNull(vfModule.getModelInfoVfModule());
    assertNull(gcRequestInput.getOnapModelInformation());
    assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
    assertNotNull(gcRequestInput.getVfModuleId());
    assertTrue(gcRequestInput.getFromPreload());
}
Also used : GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) MapperException(org.onap.so.client.exception.MapperException) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) GenericResourceApiVfmoduleinformationVfModuleInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) RequestParameters(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters) Test(org.junit.Test)

Example 4 with MapperException

use of org.onap.so.client.exception.MapperException in project so by onap.

the class GeneralTopologyObjectMapperTest method buildVfModuleInformationTest_withNoModelIsNotFromPreload.

@Test
public void buildVfModuleInformationTest_withNoModelIsNotFromPreload() {
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("TestVfModuleId");
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    GenericVnf genericVnf = new GenericVnf();
    genericVnf.setVnfId("TestVnfId");
    RequestContext requestContext = new RequestContext();
    RequestParameters requestParameters = new RequestParameters();
    requestParameters.setUsePreload(false);
    requestContext.setRequestParameters(requestParameters);
    GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
    try {
        gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, false);
    } catch (MapperException ex) {
    }
    assertNotNull(gcRequestInput);
    assertNull(vfModule.getModelInfoVfModule());
    assertNull(gcRequestInput.getOnapModelInformation());
    assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
    assertNotNull(gcRequestInput.getVfModuleId());
    assertFalse(gcRequestInput.getFromPreload());
}
Also used : GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) MapperException(org.onap.so.client.exception.MapperException) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) GenericResourceApiVfmoduleinformationVfModuleInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) RequestParameters(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters) Test(org.junit.Test)

Example 5 with MapperException

use of org.onap.so.client.exception.MapperException in project so by onap.

the class GeneralTopologyObjectMapperTest method buildVfModuleInformationTest_withNoModelNoRequestParameters.

@Test
public void buildVfModuleInformationTest_withNoModelNoRequestParameters() {
    VfModule vfModule = new VfModule();
    vfModule.setVfModuleId("TestVfModuleId");
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("serviceInstanceId");
    GenericVnf genericVnf = new GenericVnf();
    genericVnf.setVnfId("TestVnfId");
    RequestContext requestContext = new RequestContext();
    GenericResourceApiVfmoduleinformationVfModuleInformation gcRequestInput = null;
    try {
        gcRequestInput = genObjMapper.buildVfModuleInformation(vfModule, genericVnf, serviceInstance, requestContext, false);
    } catch (MapperException ex) {
    }
    assertNotNull(gcRequestInput);
    assertNull(vfModule.getModelInfoVfModule());
    assertNull(gcRequestInput.getOnapModelInformation());
    assertEquals(vfModule.getVfModuleId(), gcRequestInput.getVfModuleId());
    assertNotNull(gcRequestInput.getVfModuleId());
    assertTrue(gcRequestInput.getFromPreload());
}
Also used : GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) MapperException(org.onap.so.client.exception.MapperException) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) GenericResourceApiVfmoduleinformationVfModuleInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation) ModelInfoVfModule(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) Test(org.junit.Test)

Aggregations

MapperException (org.onap.so.client.exception.MapperException)8 GenericResourceApiVfmoduleinformationVfModuleInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation)6 Test (org.junit.Test)5 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)5 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)5 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)5 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)5 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)5 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)4 RequestParameters (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 PathNotFoundException (com.jayway.jsonpath.PathNotFoundException)1 GenericResourceApiOnapmodelinformationOnapModelInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation)1 BadResponseException (org.onap.so.client.exception.BadResponseException)1 SDNCRequest (org.onap.so.client.sdnc.beans.SDNCRequest)1 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)1