Search in sources :

Example 6 with VnfcCustomization

use of org.onap.so.db.catalog.beans.VnfcCustomization in project so by onap.

the class QueryVnfcs method toString.

@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    int i = 1;
    for (VnfcCustomization o : vnfcCustomizations) {
        sb.append(i).append("\t");
        if (!first) {
            sb.append("\n");
        }
        first = false;
        sb.append(o);
    }
    return sb.toString();
}
Also used : VnfcCustomization(org.onap.so.db.catalog.beans.VnfcCustomization)

Example 7 with VnfcCustomization

use of org.onap.so.db.catalog.beans.VnfcCustomization in project so by onap.

the class QueryVnfcs method JSON2.

@Override
public String JSON2(boolean isArray, boolean isEmbed) {
    StringBuilder sb = new StringBuilder();
    if (!isEmbed && isArray) {
        sb.append("{");
    }
    if (isArray) {
        sb.append("\"vnfcs\": [");
    }
    Map<String, String> valueMap = new HashMap<>();
    String sep = "";
    boolean first = true;
    for (VnfcCustomization o : vnfcCustomizations) {
        if (first)
            sb.append("\n");
        first = false;
        put(valueMap, "MODEL_NAME", o.getModelName());
        put(valueMap, "MODEL_UUID", o.getModelUUID());
        put(valueMap, "MODEL_INVARIANT_ID", o.getModelInvariantUUID());
        put(valueMap, "MODEL_VERSION", o.getModelVersion());
        put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID());
        if (isJSONValid(o.getResourceInput())) {
            put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
        }
        sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
        sep = ",\n";
    }
    if (!first)
        sb.append("\n");
    if (isArray)
        sb.append("]");
    if (!isEmbed && isArray)
        sb.append("}");
    return sb.toString();
}
Also used : HashMap(java.util.HashMap) VnfcCustomization(org.onap.so.db.catalog.beans.VnfcCustomization)

Example 8 with VnfcCustomization

use of org.onap.so.db.catalog.beans.VnfcCustomization in project so by onap.

the class QueryGroupsTest method createList.

private List<VnfcInstanceGroupCustomization> createList() {
    VnfcCustomization vnfcCustomization = new VnfcCustomization();
    vnfcCustomization.setModelCustomizationUUID("test");
    vnfcCustomization.setModelVersion("test");
    vnfcCustomization.setModelInvariantUUID("test");
    vnfcCustomization.setModelName("test");
    VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup();
    vfcInstanceGroup.setModelName("test");
    vfcInstanceGroup.setModelUUID("test");
    vfcInstanceGroup.setModelInvariantUUID("test");
    vfcInstanceGroup.setModelVersion("test");
    VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = new VnfcInstanceGroupCustomization();
    vnfcInstanceGroupCustomization.setVnfcCustomizations(Arrays.asList(vnfcCustomization));
    vnfcInstanceGroupCustomization.setInstanceGroup(vfcInstanceGroup);
    vfcInstanceGroup.setVnfcInstanceGroupCustomizations(Arrays.asList(vnfcInstanceGroupCustomization));
    return Arrays.asList(vnfcInstanceGroupCustomization);
}
Also used : VFCInstanceGroup(org.onap.so.db.catalog.beans.VFCInstanceGroup) VnfcCustomization(org.onap.so.db.catalog.beans.VnfcCustomization) VnfcInstanceGroupCustomization(org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization)

Example 9 with VnfcCustomization

use of org.onap.so.db.catalog.beans.VnfcCustomization in project so by onap.

the class QueryVnfcsTest method createList.

private List<VnfcCustomization> createList() {
    List<VnfcCustomization> customizations = new ArrayList();
    VnfcCustomization c1 = new VnfcCustomization();
    c1.setModelName("model1");
    c1.setModelUUID("uuid1");
    c1.setModelInvariantUUID("inv1");
    c1.setModelVersion("v1");
    c1.setModelCustomizationUUID("cust1");
    c1.setResourceInput("resourceInput1");
    VnfcCustomization c2 = new VnfcCustomization();
    c2.setModelName("model2");
    c2.setModelUUID("uuid2");
    c2.setModelInvariantUUID("inv2");
    c2.setModelVersion("v2");
    c2.setModelCustomizationUUID("cust2");
    c2.setResourceInput("resourceInput2");
    customizations.add(c1);
    customizations.add(c2);
    return customizations;
}
Also used : ArrayList(java.util.ArrayList) VnfcCustomization(org.onap.so.db.catalog.beans.VnfcCustomization)

Example 10 with VnfcCustomization

use of org.onap.so.db.catalog.beans.VnfcCustomization in project so by onap.

the class BBInputSetupMapperLayerTest method testmapCatalogConfigurationToConfiguration.

@Test
public void testmapCatalogConfigurationToConfiguration() {
    String modelCustUUID = "modelCustomizationUUID";
    String modelInvariantUUID = "modelInvariantUUID";
    String modelVersionUUID = "modelUUID";
    String policyName = "policyName";
    ModelInfoConfiguration expected = new ModelInfoConfiguration();
    expected.setModelCustomizationId(modelCustUUID);
    expected.setModelInvariantId(modelInvariantUUID);
    expected.setModelVersionId(modelVersionUUID);
    expected.setPolicyName(policyName);
    ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization();
    configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID);
    configurationResourceCustomization.setConfigurationResource(new ConfigurationResource());
    configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID);
    configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID);
    CvnfcConfigurationCustomization policyNameTable = new CvnfcConfigurationCustomization();
    policyNameTable.setCvnfcCustomization(new CvnfcCustomization());
    policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
    policyNameTable.setPolicyName(policyName);
    ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable);
    assertThat(actual, sameBeanAs(expected));
}
Also used : ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration) CvnfcCustomization(org.onap.so.db.catalog.beans.CvnfcCustomization) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) VnfcCustomization(org.onap.so.db.catalog.beans.VnfcCustomization) ConfigurationResource(org.onap.so.db.catalog.beans.ConfigurationResource) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization) Test(org.junit.Test)

Aggregations

VnfcCustomization (org.onap.so.db.catalog.beans.VnfcCustomization)15 Test (org.junit.Test)7 CvnfcCustomization (org.onap.so.db.catalog.beans.CvnfcCustomization)7 ArrayList (java.util.ArrayList)6 Transactional (org.springframework.transaction.annotation.Transactional)6 BaseTest (org.onap.so.db.catalog.BaseTest)5 VfModule (org.onap.so.db.catalog.beans.VfModule)5 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)5 ConfigurationResource (org.onap.so.db.catalog.beans.ConfigurationResource)4 CvnfcConfigurationCustomization (org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization)4 VnfResource (org.onap.so.db.catalog.beans.VnfResource)4 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)4 IEntityDetails (org.onap.sdc.tosca.parser.api.IEntityDetails)3 Metadata (org.onap.sdc.toscaparser.api.elements.Metadata)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 ConfigurationResourceCustomization (org.onap.so.db.catalog.beans.ConfigurationResourceCustomization)2 VFCInstanceGroup (org.onap.so.db.catalog.beans.VFCInstanceGroup)2 VnfcInstanceGroupCustomization (org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1