aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java1
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java19
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java21
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java4
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java7
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java7
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java2
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java10
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java12
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java12
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java8
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java2
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRef.java9
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRefSeq.java1
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java2
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java1
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java1
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java1
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java10
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java8
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java6
-rw-r--r--adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java92
-rw-r--r--adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java8
-rw-r--r--adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallback.java5
33 files changed, 163 insertions, 126 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java
index eac76c74a5..23230071c7 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java
@@ -56,9 +56,9 @@ public class CloudConfig {
private boolean validCloudConfig = false;
@JsonProperty("identity_services")
- private Map<String, CloudIdentity> identityServices = new HashMap<String, CloudIdentity>();
+ private Map<String, CloudIdentity> identityServices = new HashMap<>();
@JsonProperty("cloud_sites")
- private Map<String, CloudSite> cloudSites = new HashMap<String, CloudSite>();
+ private Map<String, CloudSite> cloudSites = new HashMap<>();
private static ObjectMapper mapper = new ObjectMapper();
@@ -135,7 +135,7 @@ public class CloudConfig {
if (version == null || version.equals(cs.getAic_version())) {
return cs;
}
- } else if (cs.getId().equalsIgnoreCase("default")) {
+ } else if ("default".equalsIgnoreCase(cs.getId())) {
// save it off in case we need it
defaultCloudSite = cs.clone();
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java
index 53fc7a55f1..9677d0ee1c 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java
@@ -23,6 +23,7 @@ package org.openecomp.mso.cloud;
* This interface provides the method signature for mapping registration.
* All mappings should be registered by the implementing class.
*/
+@FunctionalInterface
public interface CloudConfigIdentityMapper {
public void registerAllMappings();
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java
index f40c7d9882..41f70e4492 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java
@@ -72,7 +72,7 @@ public abstract class IdentityAuthenticationTypeAbstract {
@Override
public final boolean equals(Object other) {
- return ((this.identityType != null) && (other != null) && (other instanceof IdentityAuthenticationTypeAbstract) && (this.identityType.equals(other.toString())));
+ return (this.identityType != null) && (other != null) && (other instanceof IdentityAuthenticationTypeAbstract) && (this.identityType.equals(other.toString()));
}
@Override
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java
index 4b4f2b8c94..aaa732c9a3 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java
@@ -1,6 +1,23 @@
-/**
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
*/
+
package org.openecomp.mso.cloud.servertype;
import java.util.Map;
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java
index 1999b124ae..4aaf379512 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java
@@ -1,6 +1,23 @@
-/**
- *
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
*/
+
package org.openecomp.mso.cloud.servertype;
import static org.junit.Assert.assertEquals;
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java
index 6d3f8f7b1c..f51cb0dd64 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java
@@ -55,7 +55,7 @@ public class MapDeserializer extends JsonDeserializer<Map<String, String>> {
ObjectMapper mapper = new ObjectMapper();
JsonNode tree = mapper.readTree(parser);
- Map<String, String> map = new LinkedHashMap<String, String>();
+ Map<String, String> map = new LinkedHashMap<>();
Iterator<JsonNode> iterator = tree.iterator();
while (iterator.hasNext()) {
@@ -71,4 +71,4 @@ public class MapDeserializer extends JsonDeserializer<Map<String, String>> {
return map;
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java
index 1db69f41ab..c2ea8242c3 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java
@@ -53,8 +53,9 @@ public class MapSerializer extends JsonSerializer<Map<String, String>> {
jsonGenerator.writeStartObject();
jsonGenerator.writeArrayFieldStart("entry");
- for (String key : map.keySet()) {
- String value = map.get(key);
+ for (Map.Entry<String,String> entry : map.entrySet()) {
+ String key = entry.getKey();
+ String value = entry.getValue();
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("key", key);
jsonGenerator.writeStringField("value", value);
@@ -64,4 +65,4 @@ public class MapSerializer extends JsonSerializer<Map<String, String>> {
jsonGenerator.writeEndArray();
jsonGenerator.writeEndObject();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java
index f3c1c43617..88f6ad2705 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java
@@ -35,12 +35,13 @@ public class UpdateNetworkResponse extends NetworkResponseCommon {
private String networkId;
private String neutronNetworkId;
private Map<String, String> subnetMap;
-
+
public UpdateNetworkResponse() {
+ /* Empty Constructor */
}
-
+
public UpdateNetworkResponse(String networkId, String neutronNetworkId,
- Map<String, String> subnetMap, String messageId) {
+ Map<String, String> subnetMap, String messageId) {
super(messageId);
this.networkId = networkId;
this.neutronNetworkId = neutronNetworkId;
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java
index 0d4a52c081..f54380486a 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java
@@ -35,7 +35,7 @@ public class CreateTenantRequest extends TenantRequestCommon {
private String tenantName;
private Boolean failIfExists;
private Boolean backout;
- private Map<String,String> metadata = new HashMap<String, String>();
+ private Map<String,String> metadata = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
public CreateTenantRequest() {}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java
index 98be3c1478..778a329979 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java
@@ -36,7 +36,7 @@ public class TenantRequestCommon {
private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
public String toJsonString() {
try {
- String jsonString = null;
+ String jsonString;
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
jsonString = mapper.writeValueAsString(this);
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
index 9f709140ec..a1bc08599b 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
@@ -40,7 +40,7 @@ public abstract class CatalogQueryExceptionCommon {
public String toJsonString() {
try {
- String jsonString = null;
+ String jsonString;
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE);
jsonString = mapper.writeValueAsString(this);
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
index 75262e3597..9a82ed2c6e 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java
@@ -54,7 +54,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
"\t}";
// "\t}}";
- public QueryAllottedResourceCustomization() { super(); allottedResourceCustomization = new ArrayList<AllottedResourceCustomization>(); }
+ public QueryAllottedResourceCustomization() { super(); allottedResourceCustomization = new ArrayList<>(); }
public QueryAllottedResourceCustomization(List<AllottedResourceCustomization> vlist) { allottedResourceCustomization = vlist; }
public List<AllottedResourceCustomization> getServiceAllottedResources(){ return this.allottedResourceCustomization; }
@@ -62,7 +62,7 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
@Override
public String toString () {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
boolean first = true;
int i = 1;
@@ -76,10 +76,10 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (!isEmbed && isArray) buf.append("{ ");
if (isArray) buf.append("\"serviceAllottedResources\": [");
- Map<String, String> valueMap = new HashMap<String, String>();
+ Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
@@ -114,4 +114,4 @@ public class QueryAllottedResourceCustomization extends CatalogQuery {
return buf.toString();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
index 0e2aa714f6..e5147671f3 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
@@ -60,8 +60,8 @@ public class QueryServiceMacroHolder extends CatalogQuery {
Service service = serviceMacroHolder.getService();
if (service == null) return "\"serviceResources\": null";
- StringBuffer buf = new StringBuffer();
- Map<String, String> valueMap = new HashMap<String, String>();
+ StringBuilder buf = new StringBuilder();
+ Map<String, String> valueMap = new HashMap<>();
put(valueMap, "SERVICE_MODEL_NAME", service.getModelName()); //getServiceModelName());
put(valueMap, "SERVICE_MODEL_UUID", service.getModelUUID()); //getServiceModelUuid());
@@ -84,4 +84,4 @@ public class QueryServiceMacroHolder extends CatalogQuery {
return buf.toString();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index 42b6b651ef..59c601ef19 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -51,10 +51,10 @@ public class QueryServiceNetworks extends CatalogQuery {
"\t}";
// "\t}}";
- public QueryServiceNetworks() { super(); serviceNetworks = new ArrayList<NetworkResourceCustomization>(); }
+ public QueryServiceNetworks() { super(); serviceNetworks = new ArrayList<>(); }
public QueryServiceNetworks(List<NetworkResourceCustomization> vlist) {
LOGGER.debug ("QueryServiceNetworks:");
- serviceNetworks = new ArrayList<NetworkResourceCustomization>();
+ serviceNetworks = new ArrayList<>();
for (NetworkResourceCustomization o : vlist) {
LOGGER.debug (o.toString());
serviceNetworks.add(o);
@@ -67,7 +67,7 @@ public class QueryServiceNetworks extends CatalogQuery {
@Override
public String toString () {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
boolean first = true;
int i = 1;
@@ -81,11 +81,11 @@ public class QueryServiceNetworks extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (!isEmbed && isArray) buf.append("{ ");
if (isArray) buf.append("\"serviceNetworks\": [");
//if (isArray) buf.append("[");
- Map<String, String> valueMap = new HashMap<String, String>();
+ Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
@@ -112,4 +112,4 @@ public class QueryServiceNetworks extends CatalogQuery {
if (!isEmbed && isArray) buf.append("}");
return buf.toString();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index ee3c86ab94..cfbb781ae8 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -55,10 +55,10 @@ public class QueryServiceVnfs extends CatalogQuery {
"\t}";
// "\t}}";
- public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList<VnfResourceCustomization>(); }
+ public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList<>(); }
public QueryServiceVnfs(List<VnfResourceCustomization> vlist) {
LOGGER.debug ("QueryServiceVnfs:");
- serviceVnfs = new ArrayList<VnfResourceCustomization>();
+ serviceVnfs = new ArrayList<>();
for (VnfResourceCustomization o : vlist) {
LOGGER.debug ("-- o is a serviceVnfs ----");
LOGGER.debug (o.toString());
@@ -72,7 +72,7 @@ public class QueryServiceVnfs extends CatalogQuery {
@Override
public String toString () {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
boolean first = true;
int i = 1;
@@ -86,10 +86,10 @@ public class QueryServiceVnfs extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean isEmbed) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (!isEmbed && isArray) buf.append("{ ");
if (isArray) buf.append("\"serviceVnfs\": [");
- Map<String, String> valueMap = new HashMap<String, String>();
+ Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
@@ -121,4 +121,4 @@ public class QueryServiceVnfs extends CatalogQuery {
if (!isEmbed && isArray) buf.append("}");
return buf.toString();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java
index 4675858936..309aa0641a 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java
@@ -50,10 +50,10 @@ public class QueryVfModule extends CatalogQuery {
"\t}";
// "\t}}";
- public QueryVfModule() { super(); vfModules = new ArrayList<VfModuleCustomization>(); }
+ public QueryVfModule() { super(); vfModules = new ArrayList<>(); }
public QueryVfModule(List<VfModuleCustomization> vlist) {
LOGGER.debug ("QueryVfModule:");
- vfModules = new ArrayList<VfModuleCustomization>();
+ vfModules = new ArrayList<>();
if (vlist != null) {
for (VfModuleCustomization o : vlist) {
LOGGER.debug ("-- o is a vfModules ----");
@@ -69,7 +69,7 @@ public class QueryVfModule extends CatalogQuery {
@Override
public String toString () {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
boolean first = true;
int i = 1;
@@ -83,9 +83,9 @@ public class QueryVfModule extends CatalogQuery {
@Override
public String JSON2(boolean isArray, boolean x) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
if (isArray) buf.append("\"vfModules\": [");
- Map<String, String> valueMap = new HashMap<String, String>();
+ Map<String, String> valueMap = new HashMap<>();
String sep = "";
boolean first = true;
@@ -95,7 +95,7 @@ public class QueryVfModule extends CatalogQuery {
boolean vfNull = o.getVfModule() == null ? true : false;
boolean hasVolumeGroup = false;
String envt = o.getHeatEnvironmentArtifactUuid();
- if (envt != null && !envt.equals("")) {
+ if (envt != null && !"".equals(envt)) {
hasVolumeGroup = true;
}
@@ -116,4 +116,4 @@ public class QueryVfModule extends CatalogQuery {
if (isArray) buf.append("]");
return buf.toString();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java
index 46b8f31046..ff713991f9 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java
@@ -37,7 +37,10 @@ public class QueryVfModules {
private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
private List<VfModule> vfModules;
- public QueryVfModules() { super(); vfModules = new ArrayList<>(); }
+ public QueryVfModules() {
+ super();
+ vfModules = new ArrayList<>();
+ }
public QueryVfModules(List<VfModule> vlist) {
LOGGER.debug ("QueryVfModules:");
vfModules = new ArrayList<>();
@@ -61,7 +64,8 @@ public class QueryVfModules {
int i = 1;
for (VfModule o : vfModules) {
buf.append(i+"\t");
- if (!first) buf.append("\n"); first = false;
+ if (!first) buf.append("\n");
+ first = false;
buf.append(o);
}
return buf.toString();
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
index b7ab5043f3..6c571f3e06 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java
@@ -166,7 +166,7 @@ public class BpelRestClient {
}
public String getRetryList() {
- if (retryList.size() == 0)
+ if (retryList.isEmpty())
return "";
String t = retryList.toString();
return t.substring(1, t.length()-1);
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRef.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRef.java
index 699e89b03d..0504627377 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRef.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRef.java
@@ -22,17 +22,14 @@ package org.openecomp.mso.adapters.network;
import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
public class ContrailPolicyRef {
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
@JsonProperty("network_policy_refs_data_sequence")
private ContrailPolicyRefSeq seq;
@@ -47,7 +44,7 @@ public class ContrailPolicyRef {
}
catch (Exception e)
{
- LOGGER.error (MessageEnum.RA_MARSHING_ERROR, "Error creating JsonString for Contrail Policy Ref", "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Policy Ref", e);
+ logger.error (MessageEnum.RA_MARSHING_ERROR, "Error creating JsonString for Contrail Policy Ref", "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Policy Ref", e);
}
return node;
@@ -63,7 +60,7 @@ public class ContrailPolicyRef {
}
catch (Exception e)
{
- LOGGER.error (MessageEnum.RA_MARSHING_ERROR, "Error creating JsonString for Contrail Policy Ref", "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Policy Ref", e);
+ logger.error (MessageEnum.RA_MARSHING_ERROR, "Error creating JsonString for Contrail Policy Ref", "", "", MsoLogger.ErrorCode.SchemaError, "Exception creating JsonString for Contrail Policy Ref", e);
}
return jsonString;
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRefSeq.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRefSeq.java
index 9db00dffa9..c07678be85 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRefSeq.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRefSeq.java
@@ -32,6 +32,7 @@ public class ContrailPolicyRefSeq {
private String minor;
public ContrailPolicyRefSeq() {
+ /* To be done */
}
public ContrailPolicyRefSeq(String major, String minor) {
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java
index 80b6754656..b755cad220 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java
@@ -60,7 +60,7 @@ public class ContrailSubnet {
**/
@JsonProperty("network_ipam_refs_data_ipam_subnets_allocation_pools")
- private List<ContrailSubnetPool> allocation_pools = new ArrayList <ContrailSubnetPool> ();
+ private List<ContrailSubnetPool> allocation_pools = new ArrayList <> ();
public ContrailSubnet() {
super();
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java
index ccac38a58c..687930673b 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java
@@ -444,7 +444,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException (me);
}
- if (heatStack != null && !(heatStack.getStatus () == HeatStatus.NOTFOUND)) {
+ if (heatStack != null && (heatStack.getStatus () != HeatStatus.NOTFOUND)) {
// Stack exists. Return success or error depending on input directive
if (failIfExists != null && failIfExists) {
String error = "CreateNetwork: Stack " + networkName
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java
index 15f74c4d94..9648922d41 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java
@@ -27,7 +27,6 @@ import javax.xml.bind.annotation.XmlElement;
import org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbException;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
-import org.openecomp.mso.requestsdb.SiteStatus;
/**
* MSO Request DB Adapter Web Service
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java
index cac919bfb0..dce1cf9365 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java
@@ -32,7 +32,9 @@ public class MsoRequestsDbExceptionBean implements Serializable {
private String message;
- public MsoRequestsDbExceptionBean () {}
+ public MsoRequestsDbExceptionBean () {
+ /* Empty constructor */
+ }
public MsoRequestsDbExceptionBean (String message) {
this.message = message;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java
index c39b2f55d4..ff30e0d241 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java
@@ -47,6 +47,7 @@ public class ObjectFactory {
*
*/
public ObjectFactory() {
+ /* Empty constructor */
}
/**
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java
index 6c54b9c11c..2ce452e51c 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java
@@ -66,6 +66,7 @@ public class CallbackHeader {
protected String responseMessage;
public CallbackHeader() {
+ /* Empty constructor */
}
public CallbackHeader(String reqId, String respCode, String respMsg) {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java
index 4bab7773d7..830ac7c917 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java
@@ -23,7 +23,6 @@ package org.openecomp.mso.adapters.sdnc.impl;
import org.openecomp.mso.logger.MsoAlarmLogger;
import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
import org.openecomp.mso.properties.MsoPropertiesException;
import org.openecomp.mso.properties.MsoPropertiesFactory;
@@ -35,6 +34,7 @@ public class RequestTunables {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER";
+ public static final String GENERATED_KEY = "Generated key: ";
//criteria
private String reqId = "";
@@ -154,17 +154,17 @@ public class RequestTunables {
public void setTunables()
{
String error = null;
- String key = null;
+ String key;
if ("query".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9
key = Constants.REQUEST_TUNABLES + "." + msoAction + ".." + action;
- msoLogger.debug("Generated key: " + key);
+ msoLogger.debug(GENERATED_KEY + key);
}
else if ("put".equals(action) || "restdelete".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9
key = Constants.REQUEST_TUNABLES + "..." + action;
- msoLogger.debug("Generated key: " + key);
+ msoLogger.debug(GENERATED_KEY + key);
} else {
key = Constants.REQUEST_TUNABLES + "." + msoAction + "." + operation +"." + action;
- msoLogger.debug("Generated key: " + key);
+ msoLogger.debug(GENERATED_KEY + key);
}
String value;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java
index b4c37a0f30..c69aee52da 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java
@@ -53,7 +53,7 @@ import org.openecomp.mso.logger.MessageEnum;
public class SDNCAdapterRestImpl {
private MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- public final static String MSO_PROP_ADAPTER="MSO_PROP_SDNC_ADAPTER";
+ public static final String MSO_PROP_ADAPTER = "MSO_PROP_SDNC_ADAPTER";
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java
index 757ea8207d..97f30bea6b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java
@@ -34,7 +34,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import javax.ejb.EJB;
import javax.xml.XMLConstants;
import javax.xml.bind.DatatypeConverter;
import javax.xml.parsers.DocumentBuilder;
@@ -58,7 +57,6 @@ import org.openecomp.mso.adapters.sdnc.util.SDNCRequestIdUtil;
import org.openecomp.mso.logger.MsoAlarmLogger;
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.properties.MsoJavaProperties;
import org.openecomp.mso.properties.MsoPropertiesFactory;
//SDNCAdapter to SDNC Rest Client
@@ -199,7 +197,7 @@ public class SDNCRestClient implements Runnable {
//default
sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR);
String respMsg = "Error processing request to SDNC. ";
- String sdncErrMsg = null;
+ String sdncErrMsg = "";
if (e instanceof java.net.SocketTimeoutException )
{
@@ -264,9 +262,7 @@ public class SDNCRestClient implements Runnable {
if (e.getMessage() != null) {
respMsg = respMsg + e.getMessage();
}
- if (sdncErrMsg != null) {
- respMsg = respMsg + sdncErrMsg;
- }
+ respMsg = respMsg + sdncErrMsg;
sdncResp.setRespMsg(respMsg);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java
index 0622c48c41..f6708a2586 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -138,12 +138,7 @@ public class BPRestCallback {
LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, msg);
ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg);
}
-
- httpResponse = null;
}
-
- method.reset();
- method = null;
return true;
} catch (Exception e) {
LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError,
@@ -155,6 +150,7 @@ public class BPRestCallback {
if (httpResponse != null) {
try {
EntityUtils.consume(httpResponse.getEntity());
+ httpResponse = null;
} catch (Exception e) {
LOGGER.debug("Exception:", e);
}
diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java
index 06b953cd43..a875a862aa 100644
--- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java
+++ b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java
@@ -32,7 +32,6 @@ import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.adapters.tenant.exceptions.TenantAlreadyExists;
import org.openecomp.mso.adapters.tenant.exceptions.TenantException;
import org.openecomp.mso.adapters.tenantrest.TenantRollback;
-import org.openecomp.mso.cloud.CloudConfigFactory;
import org.openecomp.mso.entity.MsoRequest;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
@@ -48,17 +47,22 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
MsoTenantUtilsFactory tFactory = new MsoTenantUtilsFactory(MSO_PROP_TENANT_ADAPTER);
public static final String MSO_PROP_TENANT_ADAPTER="MSO_PROP_TENANT_ADAPTER";
+ public static final String CREATE_TENANT = "CreateTenant";
+ public static final String OPENSTACK = "OpenStack";
+ public static final String QUERY_TENANT = "QueryTenant";
+ public static final String DELETE_TENANT = "DeleteTenant";
+ public static final String ROLLBACK_TENANT = "RollbackTenant";
@Resource
WebServiceContext wsContext;
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
/**
* Health Check web method. Does nothing but return to show the adapter is deployed.
*/
@Override
public void healthCheck () {
- LOGGER.debug ("Health check call in Tenant Adapter");
+ logger.debug ("Health check call in Tenant Adapter");
}
/**
@@ -82,9 +86,9 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
Holder <String> tenantId,
Holder <TenantRollback> rollback) throws TenantException, TenantAlreadyExists {
MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("CreateTenant");
+ MsoLogger.setServiceName (CREATE_TENANT);
- LOGGER.debug ("Call to MSO createTenant adapter. Creating Tenant: " + tenantName
+ logger.debug ("Call to MSO createTenant adapter. Creating Tenant: " + tenantName
+ "in "
+ cloudSiteId);
@@ -103,12 +107,12 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
long queryTenantStartTime = System.currentTimeMillis ();
try {
newTenant = tUtils.queryTenantByName (tenantName, cloudSiteId);
- LOGGER.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryTenant", null);
+ logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", OPENSTACK, QUERY_TENANT, null);
} catch (MsoException me) {
- LOGGER.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with Open Stack", "OpenStack", "QueryTenant", null);
+ logger.recordMetricEvent (queryTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with Open Stack", OPENSTACK, QUERY_TENANT, null);
String error = "Create Tenant " + tenantName + ": " + me;
- LOGGER.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), "OpenStack", "createTenant", MsoLogger.ErrorCode.DataError, "Exception while communicate with Open Stack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, "createTenant", MsoLogger.ErrorCode.DataError, "Exception while communicate with Open Stack", me);
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
throw new TenantException (me);
}
if (newTenant == null) {
@@ -117,34 +121,34 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
long createTenantStartTime = System.currentTimeMillis ();
try {
newTenantId = tUtils.createTenant (tenantName, cloudSiteId, metadata, backout.booleanValue ());
- LOGGER.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "CreateTenant", null);
+ logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", OPENSTACK, CREATE_TENANT, null);
} catch (MsoException me) {
- LOGGER.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with Open Stack", "OpenStack", "CreateTenant", null);
+ logger.recordMetricEvent (createTenantStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with Open Stack", OPENSTACK, CREATE_TENANT, null);
String error = "Create Tenant " + tenantName + ": " + me;
- LOGGER.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), "OpenStack", "createTenant", MsoLogger.ErrorCode.DataError, "Exception while communicate with Open Stack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.error (MessageEnum.RA_CREATE_TENANT_ERR, me.getMessage(), OPENSTACK, "createTenant", MsoLogger.ErrorCode.DataError, "Exception while communicate with Open Stack", me);
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
throw new TenantException (me);
}
tenantRollback.setTenantId (newTenantId);
tenantRollback.setTenantCreated (true);
- LOGGER.debug ("Tenant " + tenantName + " successfully created with ID " + newTenantId);
+ logger.debug ("Tenant " + tenantName + " successfully created with ID " + newTenantId);
} else {
if (failIfExists != null && failIfExists) {
- String error = "CreateTenant: Tenant " + tenantName + " already exists in " + cloudSiteId;
- LOGGER.error (MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "CreateTenant, Tenant already exists");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error);
+ String error = CREATE_TENANT + ": Tenant " + tenantName + " already exists in " + cloudSiteId;
+ logger.error (MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, OPENSTACK, "", MsoLogger.ErrorCode.DataError, CREATE_TENANT + ", Tenant already exists");
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error);
throw new TenantAlreadyExists (tenantName, cloudSiteId, newTenant.getTenantId ());
}
newTenantId = newTenant.getTenantId ();
tenantRollback.setTenantCreated (false);
- LOGGER.debug ("Tenant " + tenantName + " already exists with ID " + newTenantId);
+ logger.debug ("Tenant " + tenantName + " already exists with ID " + newTenantId);
}
tenantId.value = newTenantId;
rollback.value = tenantRollback;
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create tenant");
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create tenant");
return;
}
@@ -156,8 +160,8 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
Holder <String> tenantName,
Holder <Map <String, String>> metadata) throws TenantException {
MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("QueryTenant");
- LOGGER.debug ("Querying Tenant " + tenantNameOrId + " in " + cloudSiteId);
+ MsoLogger.setServiceName (QUERY_TENANT);
+ logger.debug ("Querying Tenant " + tenantNameOrId + " in " + cloudSiteId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -168,31 +172,31 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
long subStartTime = System.currentTimeMillis ();
try {
qTenant = tUtils.queryTenant (tenantNameOrId, cloudSiteId);
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryTenant", null);
+ logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", OPENSTACK, QUERY_TENANT, null);
if (qTenant == null) {
// Not found by ID, Try by name.
qTenant = tUtils.queryTenantByName (tenantNameOrId, cloudSiteId);
}
if (qTenant == null) {
- LOGGER.debug ("QueryTenant: Tenant " + tenantNameOrId + " not found");
+ logger.debug ("QueryTenant: Tenant " + tenantNameOrId + " not found");
tenantId.value = null;
tenantName.value = null;
metadata.value = null;
} else {
- LOGGER.debug ("QueryTenant: Tenant " + tenantNameOrId + " found with ID " + qTenant.getTenantId ());
+ logger.debug ("QueryTenant: Tenant " + tenantNameOrId + " found with ID " + qTenant.getTenantId ());
tenantId.value = qTenant.getTenantId ();
tenantName.value = qTenant.getTenantName ();
metadata.value = qTenant.getMetadata ();
}
} catch (MsoException me) {
String error = "Query Tenant " + tenantNameOrId + ": " + me;
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryTenant", null);
- LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, me.getMessage(), "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception in queryTenant", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, QUERY_TENANT, null);
+ logger.error (MessageEnum.RA_GENERAL_EXCEPTION, me.getMessage(), OPENSTACK, "", MsoLogger.ErrorCode.DataError, "Exception in queryTenant", me);
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
throw new TenantException (me);
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query tenant");
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query tenant");
return;
}
@@ -202,9 +206,9 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
MsoRequest msoRequest,
Holder <Boolean> tenantDeleted) throws TenantException {
MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("DeleteTenant");
+ MsoLogger.setServiceName (DELETE_TENANT);
- LOGGER.debug ("Deleting Tenant " + tenantId + " in " + cloudSiteId);
+ logger.debug ("Deleting Tenant " + tenantId + " in " + cloudSiteId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
@@ -216,17 +220,17 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
MsoTenantUtils tUtils = tFactory.getTenantUtils (cloudSiteId);
boolean deleted = tUtils.deleteTenant (tenantId, cloudSiteId);
tenantDeleted.value = deleted;
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully communicate with Open Stack", "OpenStack", "DeleteTenant", null);
+ logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully communicate with Open Stack", OPENSTACK, DELETE_TENANT, null);
} catch (MsoException me) {
String error = "Delete Tenant " + tenantId + ": " + me;
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteTenant", null);
- LOGGER.error (MessageEnum.RA_DELETE_TEMAMT_ERR, me.getMessage(), "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - DeleteTenant", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, DELETE_TENANT, null);
+ logger.error (MessageEnum.RA_DELETE_TEMAMT_ERR, me.getMessage(), OPENSTACK, "", MsoLogger.ErrorCode.DataError, "Exception - DeleteTenant", me);
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
throw new TenantException (me);
}
// On success, nothing is returned.
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete tenant");
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete tenant");
return;
}
@@ -242,10 +246,10 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
@Override
public void rollbackTenant (TenantRollback rollback) throws TenantException {
long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("RollbackTenant");
+ MsoLogger.setServiceName (ROLLBACK_TENANT);
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- LOGGER.warn (MessageEnum.RA_ROLLBACK_NULL, "OpenStack", "rollbackTenant", MsoLogger.ErrorCode.DataError, "rollbackTenant, rollback is null");
+ logger.warn (MessageEnum.RA_ROLLBACK_NULL, OPENSTACK, "rollbackTenant", MsoLogger.ErrorCode.DataError, "rollbackTenant, rollback is null");
return;
}
@@ -254,7 +258,7 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
String tenantId = rollback.getTenantId ();
MsoLogger.setLogContext (rollback.getMsoRequest ());
- LOGGER.debug ("Rolling Back Tenant " + rollback.getTenantId () + " in " + cloudSiteId);
+ logger.debug ("Rolling Back Tenant " + rollback.getTenantId () + " in " + cloudSiteId);
long subStartTime = System.currentTimeMillis ();
if (rollback.getTenantCreated ()) {
@@ -262,18 +266,18 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
MsoTenantUtils tUtils = tFactory.getTenantUtils (cloudSiteId);
tUtils.deleteTenant (tenantId, cloudSiteId);
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully communicate with Open Stack", "OpenStack", "RollbackTenant", null);
+ logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully communicate with Open Stack", OPENSTACK, ROLLBACK_TENANT, null);
} catch (MsoException me) {
- me.addContext ("RollbackTenant");
+ me.addContext (ROLLBACK_TENANT);
// Failed to delete the tenant.
String error = "Rollback Tenant " + tenantId + ": " + me;
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "RollbackTenant", null);
- LOGGER.error (MessageEnum.RA_ROLLBACK_TENANT_ERR, me.getMessage(), "OpenStack", "rollbackTenant", MsoLogger.ErrorCode.DataError, "Exception - rollbackTenant", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ logger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, OPENSTACK, ROLLBACK_TENANT, null);
+ logger.error (MessageEnum.RA_ROLLBACK_TENANT_ERR, me.getMessage(), OPENSTACK, "rollbackTenant", MsoLogger.ErrorCode.DataError, "Exception - rollbackTenant", me);
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
throw new TenantException (me);
}
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back tenant");
+ logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back tenant");
return;
}
}
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java
index a4f1046df9..7df05f8b43 100644
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java
@@ -234,15 +234,11 @@ public class BpelRestClient {
}
private void debug(String m) {
LOGGER.debug(m);
-// System.err.println(m);
}
private void sendOne(final String toBpelStr, final String bpelUrl, final boolean isxml) {
LOGGER.debug("Sending to BPEL server: "+bpelUrl);
LOGGER.debug("Content is: "+toBpelStr);
- //Client 4.3+
- CloseableHttpClient client = HttpClients.createDefault();
-
//POST
HttpPost post = new HttpPost(bpelUrl);
if (credentials != null && !credentials.isEmpty())
@@ -260,9 +256,13 @@ public class BpelRestClient {
.build();
post.setConfig(requestConfig);
+ //Client 4.3+
+ CloseableHttpClient client = null;
+
//Client 4.3+
//Execute & GetResponse
try {
+ client = HttpClients.createDefault();
CloseableHttpResponse response = client.execute(post);
if (response != null) {
lastResponseCode = response.getStatusLine().getStatusCode();
diff --git a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallback.java b/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallback.java
index 253523eaac..0293a8d4d0 100644
--- a/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallback.java
+++ b/adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallback.java
@@ -144,11 +144,8 @@ public class BPRestCallback {
ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg);
}
- httpResponse = null;
}
- method.reset();
- method = null;
return true;
} catch (Exception e) {
LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError,
@@ -160,6 +157,7 @@ public class BPRestCallback {
if (httpResponse != null) {
try {
EntityUtils.consume(httpResponse.getEntity());
+ httpResponse = null;
} catch (Exception e) {
LOGGER.debug("Exception :",e);
}
@@ -168,6 +166,7 @@ public class BPRestCallback {
if (method != null) {
try {
method.reset();
+ method = null;
} catch (Exception e) {
LOGGER.debug("Exception :",e);
}