summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java15
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java (renamed from adapters/mso-catalog-db-adapter/src/main/java/org.openecomp.mso/adapters/catalogdb/CatalogDbAdapterRest.java)44
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java3
-rw-r--r--bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java16
-rw-r--r--pom.xml8
-rw-r--r--status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java4
6 files changed, 43 insertions, 47 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java
index 4cf9023b7c..7444e1c881 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java
@@ -20,7 +20,7 @@
package org.openecomp.mso.openstack.utils;
-
+import java.util.Objects;
public class MsoHeatEnvironmentParameter {
@@ -66,20 +66,11 @@ public class MsoHeatEnvironmentParameter {
}
MsoHeatEnvironmentParameter hep = (MsoHeatEnvironmentParameter) o;
// If the name of the parameter is the same, then they're equal
- if (hep.getName().equals(this.getName())) {
- return true;
- }
- return false;
+ return hep.getName().equals(this.getName());
}
public int hashCode() {
- int result = 0;
- try {
- result = this.name.hashCode();
- } catch (Exception e) {
- // in case it's null - return zero
- }
- return result;
+ return Objects.hashCode(this.name);
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org.openecomp.mso/adapters/catalogdb/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
index 729aaa0f9a..210e5e7074 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org.openecomp.mso/adapters/catalogdb/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java
@@ -124,37 +124,37 @@ public class CatalogDbAdapterRest {
String uuid = "";
List<VnfResource> ret;
- try {
+ try (CatalogDatabase db = new CatalogDatabase()) {
if (vnfUuid != null && !vnfUuid.equals("")) {
uuid = vnfUuid;
LOGGER.debug ("Query serviceVnfs getAllVnfsByVnfModelCustomizationUuid vnfModelCustomizationUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllVnfsByVnfModelCustomizationUuid(uuid);
+ ret = db.getAllVnfsByVnfModelCustomizationUuid(uuid);
}
else if (smUuid != null && !smUuid.equals("")) {
uuid = smUuid;
LOGGER.debug ("Query serviceVnfs getAllVnfsByServiceModelUuid serviceModelUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllVnfsByServiceModelUuid(uuid);
+ ret = db.getAllVnfsByServiceModelUuid(uuid);
}
else if (smiUuid != null && !smiUuid.equals("")) {
uuid = smiUuid;
if (smVer != null && !smVer.equals("")) {
LOGGER.debug ("Query serviceVnfs getAllNetworksByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer);
- ret = (new CatalogDatabase ()).getAllVnfsByServiceModelInvariantUuid(uuid, smVer);
+ ret = db.getAllVnfsByServiceModelInvariantUuid(uuid, smVer);
}
else {
LOGGER.debug ("Query serviceVnfs getAllNetworksByServiceModelInvariantUuid serviceModelUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllVnfsByServiceModelInvariantUuid(uuid);
+ ret = db.getAllVnfsByServiceModelInvariantUuid(uuid);
}
}
else if (smName != null && !smName.equals("")) {
if (smVer != null && !smVer.equals("")) {
LOGGER.debug ("Query serviceVnfs getAllVnfsByServiceName serviceModelInvariantName: " + smName+ " serviceModelVersion: "+ smVer);
- ret = (new CatalogDatabase ()).getAllVnfsByServiceName(smName, smVer);
+ ret = db.getAllVnfsByServiceName(smName, smVer);
}
else {
LOGGER.debug ("Query serviceVnfs getAllVnfsByServiceName serviceModelName: " + smName);
- ret = (new CatalogDatabase ()).getAllVnfsByServiceName(smName);
+ ret = db.getAllVnfsByServiceName(smName);
}
}
else {
@@ -203,31 +203,31 @@ public class CatalogDbAdapterRest {
String uuid = "";
List<NetworkResourceCustomization> ret;
- try {
+ try (CatalogDatabase db = new CatalogDatabase()) {
if (nUuid != null && !nUuid.equals("")) {
uuid = nUuid;
LOGGER.debug ("Query serviceNetworks getAllNetworksByNetworkModelCustomizationUuid networkModelCustomizationUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllNetworksByNetworkModelCustomizationUuid(uuid);
+ ret = db.getAllNetworksByNetworkModelCustomizationUuid(uuid);
}
else if (smUuid != null && !smUuid.equals("")) {
uuid = smUuid;
LOGGER.debug ("Query serviceNetworks getAllNetworksByServiceModelUuid serviceModelUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllNetworksByServiceModelUuid(uuid);
+ ret = db.getAllNetworksByServiceModelUuid(uuid);
}
else if (nType != null && !nType.equals("")) {
uuid = nType;
LOGGER.debug ("Query serviceNetworks getAllNetworksByNetworkType serviceModelUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllNetworksByNetworkType(uuid);
+ ret = db.getAllNetworksByNetworkType(uuid);
}
else if (smiUuid != null && !smiUuid.equals("")) {
uuid = smiUuid;
if (smVer != null && !smVer.equals("")) {
LOGGER.debug ("Query serviceNetworks getAllNetworksByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer);
- ret = (new CatalogDatabase ()).getAllNetworksByServiceModelInvariantUuid(uuid, smVer);
+ ret = db.getAllNetworksByServiceModelInvariantUuid(uuid, smVer);
}
else {
LOGGER.debug ("Query serviceNetworks getAllNetworksByServiceModelInvariantUuid serviceModelUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllNetworksByServiceModelInvariantUuid(uuid);
+ ret = db.getAllNetworksByServiceModelInvariantUuid(uuid);
}
}
else {
@@ -274,22 +274,22 @@ public class CatalogDbAdapterRest {
String uuid = "";
ServiceMacroHolder ret;
- try {
+ try (CatalogDatabase db = new CatalogDatabase()) {
if (smUuid != null && !smUuid.equals("")) {
uuid = smUuid;
LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllResourcesByServiceModelUuid(uuid);
+ ret = db.getAllResourcesByServiceModelUuid(uuid);
}
else if (smiUuid != null && !smiUuid.equals("")) {
uuid = smiUuid;
if (smVer != null && !smVer.equals("")) {
LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer);
- ret = (new CatalogDatabase ()).getAllResourcesByServiceModelInvariantUuid(uuid, smVer);
+ ret = db.getAllResourcesByServiceModelInvariantUuid(uuid, smVer);
}
else {
LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllResourcesByServiceModelInvariantUuid(uuid);
+ ret = db.getAllResourcesByServiceModelInvariantUuid(uuid);
}
}
else {
@@ -337,28 +337,28 @@ public class CatalogDbAdapterRest {
String uuid = "";
List<AllottedResourceCustomization > ret;
- try {
+ try (CatalogDatabase db = new CatalogDatabase()) {
if (smUuid != null && !smUuid.equals("")) {
uuid = smUuid;
LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByServiceModelUuid serviceModelUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllAllottedResourcesByServiceModelUuid(uuid);
+ ret = db.getAllAllottedResourcesByServiceModelUuid(uuid);
}
else if (smiUuid != null && !smiUuid.equals("")) {
uuid = smiUuid;
if (smVer != null && !smVer.equals("")) {
LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer);
- ret = (new CatalogDatabase ()).getAllAllottedResourcesByServiceModelInvariantUuid(uuid, smVer);
+ ret = db.getAllAllottedResourcesByServiceModelInvariantUuid(uuid, smVer);
}
else {
LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByServiceModelInvariantUuid serviceModelUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllAllottedResourcesByServiceModelInvariantUuid(uuid);
+ ret = db.getAllAllottedResourcesByServiceModelInvariantUuid(uuid);
}
}
else if (aUuid != null && !aUuid.equals("")) {
uuid = aUuid;
LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByArModelCustomizationUuid serviceModelUuid: " + uuid);
- ret = (new CatalogDatabase ()).getAllAllottedResourcesByArModelCustomizationUuid(uuid);
+ ret = db.getAllAllottedResourcesByArModelCustomizationUuid(uuid);
}
else {
throw(new Exception("no matching parameters"));
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java
index 114f6f246b..e2ed1a3d79 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java
@@ -69,11 +69,10 @@ public class VfResourceInstaller implements IVfResourceInstaller {
public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct)
throws ArtifactInstallerException {
- CatalogDatabase db = new CatalogDatabase();
boolean status = false;
VfResourceStructure vfResourceStructure = (VfResourceStructure)vfResourceStruct;
- try {
+ try(CatalogDatabase db = new CatalogDatabase()) {
String resourceType = vfResourceStruct.getResourceInstance().getResourceType();
String category = vfResourceStruct.getResourceInstance().getCategory();
diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java
index dfb9f36e9a..ea9ca62bf5 100644
--- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java
+++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/APIResponse.java
@@ -21,6 +21,7 @@
package org.openecomp.mso.rest;
import java.io.IOException;
+import java.util.Arrays;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
@@ -44,7 +45,7 @@ public class APIResponse {
* @param httpResponse used to create headers
* @return http headers
*/
- private HttpHeader[] buildHeaders(final HttpResponse httpResponse) {
+ private static HttpHeader[] buildHeaders(final HttpResponse httpResponse) {
final Header[] headers = httpResponse.getAllHeaders();
HttpHeader[] httpHeaders = new HttpHeader[headers.length];
@@ -102,7 +103,12 @@ public class APIResponse {
* @return http response body
*/
public byte[] getResponseBodyAsByteArray() {
- return this.responseBody;
+ // avoid exposing internals, create copy
+ if (this.responseBody != null) {
+ return Arrays.copyOf(this.responseBody, this.responseBody.length);
+ } else {
+ return null;
+ }
}
/**
@@ -125,11 +131,7 @@ public class APIResponse {
*/
public HttpHeader[] getAllHeaders() {
// avoid exposing internals, create copy
- HttpHeader[] copy = new HttpHeader[this.headers.length];
- for (int i = 0; i < this.headers.length; ++i) {
- copy[i] = headers[i];
- }
- return copy;
+ return Arrays.copyOf(this.headers, this.headers.length);
}
public String getFirstHeader(String name) {
diff --git a/pom.xml b/pom.xml
index 4d405462ee..74b9b95127 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,6 +43,7 @@
<nexusproxy>https://nexus.onap.org</nexusproxy>
<snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
<releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
+ <stagingNexusPath>/content/repositories/staging/</stagingNexusPath>
<sitePath>/content/sites/site/org/openecomp/mso/${project.version}</sitePath>
<maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
</properties>
@@ -120,8 +121,13 @@
<repository>
<id>ecomp-staging</id>
<name>MSO Staging Repository</name>
- <url>${nexusproxy}/content/repositories/staging/</url>
+ <url>${nexusproxy}/${stagingNexusPath}</url>
</repository>
+ <repository>
+ <id>ecomp-snapshots</id>
+ <name>MSO Snapshot Repository</name>
+ <url>${nexusproxy}/${snapshotNexusPath}</url>
+ </repository>
<!-- Camunda Web Repository -->
<repository>
<id>CamundaWebRepo</id>
diff --git a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java
index e0e712cd48..cd8cc7f13a 100644
--- a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java
+++ b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java
@@ -62,10 +62,8 @@ public class HealthCheckUtils {
public enum NodeType {APIH, RA, BPMN};
public boolean catalogDBCheck (MsoLogger subMsoLogger, long startTime) {
- try {
- CatalogDatabase catalogDB = new CatalogDatabase ();
+ try(CatalogDatabase catalogDB = new CatalogDatabase ()) {
catalogDB.healthCheck ();
- catalogDB.close();
} catch (Exception e) {
subMsoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Failed to check catalog database", e);
subMsoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception during healthcheck");