summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java20
12 files changed, 85 insertions, 51 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java
index a1f3805c7f..773c5b0a96 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientFactory.java
@@ -35,7 +35,7 @@ public class RequestClientFactory {
if(props ==null){
throw new IllegalStateException("properties is null");
}
- String url = null;
+ String url;
if(orchestrationURI.contains(CommonConstants.BPEL_SEARCH_STR)){
url = props.getProperty(CommonConstants.BPEL_URL,null) + orchestrationURI;
retClient= new BPELRestClient();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
index 0c0c3cb339..927cec66f1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -189,8 +189,10 @@ public class E2EServiceInstances {
}
CatalogDatabase db = null;
+ RecipeLookupResult recipeLookupResult = null;
try {
db = CatalogDatabase.getInstance();
+ recipeLookupResult = getServiceInstanceOrchestrationURI(db, sir, action);
} catch (Exception e) {
msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e);
msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
@@ -206,36 +208,10 @@ public class E2EServiceInstances {
msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB");
msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
return response;
- }
-
-
- RecipeLookupResult recipeLookupResult = null;
-
- try {
- recipeLookupResult = getServiceInstanceOrchestrationURI(db, sir, action);
- } catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e);
- msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);
- Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND,
- MsoException.ServiceException,
- "Recipe could not be retrieved from catalog DB " + e.getMessage (),
- ErrorNumbers.SVC_GENERAL_SERVICE_ERROR,
- null);
- alarmLogger.sendAlarm ("MsoDatabaseAccessError",
- MsoAlarmLogger.CRITICAL,
- Messages.errors.get (ErrorNumbers.ERROR_FROM_CATALOG_DB));
- msoRequest.createRequestRecord (Status.FAILED,action);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while querying Catalog DB");
- msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ());
- db.close();
- return response;
- }
- finally{
- if(null != db)
- {
- db.close();
+ } finally {
+ if(db != null) {
+ db.close();
}
-
}
if (recipeLookupResult == null) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java
index 6123ee906c..af0fabc380 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/GlobalHealthcheckHandler.java
@@ -1,3 +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.apihandlerinfra;
import javax.ws.rs.DefaultValue;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
index 0f39ad07b6..911808388f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java
@@ -28,7 +28,7 @@ import org.openecomp.mso.apihandler.common.ErrorNumbers;
public class Messages {
- public static final Map<String,String> errors = new HashMap<String,String>();
+ public static final Map<String,String> errors = new HashMap<>();
static {
errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_service", "Service request FAILED schema validation. %s");
errors.put(ErrorNumbers.REQUEST_FAILED_SCHEMA_VALIDATION + "_feature", "Feature request FAILED schema validation. %s");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
index f61a50bb06..bcea8fd8d5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkInfoHandler.java
@@ -85,7 +85,7 @@ public class NetworkInfoHandler {
+ aicNodeClli
+ " - tenant id "
+ tenantId);
- Response response = null;
+ Response response;
if (networkType != null) {
response = this.getRequestList ("vnfType", networkType, version);
} else {
@@ -216,7 +216,7 @@ public class NetworkInfoHandler {
MsoLogger.setLogContext (requestId, null);
getMsoLogger ().debug ("getRequest: " + requestId);
- String responseString = null;
+ String responseString;
InfraActiveRequests activeReq = (RequestsDatabase.getInstance()).getRequestFromInfraActive (requestId, "NETWORK");
if (activeReq != null) {
@@ -239,7 +239,7 @@ public class NetworkInfoHandler {
queryValue,
"NETWORK");
- List <NetworkRequest> queryResponseList = new LinkedList <NetworkRequest> ();
+ List <NetworkRequest> queryResponseList = new LinkedList <> ();
if (activeReqList != null) {
// build response for active
@@ -283,7 +283,7 @@ public class NetworkInfoHandler {
}
private List <NetworkRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
- List <NetworkRequest> queryResponseList = new LinkedList <NetworkRequest> ();
+ List <NetworkRequest> queryResponseList = new LinkedList <> ();
for (InfraRequests ar : arList) {
NetworkRequest qr = fillGeneric (ar);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
index 395b2529f5..981fee9fb6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkRequestHandler.java
@@ -114,7 +114,7 @@ public class NetworkRequestHandler {
+ aicNodeClli
+ " - tenant id "
+ tenantId);
- Response response = null;
+ Response response;
if (networkType != null) {
response = this.getRequestList ("vnfType", networkType, version);
} else {
@@ -244,7 +244,7 @@ public class NetworkRequestHandler {
MsoLogger.setLogContext (requestId, null);
getMsoLogger ().debug ("getRequest: " + requestId);
- String responseString = null;
+ String responseString;
InfraActiveRequests activeReq = requestDB.getRequestFromInfraActive (requestId, "NETWORK");
if (activeReq != null) {
@@ -267,7 +267,7 @@ public class NetworkRequestHandler {
queryValue,
"NETWORK");
- List <NetworkRequest> queryResponseList = new LinkedList <NetworkRequest> ();
+ List <NetworkRequest> queryResponseList = new LinkedList <> ();
if (activeReqList != null) {
// build response for active
@@ -311,7 +311,7 @@ public class NetworkRequestHandler {
}
private List <NetworkRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
- List <NetworkRequest> queryResponseList = new LinkedList <NetworkRequest> ();
+ List <NetworkRequest> queryResponseList = new LinkedList <> ();
for (InfraRequests ar : arList) {
NetworkRequest qr = fillGeneric (ar);
@@ -383,7 +383,6 @@ public class NetworkRequestHandler {
}
private Response manageNetworkRequestImpl (String reqXML, String version) {
- String methodName = "NetworkRequest";
props = MsoPropertiesUtils.loadMsoProperties ();
@@ -577,7 +576,7 @@ public class NetworkRequestHandler {
msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ());
response = requestClient.post (msoRequest.getRequestXML (),
requestId,
- Integer.toString (recipe.getRecipeTimeout ()).toString (),
+ Integer.toString (recipe.getRecipeTimeout ()),
version,
null,
null);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java
index cb4b94ce3a..beb26af88b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandler.java
@@ -1,3 +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.apihandlerinfra;
import javax.ws.rs.GET;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java
index 2b7511a22e..e68093e166 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestActionMap.java
@@ -30,7 +30,7 @@ public class RequestActionMap {
private static final Map<String, String> actionMap;
static {
- actionMap = new HashMap<String, String>();
+ actionMap = new HashMap<>();
actionMap.put("CREATE_VF_MODULE", "createInstance");
actionMap.put("DELETE_VF_MODULE", "deleteInstance");
actionMap.put("UPDATE_VF_MODULE", "updateInstance");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
index a1fa8206a8..57720dcfba 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java
@@ -48,7 +48,6 @@ public class VfModuleModelNamesHandler {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
private static final String LOG_SERVICE_NAME = "InfrastructurePortal:MSO-APIH.";
- private static final String LOG_REPLY_NAME = "MSO-APIH:InfrastructurePortal.";
@GET
@ApiOperation(value="Finds Vf Module Model Names",response=Response.class)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
index c87d450cef..7071ed50c3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfInfoHandler.java
@@ -87,7 +87,7 @@ public class VnfInfoHandler {
+ " volume-group-id:" + volumeGroupId
+ " volume-group-name:" + volumeGroupName
+ " vnf-name: " + vnfName);
- Response response = null;
+ Response response;
if (vnfType != null) {
response = this.getRequestList ("vnfType", vnfType, version);
} else {
@@ -253,7 +253,7 @@ public class VnfInfoHandler {
getMsoLogger ().debug ("getRequest: " + requestId);
- String responseString = null;
+ String responseString;
InfraActiveRequests activeReq = (RequestsDatabase.getInstance()).getRequestFromInfraActive (requestId, getRequestType ());
if (activeReq != null) {
@@ -276,7 +276,7 @@ public class VnfInfoHandler {
queryValue,
getRequestType ());
- List <VnfRequest> queryResponseList = new LinkedList <VnfRequest> ();
+ List <VnfRequest> queryResponseList = new LinkedList <> ();
if (activeReqList != null) {
// build response for active
@@ -320,7 +320,7 @@ public class VnfInfoHandler {
}
private List <VnfRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
- List <VnfRequest> queryResponseList = new LinkedList <VnfRequest> ();
+ List <VnfRequest> queryResponseList = new LinkedList <> ();
for (InfraRequests ar : arList) {
VnfRequest qr = fillGeneric (ar);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
index 1891c00521..6618fcfb00 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeInfoHandler.java
@@ -84,7 +84,7 @@ public class VolumeInfoHandler {
+ " tenant-id:" + tenantId
+ " volume-group-id:" + volumeGroupId
+ " volume-group-name:" + volumeGroupName);
- Response response = null;
+ Response response;
if (vnfType != null) {
response = this.getRequestList ("vnfType", vnfType, version);
} else {
@@ -233,7 +233,7 @@ public class VolumeInfoHandler {
getMsoLogger ().debug ("getRequest: " + requestId);
- String responseString = null;
+ String responseString;
InfraActiveRequests activeReq = (RequestsDatabase.getInstance()).getRequestFromInfraActive (requestId,
"VOLUME");
@@ -257,7 +257,7 @@ public class VolumeInfoHandler {
queryValue,
"VOLUME");
- List <VolumeRequest> queryResponseList = new LinkedList <VolumeRequest> ();
+ List <VolumeRequest> queryResponseList = new LinkedList <> ();
if (activeReqList != null) {
// build response for active
@@ -302,7 +302,7 @@ public class VolumeInfoHandler {
}
private List <VolumeRequest> infraRequestsResponses (List <? extends InfraRequests> arList, String version) {
- List <VolumeRequest> queryResponseList = new LinkedList <VolumeRequest> ();
+ List <VolumeRequest> queryResponseList = new LinkedList <> ();
for (InfraRequests ar : arList) {
VolumeRequest qr = fillGeneric (ar);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
index ee789a60ca..d1d8544763 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java
@@ -1,3 +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.apihandlerinfra;