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/CloudConfigFactory.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java12
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java2
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java77
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java7
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java7
-rw-r--r--adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java2
-rwxr-xr-xadapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java4
-rw-r--r--adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java4
-rw-r--r--adapters/pom.xml1
11 files changed, 51 insertions, 69 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java
index 2d6d0271f8..445c135dab 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java
@@ -127,7 +127,7 @@ public class CloudConfigFactory implements Serializable {
* @return true if Properties have been reloaded, false otherwise
*/
@Schedule(minute = "*/1", hour = "*", persistent = false)
- public void reloadCloudConfig () {
+ public static void reloadCloudConfig () {
try {
if (!rwl.writeLock ().tryLock () && !rwl.writeLock ().tryLock (30L, TimeUnit.SECONDS)) {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
index c438d0a277..6862492d7e 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
@@ -143,7 +143,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String tenantId,
String stackName,
String heatTemplate,
- Map <String, ? extends Object> stackInputs,
+ Map <String, ?> stackInputs,
boolean pollForCompletion,
int timeoutMinutes) throws MsoException {
// Just call the new method with the environment & files variable set to null
@@ -165,7 +165,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String tenantId,
String stackName,
String heatTemplate,
- Map <String, ? extends Object> stackInputs,
+ Map <String, ?> stackInputs,
boolean pollForCompletion,
int timeoutMinutes,
String environment) throws MsoException {
@@ -188,7 +188,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String tenantId,
String stackName,
String heatTemplate,
- Map <String, ? extends Object> stackInputs,
+ Map <String, ?> stackInputs,
boolean pollForCompletion,
int timeoutMinutes,
String environment,
@@ -211,7 +211,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String tenantId,
String stackName,
String heatTemplate,
- Map <String, ? extends Object> stackInputs,
+ Map <String, ?> stackInputs,
boolean pollForCompletion,
int timeoutMinutes,
String environment,
@@ -275,7 +275,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String tenantId,
String stackName,
String heatTemplate,
- Map <String, ? extends Object> stackInputs,
+ Map <String, ?> stackInputs,
boolean pollForCompletion,
int timeoutMinutes,
String environment,
@@ -1240,8 +1240,6 @@ public class MsoHeatUtils extends MsoCommonUtils {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
final String json = JSON_MAPPER.writeValueAsString(obj);
return json;
- } catch (JsonParseException jpe) {
- LOGGER.debug("Error converting json to string " + jpe.getMessage(), jpe);
} catch (Exception e) {
LOGGER.debug("Error converting json to string " + e.getMessage(), e);
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java
index f7e67d87f8..75bb00351c 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java
@@ -428,8 +428,6 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
final String json = JSON_MAPPER.writeValueAsString(obj);
return json;
- } catch (JsonParseException jpe) {
- LOGGER.debug("Error converting json to string " + jpe.getMessage(), jpe);
} catch (Exception e) {
LOGGER.debug("Error converting json to string " + e.getMessage(), e);
}
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java
index 5c3470acd9..9efaee921f 100644
--- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java
@@ -433,7 +433,7 @@ public class BeanTest {
m.invoke(obj);
} else if (types.length == 1) {
String type = types[0].getTypeName();
- if (type.indexOf("<") != -1) {
+ if (type.contains("<")) {
type = type.substring(0, type.indexOf("<"));
}
Class paramCls = Class.forName(type);
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
index d0d3999cf4..c1c5aee8f1 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
@@ -531,44 +531,43 @@ public class CatalogDbAdapterRest {
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) {
int respStatus = HttpStatus.SC_OK;
- CatalogDatabase db = CatalogDatabase.getInstance();
- String entity = "";
- try{
- if(rmUuid != null && !"".equals(rmUuid)){
- LOGGER.debug ("Query recipe by resource model uuid: " + rmUuid);
- //check vnf and network and ar, the resource could be any resource.
- Recipe recipe = db.getVnfRecipeByModuleUuid(rmUuid, action);
- if(null == recipe){
- recipe = db.getNetworkRecipeByModuleUuid(rmUuid, action);
- }
- if(null == recipe){
- recipe = db.getArRecipeByModuleUuid(rmUuid, action);
- }
- if(recipe != null){
- QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
- entity = resourceRecipe.JSON2(false, false);
- }
- else{
- respStatus = HttpStatus.SC_NOT_FOUND;
- }
- }else{
- throw(new Exception("Incoming parameter is null or blank"));
- }
- LOGGER.debug ("Query recipe exit");
- return Response
- .status(respStatus)
- .entity(entity)
- .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
- .build();
- }catch(Exception e){
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, rmUuid, "", "resourceRecipe", MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e);
- CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response
- .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<CatalogQueryException>(excResp) {})
- .build();
- }finally {
- db.close();
- }
+ String entity = "";
+ try (CatalogDatabase db = CatalogDatabase.getInstance()) {
+ if (rmUuid != null && !"".equals(rmUuid)) {
+ LOGGER.debug("Query recipe by resource model uuid: " + rmUuid);
+ //check vnf and network and ar, the resource could be any resource.
+ Recipe recipe = db.getVnfRecipeByModuleUuid(rmUuid, action);
+ if (null == recipe) {
+ recipe = db.getNetworkRecipeByModuleUuid(rmUuid, action);
+ }
+ if (null == recipe) {
+ recipe = db.getArRecipeByModuleUuid(rmUuid, action);
+ }
+ if (recipe != null) {
+ QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe);
+ entity = resourceRecipe.JSON2(false, false);
+ } else {
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ }
+ } else {
+ throw (new Exception("Incoming parameter is null or blank"));
+ }
+ LOGGER.debug("Query recipe exit");
+ return Response
+ .status(respStatus)
+ .entity(entity)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .build();
+ } catch (Exception e) {
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, rmUuid, "", "resourceRecipe",
+ MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response
+ .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {
+ })
+ .build();
+ }
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java
index be0466af73..fa257164cf 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -154,12 +154,7 @@ public abstract class SDNCConnector {
LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", "");
return createResponseFromContent(statusCode, statusMessage, responseContent, rt);
- } catch (SocketTimeoutException e) {
- String errMsg = "Request to SDNC timed out";
- logError(errMsg, e);
- return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt);
-
- } catch (ConnectTimeoutException e) {
+ } catch (SocketTimeoutException | ConnectTimeoutException e) {
String errMsg = "Request to SDNC timed out";
logError(errMsg, e);
return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt);
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
index afee1bbfaa..fcbbf8515a 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
@@ -166,12 +166,7 @@ public class RestfulUtil {
method = null;
return createResponse(statusCode, responseContent);
- } catch(SocketTimeoutException e) {
- String errMsg = "Request to VFC timed out";
- logError(errMsg, e);
- return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
-
- } catch(ConnectTimeoutException e) {
+ } catch(SocketTimeoutException | ConnectTimeoutException e) {
String errMsg = "Request to VFC timed out";
logError(errMsg, e);
return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
index caab1e31bc..9022c26ccd 100644
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
@@ -536,8 +536,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
final String json = JSON_MAPPER.writeValueAsString(obj);
return json;
- } catch (JsonParseException jpe) {
- LOGGER.debug("Error converting json to string " + jpe.getMessage(),jpe);
} catch (Exception e) {
LOGGER.debug("Error converting json to string " + e.getMessage(),e);
}
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java
index 856b713c94..2118eec0a5 100755
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java
@@ -88,7 +88,7 @@ public interface VduPlugin {
String tenantId,
String vduInstanceName,
VduBlueprint vduBlueprint,
- Map <String, ? extends Object> inputs,
+ Map <String, ?> inputs,
String environmentFile,
int timeoutMinutes,
boolean suppressBackout)
@@ -198,7 +198,7 @@ public interface VduPlugin {
String tenantId,
String vduInstanceId,
VduBlueprint vduBlueprint,
- Map <String, ? extends Object> inputs,
+ Map <String, ?> inputs,
String environmentFile,
int timeoutMinutes)
throws MsoException;
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java
index 4a29c32e28..98a00033f7 100644
--- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java
+++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java
@@ -66,7 +66,7 @@ public class VduInfoTest {
public void testGetOutputs() {
Object obj = new Object();
String str = "some text";
- outputs = new HashMap<String, Object>();
+ outputs = new HashMap<>();
outputs.put(str, obj);
vduInfo.setOutputs(outputs);
Assert.assertNotNull(vduInfo.getOutputs());
@@ -78,7 +78,7 @@ public class VduInfoTest {
public void testGetInputs() {
Object obj = new Object();
String str = "some text";
- inputs = new HashMap<String, Object>();
+ inputs = new HashMap<>();
inputs.put(str, obj);
vduInfo.setInputs(inputs);
Assert.assertNotNull(vduInfo.getInputs());
diff --git a/adapters/pom.xml b/adapters/pom.xml
index 6877d76ae3..25346583c1 100644
--- a/adapters/pom.xml
+++ b/adapters/pom.xml
@@ -7,7 +7,6 @@
<version>1.2.0-SNAPSHOT</version>
</parent>
- <groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
<name>MSO Adapters</name>
<description>Adapters for MSO</description>