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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations