Search in sources :

Example 6 with Resources

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;
}
Also used : Service(org.onap.so.serviceinstancebeans.Service) Resources(org.onap.so.serviceinstancebeans.Resources)

Example 7 with Resources

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));
}
Also used : VfModules(org.onap.so.serviceinstancebeans.VfModules) Resources(org.onap.so.serviceinstancebeans.Resources) File(java.io.File) Test(org.junit.Test)

Example 8 with 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());
}
Also used : Service(org.onap.so.serviceinstancebeans.Service) JsonObject(com.google.gson.JsonObject) Resources(org.onap.so.serviceinstancebeans.Resources) Test(org.junit.Test)

Example 9 with Resources

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());
}
Also used : Service(org.onap.so.serviceinstancebeans.Service) JsonObject(com.google.gson.JsonObject) Resources(org.onap.so.serviceinstancebeans.Resources) Test(org.junit.Test)

Example 10 with Resources

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));
}
Also used : Resources(org.onap.so.serviceinstancebeans.Resources) File(java.io.File) Vnfs(org.onap.so.serviceinstancebeans.Vnfs) Test(org.junit.Test)

Aggregations

Resources (org.onap.so.serviceinstancebeans.Resources)12 Test (org.junit.Test)8 Service (org.onap.so.serviceinstancebeans.Service)7 JsonObject (com.google.gson.JsonObject)4 File (java.io.File)4 VfModules (org.onap.so.serviceinstancebeans.VfModules)3 Vnfs (org.onap.so.serviceinstancebeans.Vnfs)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 SerializationFeature (com.fasterxml.jackson.databind.SerializationFeature)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 UUID (java.util.UUID)1 StringUtils (org.apache.commons.lang3.StringUtils)1 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)1 JavaDelegate (org.camunda.bpm.engine.delegate.JavaDelegate)1 Pair (org.javatuples.Pair)1