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