diff options
46 files changed, 216 insertions, 211 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-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/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/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-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..7473950063 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 @@ -199,7 +199,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 +264,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..6dc0dc35d9 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 @@ -240,9 +240,6 @@ public class BpelRestClient { 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 +257,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); } diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java index 27a21ecced..11199dc04b 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java @@ -573,6 +573,8 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller { "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e);
}
+ } finally {
+ catalogDB.close();
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNO.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNO.java index e573c41a70..caa3ff58e9 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNO.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNO.java @@ -47,7 +47,7 @@ public class SDNO implements Serializable @JsonProperty("body") private Body body; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + private Map<String, Object> additionalProperties = new HashMap<>(); private final static long serialVersionUID = -5303297382564282650L; @JsonProperty("operation") diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java index ec628e7659..950dc7b83b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java @@ -22,6 +22,7 @@ package org.openecomp.mso.client.sdno; import java.io.IOException; +@FunctionalInterface public interface SDNOValidator { void healthDiagnostic(String vnfName, String uuid) throws IOException, Exception; diff --git a/common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java b/common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java index d639978770..2988e30254 100644 --- a/common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java +++ b/common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java @@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentHashMap; public abstract class AbstractSessionFactoryManager { - protected static Map<String, SessionFactory> sessionFactories = new ConcurrentHashMap<String, SessionFactory>(); + protected static Map<String, SessionFactory> sessionFactories = new ConcurrentHashMap<>(); protected synchronized SessionFactory initializeSessionFactory(URL hibernateConfigFile) throws MsoDatabaseException { diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java index 8367f9f0e5..b99cd1a843 100644 --- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java +++ b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2JsonFactory.java @@ -57,21 +57,28 @@ public class TransformJava2JsonFactory extends TYangJsonXmlBase { @Override protected void setupWithDataBroker(final DataBroker dataBroker) { // Intentionally left No-op, subclasses may customize it - mappingservice = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), - new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault())))); - moduleInfoBackedContext = ModuleInfoBackedContext.create(); + // moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(SncTunnels.class)); try { + mappingservice = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), + new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault())))); + moduleInfoBackedContext = ModuleInfoBackedContext.create(); + for (YangModuleInfo yangModuleInfo : getModuleInfos()) { moduleInfoBackedContext.registerModuleInfo(yangModuleInfo); } + schemaContext = moduleInfoBackedContext.tryToCreateSchemaContext().get(); + mappingservice.onGlobalContextUpdated(schemaContext); + controllerContext.setSchemas(schemaContext); } catch (Exception e) { e.printStackTrace(); + } finally { + if(null != mappingservice){ + mappingservice.close(); + } } - schemaContext = moduleInfoBackedContext.tryToCreateSchemaContext().get(); - mappingservice.onGlobalContextUpdated(schemaContext); - controllerContext.setSchemas(schemaContext); + } diff --git a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java index f1c98c82a8..85959882c4 100644 --- a/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java +++ b/common/src/main/java/org/openecomp/mso/yangDecoder/transform/impl/TransformJava2XMLFactory.java @@ -57,20 +57,28 @@ public class TransformJava2XMLFactory extends TYangJsonXmlBase { @Override protected void setupWithDataBroker(final DataBroker dataBroker) { // Intentionally left No-op, subclasses may customize it - mappingservice = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), - new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault())))); - moduleInfoBackedContext = ModuleInfoBackedContext.create(); + // moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(SncTunnels.class)); try { + mappingservice = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), + new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault())))); + moduleInfoBackedContext = ModuleInfoBackedContext.create(); + for (YangModuleInfo yangModuleInfo : getModuleInfos()) { moduleInfoBackedContext.registerModuleInfo(yangModuleInfo); } + + schemaContext = moduleInfoBackedContext.tryToCreateSchemaContext().get(); + mappingservice.onGlobalContextUpdated(schemaContext); + controllerContext.setSchemas(schemaContext); } catch (Exception e) { e.printStackTrace(); + } finally { + if(null != mappingservice){ + mappingservice.close(); + } } - schemaContext = moduleInfoBackedContext.tryToCreateSchemaContext().get(); - mappingservice.onGlobalContextUpdated(schemaContext); - controllerContext.setSchemas(schemaContext); + } 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-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java index 353246f576..b498259eed 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/XMLValidator.java @@ -65,7 +65,7 @@ public class XMLValidator { stringXsd = IOUtils.toString (xsdStream); factory = SchemaFactory.newInstance (XMLConstants.W3C_XML_SCHEMA_NS_URI); - factory.setResourceResolver ((new PathResourceResolver (XSDS_PATH))); + factory.setResourceResolver (new PathResourceResolver (XSDS_PATH)); factory.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); String quotedXsd = stringXsd.replaceAll (""", "\""); @@ -90,7 +90,7 @@ public class XMLValidator { } catch (IOException | SAXException e) { msoLogger.debug ("Exception: ", e); - return ("ErrorDetails: " + e.getMessage ()); + return "ErrorDetails: " + e.getMessage (); } catch (Exception e) { msoLogger.error (MessageEnum.APIH_CANNOT_READ_SCHEMA, "", "", MsoLogger.ErrorCode.SchemaError, "APIH cannot read schema file", e); 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/Messages.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Messages.java index 0f39ad07b6..91bf2df48c 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"); @@ -46,4 +46,7 @@ public class Messages { errors.put(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, "Could not communicate with MSO_CATALOG DB %s"); errors.put(ErrorNumbers.ERROR_FROM_CATALOG_DB, "Received error from MSO_CATALOG DB %s"); } + + private Messages(){ + } } 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/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/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java index 325d2f8bdd..ae6ffd3470 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java @@ -110,12 +110,13 @@ public class E2EServiceInstancesTest { }
};
- /*E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
- assertTrue(resp.getStatus() == 202);*/
+ E2EServiceInstances instance = new E2EServiceInstances();
+ System.out.println(instance);
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
+ assertTrue(resp.getStatus() == 202);
}
-
+
@Test
public void createE2EServiceInstanceTestBpelHTTPException(){
new MockUp<RequestsDatabase>() {
@@ -173,11 +174,11 @@ public class E2EServiceInstancesTest { }
};
- /*E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);*/
+ assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);
}
@Test
@@ -237,11 +238,11 @@ public class E2EServiceInstancesTest { }
};
- /*E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);*/
+ assertTrue(respStr.indexOf("Request Failed due to BPEL error with HTTP Status") != -1);
}
@Test
@@ -289,11 +290,11 @@ public class E2EServiceInstancesTest { }
};
- /*E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("bpelResponse is null") != -1);*/
+ assertTrue(respStr.indexOf("bpelResponse is null") != -1);
}
@Test
@@ -338,11 +339,11 @@ public class E2EServiceInstancesTest { }
};
- /* E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Failed calling bpmn null") != -1);*/
+ assertTrue(respStr.indexOf("Failed calling bpmn null") != -1);
}
@Test
@@ -368,11 +369,11 @@ public class E2EServiceInstancesTest { return rec;
}
};
- /*E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Failed calling bpmn properties is null") != -1);*/
+ assertTrue(respStr.indexOf("Failed calling bpmn properties is null") != -1);
}
@Test
@@ -383,11 +384,11 @@ public class E2EServiceInstancesTest { return null;
}
};
- /*E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"E2EService\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB null") != -1);*/
+ assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB null") != -1);
}
@Test
@@ -398,11 +399,11 @@ public class E2EServiceInstancesTest { return null;
}
};
- /*E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Recipe does not exist in catalog DB") != -1);*/
+ assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") != -1);
}
@Test
@@ -418,11 +419,11 @@ public class E2EServiceInstancesTest { return activeReqlist;
}
};
- /* E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("The existing request must finish or be cleaned up before proceeding.") != -1);*/
+ assertTrue(respStr.indexOf("The existing request must finish or be cleaned up before proceeding.") != -1);
}
@Test
@@ -433,37 +434,37 @@ public class E2EServiceInstancesTest { return Collections.EMPTY_LIST;
}
};
- /* E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Recipe does not exist in catalog DB") != -1);*/
+ assertTrue(respStr.indexOf("Recipe could not be retrieved from catalog DB ") != -1);
}
@Test
public void createE2EServiceInstanceTestDBQueryFail(){
- /* E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);*/
+ assertTrue(respStr.indexOf("SVC2000") != -1);
}
@Test
public void createE2EServiceInstanceTestForEmptyRequest(){
- /*E2EServiceInstances instance = new E2EServiceInstances();
+ E2EServiceInstances instance = new E2EServiceInstances();
String request = "";
- Response resp = instance.createE2EServiceInstance(request, "v2");
+ Response resp = instance.createE2EServiceInstance(request, "v3");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);*/
+ assertTrue(respStr.indexOf("Mapping of request to JSON object failed. No content to map to Object due to end of input") != -1);
}
@Test
public void deleteE2EServiceInstanceTestNormal(){
- /* E2EServiceInstances instance = new E2EServiceInstances();
- String request = "{\"service\":{\"name\":\"e2eservice\",\"serviceDefId\":\"37889593\",\"templateId\":\"2000039\",\"parameters\":{\"domainHost\":\"test\"}}}";
- Response resp = instance.deleteE2EServiceInstance(request, "v2");
+ E2EServiceInstances instance = new E2EServiceInstances();
+ String request = "{\"service\":{\"name\":\"service\",\"description\":\"so_test1\",\"serviceDefId\":\"modelInvariantId value from SDC?\",\"templateId\":\"modelVersionId value from SDC??\",\"parameters\":{\"domainHost\":\"localhost\",\"nodeTemplateName\":\"modelName:v3\",\"nodeType\":\"service\",\"globalSubscriberId\":\"NEED THIS UUI - AAI\",\"subscriberName\":\"NEED THIS UUI - AAI\",\"requestParameters\":{\"subscriptionServiceType\":\"MOG\",\"userParams\":[{\"name\":\"someUserParam\",\"value\":\"someValue\"},{\"name\":\"segments\",\"value\":\"value\"},{\"name\":\"nsParameters\",\"value\":\"othervalue\"}]}}}}";
+ Response resp = instance.deleteE2EServiceInstance(request, "v3", "12345678");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.indexOf("SVC2000") != -1);*/
+ assertTrue(respStr.indexOf("SVC2000") != -1);
}
}
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java index 455620784d..dd628bb863 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java @@ -87,7 +87,7 @@ public class HeatEnvironment extends MavenLikeVersioning implements Serializable @Override public String toString () { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append ("Artifact UUID=" + this.artifactUuid); sb.append (", name="); sb.append (name); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java index e38e598d57..b90578d369 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java @@ -82,10 +82,13 @@ public class HeatFiles extends MavenLikeVersioning implements Serializable { public void setAsdcUuid(String artifactUuid) { this.artifactUuid = artifactUuid; } + + @Override public String getVersion() { return version; } + @Override public void setVersion(String version) { this.version = version; } @@ -99,7 +102,7 @@ public class HeatFiles extends MavenLikeVersioning implements Serializable { @Override public String toString () { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append ("artifactUuid=" + this.artifactUuid); if (this.description == null) { sb.append(", description=null"); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java index d59f49a533..eec0f410c6 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java @@ -90,7 +90,7 @@ public class HeatNestedTemplate implements Serializable { public int hashCode () { // hash code does not have to be a unique result - only that two objects that should be treated as equal // return the same value. so this should work. - int result = 0; + int result; result = this.parentTemplateId.hashCode() + this.childTemplateId.hashCode(); return result; } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java index b17fea460e..03813a7299 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java @@ -26,14 +26,11 @@ import java.text.DateFormat; import java.util.Set; import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; -import org.openecomp.mso.logger.MsoLogger; public class HeatTemplate extends MavenLikeVersioning implements Serializable { private static final long serialVersionUID = 768026109321305392L; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); - private String artifactUuid; private String templateName; private String templateBody = null; diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java index 96aa2c22bc..2c79d7d48c 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java @@ -73,7 +73,7 @@ public class HeatTemplateArtifactUuidModelUuid implements Serializable { public int hashCode () {
// hash code does not have to be a unique result - only that two objects that should be treated as equal
// return the same value. so this should work.
- int result = 0;
+ int result;
result = this.heatTemplateArtifactUuid.hashCode() + this.modelUuid.hashCode();
return result;
}
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java index 68b881e652..7ceb19c5a0 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java @@ -89,7 +89,7 @@ public class HeatTemplateParam implements Serializable { @Override public int hashCode () { - int result = 0; + int result; result = this.paramName == null ? 0 : this.paramName.hashCode() + this.heatTemplateArtifactUuid == null ? 0 : this.heatTemplateArtifactUuid.hashCode(); return result; } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java index f119259fd0..9ef1fb6fd3 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java @@ -45,7 +45,7 @@ public class NetworkRecipe extends Recipe implements Serializable { @Override public String toString () { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append (",modelName=" + modelName); sb.append (",networkParamXSD=" + networkParamXSD); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java index a3c8468cb1..b6151f176d 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java @@ -142,7 +142,7 @@ public class NetworkResource extends MavenLikeVersioning implements Serializable @Override public String toString () { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("NETWORK Resource:"); sb.append("modelVersion="); sb.append(modelVersion); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java index 19660f3fbb..ef09fef41f 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java @@ -104,7 +104,7 @@ public class NetworkResourceCustomization implements Serializable{ @Override public String toString () { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("modelCustomizationUuid="); sb.append(this.modelCustomizationUuid); sb.append("networkResourceModelUuid="); @@ -143,9 +143,9 @@ public class NetworkResourceCustomization implements Serializable{ public int hashCode () { // hash code does not have to be a unique result - only that two objects that should be treated as equal // return the same value. so this should work. - int result = 0; + int result; result = (this.modelCustomizationUuid != null ? this.modelCustomizationUuid.hashCode() : 0) + (this.networkResourceModelUuid != null ? this.networkResourceModelUuid.hashCode() : 0); return result; } -}
\ No newline at end of file +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java index 3aad334a18..20801c105e 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java @@ -91,7 +91,7 @@ public class TempNetworkHeatTemplateLookup implements Serializable { public int hashCode () {
// hash code does not have to be a unique result - only that two objects that should be treated as equal
// return the same value. so this should work.
- int result = 0;
+ int result;
result = (this.networkResourceModelName != null ? this.networkResourceModelName.hashCode() : 0) + (this.heatTemplateArtifactUuid != null ? this.heatTemplateArtifactUuid.hashCode() : 0);
return result;
}
|