use of org.onap.so.serviceinstancebeans.Resources in project so by onap.
the class GenericCDSProcessingBBTest method getUserParams.
private Service getUserParams() {
Service service = new Service();
Resources resources = new Resources();
resources.setVnfs(createVnfList());
service.setResources(resources);
return service;
}
use of org.onap.so.serviceinstancebeans.Resources in project so by onap.
the class BBInputSetupTest method testGetVfModulesByKey.
@Test
public void testGetVfModulesByKey() throws IOException {
org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
Resources resources = serviceMacro.getResources();
VfModules expectedVfModule = resources.getVnfs().get(0).getVfModules().get(0);
assertEquals(expectedVfModule, SPY_bbInputSetup.getVfModulesByKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", resources));
}
use of org.onap.so.serviceinstancebeans.Resources in project so by onap.
the class ConfigureInstanceParamsForVnfTest method testPopulateInstanceParamsByCustomizationId.
@Test
public void testPopulateInstanceParamsByCustomizationId() throws Exception {
Service service = new Service();
Resources resources = new Resources();
resources.setVnfs(createVnfs());
service.setResources(resources);
when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(Optional.of(service));
JsonObject jsonObject = new JsonObject();
// No instance name is passed
configureInstanceParamsForVnf.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_1_CUSTOMIZATION_ID, null);
assertEquals("xyz", jsonObject.get("param-1").getAsString());
assertEquals("123", jsonObject.get("param-2").getAsString());
assertEquals("CCC", jsonObject.get("param-3").getAsString());
}
use of org.onap.so.serviceinstancebeans.Resources in project so by onap.
the class ConfigureInstanceParamsForVnfTest method testPopulateInstanceParamsByInstanceName.
@Test
public void testPopulateInstanceParamsByInstanceName() throws Exception {
Service service = new Service();
Resources resources = new Resources();
resources.setVnfs(createVnfs());
service.setResources(resources);
when(extractServiceFromUserParameters.getServiceFromRequestUserParams(any())).thenReturn(Optional.of(service));
JsonObject jsonObject = new JsonObject();
configureInstanceParamsForVnf.populateInstanceParams(jsonObject, new ArrayList<>(), VNF_2_CUSTOMIZATION_ID, VNF_2_INSTANCE_NAME);
assertEquals("abc", jsonObject.get("param-1").getAsString());
assertEquals("999", jsonObject.get("param-2").getAsString());
assertEquals("AAA", jsonObject.get("param-3").getAsString());
}
use of org.onap.so.serviceinstancebeans.Resources in project so by onap.
the class BBInputSetupTest method testVnfsByKey.
@Test
public void testVnfsByKey() throws IOException {
org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class);
Resources resources = serviceMacro.getResources();
Vnfs expectedVnf = resources.getVnfs().get(0);
assertEquals(expectedVnf, SPY_bbInputSetup.findVnfsByKey("ab153b6e-c364-44c0-bef6-1f2982117f04", resources));
}
Aggregations