aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller/src/main/java')
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java2
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java6
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java6
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java4
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java59
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java111
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java24
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java10
8 files changed, 71 insertions, 151 deletions
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java
index 6cfe90b92c..e069989aeb 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java
@@ -399,7 +399,7 @@ public class ASDCConfiguration implements IConfiguration {
MsoJsonProperties msoProp;
try {
- List <String> result = new ArrayList <String> ();
+ List <String> result = new ArrayList<>();
msoProp = new MsoPropertiesFactory ().getMsoJsonProperties (MSO_PROP_ASDC);
if (msoProp.getJsonRootNode ().get (PARAMETER_PATTERN) != null) {
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java
index 251888e9e2..430bd10892 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java
@@ -41,7 +41,7 @@ import org.openecomp.mso.properties.MsoPropertiesFactory;
public class ASDCGlobalController {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
- private Map <String,ASDCController> controllers = new HashMap <String,ASDCController> ();
+ private Map <String,ASDCController> controllers = new HashMap<>();
private MsoJsonProperties msoProp= null;
@@ -78,7 +78,7 @@ public class ASDCGlobalController {
/**
* Check that controllers list needs to be updated or not.
- * @param return true if the list has been updated
+ * return true if the list has been updated
*/
private boolean updateControllersListIfNeeded () {
boolean updateNeeded=false;
@@ -149,7 +149,7 @@ public class ASDCGlobalController {
}
public void closeASDC () {
- List<String> controllerToRemove = new LinkedList<String>();
+ List<String> controllerToRemove = new LinkedList<>();
for (ASDCController controller : controllers.values()) {
try {
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java
index be86574137..c9bde98da8 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java
@@ -47,7 +47,7 @@ public final class VfModuleStructure {
vfModuleMetadata = vfmoduleMetadata;
parentVfResource = vfParentResource;
- artifactsMap = new HashMap<String, List<VfModuleArtifact>>();
+ artifactsMap = new HashMap<>();
for (String artifactUUID:this.vfModuleMetadata.getArtifacts()) {
if (vfParentResource.getArtifactsMapByUUID().containsKey(artifactUUID)) {
@@ -64,7 +64,7 @@ public final class VfModuleStructure {
artifactsMap.get(vfModuleArtifact.getArtifactInfo().getArtifactType()).add(vfModuleArtifact);
} else {
- List<VfModuleArtifact> nestedList = new LinkedList<VfModuleArtifact>();
+ List<VfModuleArtifact> nestedList = new LinkedList<>();
nestedList.add(vfModuleArtifact);
artifactsMap.put(vfModuleArtifact.getArtifactInfo().getArtifactType(), nestedList);
@@ -73,7 +73,7 @@ public final class VfModuleStructure {
public List<VfModuleArtifact> getOrderedArtifactList() {
- List <VfModuleArtifact> artifactsList = new LinkedList <VfModuleArtifact>();
+ List <VfModuleArtifact> artifactsList = new LinkedList<>();
artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT));
artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_ENV));
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java
index c2879a4df2..e9e39d7660 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java
@@ -101,8 +101,8 @@ public final class VfResourceStructure {
resourceInstance=resourceinstance;
- vfModulesStructureList = new LinkedList<VfModuleStructure>();
- artifactsMapByUUID = new HashMap<String, VfModuleArtifact>();
+ vfModulesStructureList = new LinkedList<>();
+ artifactsMapByUUID = new HashMap<>();
}
//@Override
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
index f22debce1e..8c08d3eb26 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java
@@ -419,39 +419,34 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
logger.debug("vfGroups:" + vfGroups.toString());
- Collections.sort(vfGroups, new Comparator<org.openecomp.sdc.toscaparser.api.Group>() {
-
- @Override
- public int compare(org.openecomp.sdc.toscaparser.api.Group group1,
- org.openecomp.sdc.toscaparser.api.Group group2) {
-
- // Field name1Field = group1.class.getDeclaredField("name");
- // name1Field.setAccessible(true);
- String thisName = group1.getName(); // (String)
- // name1Field.get(group1);
- String thatName = group2.getName(); // (String)
- // name1Field.get(group2);
-
- Matcher m = lastDigit.matcher(thisName);
- Matcher m2 = lastDigit.matcher(thatName);
-
- String thisDigit = "0";
- String thatDigit = "0";
- if(m.find()) {
- thisDigit = m.group();
- } else {
- return -1;
- }
- if(m2.find()) {
- thatDigit = m2.group();
- } else {
- return 1;
- }
+ vfGroups.sort((group1, group2) -> {
+
+ // Field name1Field = group1.class.getDeclaredField("name");
+ // name1Field.setAccessible(true);
+ String thisName = group1.getName(); // (String)
+ // name1Field.get(group1);
+ String thatName = group2.getName(); // (String)
+ // name1Field.get(group2);
+
+ Matcher m = lastDigit.matcher(thisName);
+ Matcher m2 = lastDigit.matcher(thatName);
+
+ String thisDigit = "0";
+ String thatDigit = "0";
+ if (m.find()) {
+ thisDigit = m.group();
+ } else {
+ return -1;
+ }
+ if (m2.find()) {
+ thatDigit = m2.group();
+ } else {
+ return 1;
+ }
- return new Integer(thisDigit).compareTo(new Integer(thatDigit));
+ return new Integer(thisDigit).compareTo(new Integer(thatDigit));
- }
- });
+ });
logger.debug("vfGroupsAfter:" + vfGroups.toString());
@@ -878,7 +873,7 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller {
String vfModuleModelUUID = vfModuleData.getVfModuleModelUUID();
- if(vfModuleModelUUID != null && vfModuleModelUUID.indexOf(".") > -1){
+ if(vfModuleModelUUID != null && vfModuleModelUUID.contains(".")){
vfModuleModelUUID = vfModuleModelUUID.substring(0, vfModuleModelUUID.indexOf("."));
}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
index 2080be137c..396784add4 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java
@@ -42,51 +42,15 @@ public class ASDCNotificationLogging {
if (asdcNotification == null) {
return "NULL";
}
- StringBuilder buffer = new StringBuilder("ASDC Notification:");
- buffer.append(System.lineSeparator());
-
- buffer.append("DistributionID:");
- buffer.append(testNull(asdcNotification.getDistributionID()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceName:");
- buffer.append(testNull(asdcNotification.getServiceName()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceVersion:");
- buffer.append(testNull(asdcNotification.getServiceVersion()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceUUID:");
- buffer.append(testNull(asdcNotification.getServiceUUID()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceInvariantUUID:");
- buffer.append(testNull(asdcNotification.getServiceInvariantUUID()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("ServiceDescription:");
- buffer.append(testNull(asdcNotification.getServiceDescription()));
- buffer.append(System.lineSeparator());
-
-
- buffer.append("Service Artifacts List:");
- buffer.append(System.lineSeparator());
- buffer.append(testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts())));
- buffer.append(System.lineSeparator());
-
- buffer.append("Resource Instances List:");
- buffer.append(System.lineSeparator());
- buffer.append(testNull(dumpASDCResourcesList(asdcNotification)));
- buffer.append(System.lineSeparator());
-
-
- return buffer.toString();
+ return "ASDC Notification:" + System.lineSeparator() +
+ "DistributionID:" + testNull(asdcNotification.getDistributionID()) + System.lineSeparator() +
+ "ServiceName:" + testNull(asdcNotification.getServiceName()) + System.lineSeparator() +
+ "ServiceVersion:" + testNull(asdcNotification.getServiceVersion()) + System.lineSeparator() +
+ "ServiceUUID:" + testNull(asdcNotification.getServiceUUID()) + System.lineSeparator() +
+ "ServiceInvariantUUID:" + testNull(asdcNotification.getServiceInvariantUUID()) + System.lineSeparator() +
+ "ServiceDescription:" + testNull(asdcNotification.getServiceDescription()) + System.lineSeparator() +
+ "Service Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts())) + System.lineSeparator() +
+ "Resource Instances List:" + System.lineSeparator() + testNull(dumpASDCResourcesList(asdcNotification)) + System.lineSeparator();
}
public static String dumpCSARNotification(INotificationData asdcNotification, ToscaResourceStructure toscaResourceStructure) {
@@ -418,52 +382,17 @@ public class ASDCNotificationLogging {
return null;
}
- StringBuilder buffer = new StringBuilder("Resource Instance Info:");
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceInstanceName:");
- buffer.append(testNull(resourceInstance.getResourceInstanceName()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceCustomizationUUID:");
- buffer.append(testNull(resourceInstance.getResourceCustomizationUUID()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceInvariantUUID:");
- buffer.append(testNull(resourceInstance.getResourceInvariantUUID()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceName:");
- buffer.append(testNull(resourceInstance.getResourceName()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceType:");
- buffer.append(testNull(resourceInstance.getResourceType()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceUUID:");
- buffer.append(testNull(resourceInstance.getResourceUUID()));
- buffer.append(System.lineSeparator());
-
- buffer.append("ResourceVersion:");
- buffer.append(testNull(resourceInstance.getResourceVersion()));
- buffer.append(System.lineSeparator());
-
- buffer.append("Category:");
- buffer.append(testNull(resourceInstance.getCategory()));
- buffer.append(System.lineSeparator());
-
- buffer.append("SubCategory:");
- buffer.append(testNull(resourceInstance.getSubcategory()));
- buffer.append(System.lineSeparator());
-
- buffer.append("Resource Artifacts List:");
- buffer.append(System.lineSeparator());
- buffer.append(testNull(dumpArtifactInfoList(resourceInstance.getArtifacts())));
- buffer.append(System.lineSeparator());
-
- return buffer.toString();
-
+ return "Resource Instance Info:" + System.lineSeparator() +
+ "ResourceInstanceName:" + testNull(resourceInstance.getResourceInstanceName()) + System.lineSeparator() +
+ "ResourceCustomizationUUID:" + testNull(resourceInstance.getResourceCustomizationUUID()) + System.lineSeparator() +
+ "ResourceInvariantUUID:" + testNull(resourceInstance.getResourceInvariantUUID()) + System.lineSeparator() +
+ "ResourceName:" + testNull(resourceInstance.getResourceName()) + System.lineSeparator() +
+ "ResourceType:" + testNull(resourceInstance.getResourceType()) + System.lineSeparator() +
+ "ResourceUUID:" + testNull(resourceInstance.getResourceUUID()) + System.lineSeparator() +
+ "ResourceVersion:" + testNull(resourceInstance.getResourceVersion()) + System.lineSeparator() +
+ "Category:" + testNull(resourceInstance.getCategory()) + System.lineSeparator() +
+ "SubCategory:" + testNull(resourceInstance.getSubcategory()) + System.lineSeparator() +
+ "Resource Artifacts List:" + System.lineSeparator() + testNull(dumpArtifactInfoList(resourceInstance.getArtifacts())) + System.lineSeparator();
}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java
index 126114d2d6..f9871b745a 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java
@@ -43,19 +43,15 @@ public class NotificationLogging implements InvocationHandler {
private static Map<Object, List<Method>> objectMethodsToLog = new HashMap<>();
protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.ASDC);
-
- private static InvocationHandler handler = new InvocationHandler() {
- @Override
- public Object invoke(Object arg0, Method arg1, Object[] arg2)
- throws Throwable {
- List<Method> methods = objectMethodsToLog.get(arg0);
- if ((methods == null) || (methods.isEmpty())) {
- // Do nothing for now...
- return null;
- }
- methods.add(arg1);
- return arg1.invoke(arg0, arg2);
+
+ private static InvocationHandler handler = (arg0, arg1, arg2) -> {
+ List<Method> methods = objectMethodsToLog.get(arg0);
+ if ((methods == null) || (methods.isEmpty())) {
+ // Do nothing for now...
+ return null;
}
+ methods.add(arg1);
+ return arg1.invoke(arg0, arg2);
};
public static InvocationHandler getHandler() {
@@ -107,7 +103,7 @@ public class NotificationLogging implements InvocationHandler {
return buffer.toString();
}
- private static final boolean isGetter(Method method) {
+ private static boolean isGetter(Method method) {
// Must start with a valid (and known) prefix
boolean prefixFound = false;
@@ -156,7 +152,7 @@ public class NotificationLogging implements InvocationHandler {
INotificationData.class.getClassLoader(),
new Class[] { INotificationData.class },
NotificationLogging.getHandler());
- objectMethodsToLog.put(proxy, new ArrayList<Method>());
+ objectMethodsToLog.put(proxy, new ArrayList<>());
}
private static <T> void methodToLog(T methodCall) {
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java
index a90fdeb8e6..f6f1af5da6 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/YamlEditor.java
@@ -58,7 +58,7 @@ public class YamlEditor {
}
public synchronized List <String> getYamlNestedFileResourceTypeList () {
- List <String> typeList = new ArrayList <String> ();
+ List <String> typeList = new ArrayList<>();
@SuppressWarnings("unchecked")
Map <String, Object> resourceMap = (Map <String, Object>) yml.get ("resources");
@@ -78,7 +78,7 @@ public class YamlEditor {
}
public synchronized List <String> getYamlResourceTypeList () {
- List <String> typeList = new ArrayList <String> ();
+ List <String> typeList = new ArrayList<>();
@SuppressWarnings("unchecked")
Map <String, Object> resourceMap = (Map <String, Object>) yml.get ("resources");
@@ -95,7 +95,7 @@ public class YamlEditor {
// Within Heat Template, under parameters catalog, it might indicate the default value of the parameter
// If default value exist, the parameter is not mandatory, otherwise its value should be set
public synchronized Set <HeatTemplateParam> getParameterList (String artifactUUID) {
- Set <HeatTemplateParam> paramSet = new HashSet <HeatTemplateParam> ();
+ Set <HeatTemplateParam> paramSet = new HashSet<>();
@SuppressWarnings("unchecked")
Map <String, Object> resourceMap = (Map <String, Object>) yml.get ("parameters");
@@ -130,11 +130,11 @@ public class YamlEditor {
@SuppressWarnings("unchecked")
Map <String, Object> resourceMap = (Map <String, Object>) yml.get ("parameters");
if (resourceMap == null) {
- resourceMap = new LinkedHashMap <String, Object> ();
+ resourceMap = new LinkedHashMap<>();
this.yml.put ("parameters", resourceMap);
}
for (HeatTemplateParam heatParam : heatSet) {
- Map <String, Object> paramInfo = new HashMap <String, Object> ();
+ Map <String, Object> paramInfo = new HashMap<>();
paramInfo.put ("type", heatParam.getParamType ());
resourceMap.put (heatParam.getParamName (), paramInfo);