summaryrefslogtreecommitdiffstats
path: root/ecd-app-common/src
diff options
context:
space:
mode:
authorChristopher Lott (cl778h) <clott@research.att.com>2017-08-17 21:59:09 -0400
committerChristopher Lott (cl778h) <clott@research.att.com>2017-08-17 22:00:09 -0400
commita6214cfb46570297c71fea29ee68014892a2484b (patch)
tree36dc070100fad4e79161e0b157f0b26a33e405bb /ecd-app-common/src
parent9015d0d86d23a83e578ded1bd95485d467515208 (diff)
Revise for Jenkins failure, reviewer comments
1. Add skip-deploy plugin config. 2. Define an application exception and use it. Issue: CCSDK-61 Change-Id: I9ad527ff2169619edbb0a1f27576ae47413b9ee4 Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecd-app-common/src')
-rw-r--r--ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/CloudifyController.java7
-rw-r--r--ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/ConsulController.java5
-rw-r--r--ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/DashboardHomeController.java5
-rw-r--r--ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/DashboardRestrictedBaseController.java3
-rw-r--r--ecd-app-common/src/main/java/org/onap/oom/dashboard/exception/OOMDashboardException.java26
-rw-r--r--ecd-app-common/src/main/java/org/onap/oom/dashboard/rest/ControllerRestClientMockImpl.java5
6 files changed, 41 insertions, 10 deletions
diff --git a/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/CloudifyController.java b/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/CloudifyController.java
index 31e888c..ed2c903 100644
--- a/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/CloudifyController.java
+++ b/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/CloudifyController.java
@@ -31,6 +31,7 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.onap.oom.dashboard.exception.OOMDashboardException;
import org.onap.oom.dashboard.model.CloudifyBlueprint;
import org.onap.oom.dashboard.model.CloudifyBlueprintUpload;
import org.onap.oom.dashboard.model.CloudifyDeployment;
@@ -123,7 +124,7 @@ public class CloudifyController extends DashboardRestrictedBaseController {
* @param pageSize
* Number of items per browser page
* @return JSON block as String, see above.
- * @throws Exception
+ * @throws OOMDashboardException
* On any error; e.g., Network failure.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -141,7 +142,7 @@ public class CloudifyController extends DashboardRestrictedBaseController {
Collections.sort(itemList, deploymentComparator);
break;
default:
- throw new Exception("getItemListForPage failed: unimplemented case: " + option.name());
+ throw new OOMDashboardException("getItemListForPage failed: unimplemented case: " + option.name());
}
// Shrink if needed
@@ -169,7 +170,7 @@ public class CloudifyController extends DashboardRestrictedBaseController {
try {
User appUser = UserUtils.getUserSession(request);
if (appUser == null || appUser.getLoginId() == null || appUser.getLoginId().length() == 0)
- throw new Exception("getItemListForPageWrapper: Failed to get application user");
+ throw new OOMDashboardException("getItemListForPageWrapper: Failed to get application user");
int pageNum = getRequestPageNumber(request);
int pageSize = getRequestPageSize(request);
outboundJson = getItemListForPage(appUser.getId(), option, pageNum, pageSize);
diff --git a/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/ConsulController.java b/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/ConsulController.java
index 06e80e9..5d75759 100644
--- a/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/ConsulController.java
+++ b/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/ConsulController.java
@@ -31,6 +31,7 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
+import org.onap.oom.dashboard.exception.OOMDashboardException;
import org.onap.oom.dashboard.model.ConsulHealthServiceRegistration;
import org.onap.oom.dashboard.model.ConsulNodeInfo;
import org.onap.oom.dashboard.model.ConsulServiceHealth;
@@ -134,7 +135,7 @@ public class ConsulController extends DashboardRestrictedBaseController {
itemList = restClient.getDatacenters();
break;
default:
- throw new Exception("getItemListForPage failed: unimplemented case: " + option.name());
+ throw new OOMDashboardException("getItemListForPage failed: unimplemented case: " + option.name());
}
// Shrink if needed
@@ -161,7 +162,7 @@ public class ConsulController extends DashboardRestrictedBaseController {
try {
User appUser = UserUtils.getUserSession(request);
if (appUser == null || appUser.getLoginId() == null || appUser.getLoginId().length() == 0)
- throw new Exception("getItemListForPageWrapper: Failed to get application user");
+ throw new OOMDashboardException("getItemListForPageWrapper: Failed to get application user");
int pageNum = getRequestPageNumber(request);
int pageSize = getRequestPageSize(request);
outboundJson = getItemListForPage(appUser.getId(), option, pageNum, pageSize);
diff --git a/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/DashboardHomeController.java b/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/DashboardHomeController.java
index 997e5dd..a0c521d 100644
--- a/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/DashboardHomeController.java
+++ b/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/DashboardHomeController.java
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import org.onap.oom.dashboard.domain.ControllerEndpoint;
+import org.onap.oom.dashboard.exception.OOMDashboardException;
import org.onap.oom.dashboard.model.ControllerEndpointCredentials;
import org.onap.oom.dashboard.model.ControllerEndpointTransport;
import org.onap.oom.dashboard.model.RestResponseError;
@@ -106,7 +107,7 @@ public class DashboardHomeController extends DashboardRestrictedBaseController {
try {
User appUser = UserUtils.getUserSession(request);
if (appUser == null || appUser.getLoginId() == null || appUser.getLoginId().length() == 0)
- throw new Exception("getControllers: Failed to get application user");
+ throw new OOMDashboardException("getControllers: Failed to get application user");
ControllerEndpointCredentials selectedInDb = getOrSetControllerEndpointSelection(appUser.getId());
// Built result from properties
ArrayList<ControllerEndpointTransport> list = new ArrayList<>();
@@ -147,7 +148,7 @@ public class DashboardHomeController extends DashboardRestrictedBaseController {
String outboundJson = null;
User appUser = UserUtils.getUserSession(request);
if (appUser == null || appUser.getLoginId() == null || appUser.getLoginId().length() == 0)
- throw new Exception("setControllerSelection: Failed to get application user");
+ throw new OOMDashboardException("setControllerSelection: Failed to get application user");
ControllerEndpoint dbEntry = new ControllerEndpoint(appUser.getId(), endpoint.getName(), endpoint.getUrl());
controllerEndpointService.updateControllerEndpointSelection(dbEntry);
RestResponseSuccess success = new RestResponseSuccess("Updated selection to " + endpoint.getName());
diff --git a/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/DashboardRestrictedBaseController.java b/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/DashboardRestrictedBaseController.java
index c921608..28b336c 100644
--- a/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/DashboardRestrictedBaseController.java
+++ b/ecd-app-common/src/main/java/org/onap/oom/dashboard/controller/DashboardRestrictedBaseController.java
@@ -28,6 +28,7 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.onap.oom.dashboard.domain.ControllerEndpoint;
+import org.onap.oom.dashboard.exception.OOMDashboardException;
import org.onap.oom.dashboard.model.ControllerEndpointCredentials;
import org.onap.oom.dashboard.rest.ControllerRestClientImpl;
import org.onap.oom.dashboard.rest.ControllerRestClientMockImpl;
@@ -237,7 +238,7 @@ public class DashboardRestrictedBaseController extends RestrictedBaseController
protected IControllerRestClient getControllerRestClient(HttpServletRequest request) throws Exception {
User appUser = UserUtils.getUserSession(request);
if (appUser == null || appUser.getLoginId() == null || appUser.getLoginId().length() == 0)
- throw new Exception("getControllerRestClient: Failed to get application user");
+ throw new OOMDashboardException("getControllerRestClient: Failed to get application user");
return getControllerRestClient(appUser.getId());
}
diff --git a/ecd-app-common/src/main/java/org/onap/oom/dashboard/exception/OOMDashboardException.java b/ecd-app-common/src/main/java/org/onap/oom/dashboard/exception/OOMDashboardException.java
new file mode 100644
index 0000000..5fac7c5
--- /dev/null
+++ b/ecd-app-common/src/main/java/org/onap/oom/dashboard/exception/OOMDashboardException.java
@@ -0,0 +1,26 @@
+package org.onap.oom.dashboard.exception;
+
+/**
+ * A little something to placate the Sonar code-analysis tool.
+ */
+public class OOMDashboardException extends Exception {
+
+ private static final long serialVersionUID = -1373841666122351816L;
+
+ public OOMDashboardException() {
+ super();
+ }
+
+ public OOMDashboardException(String message) {
+ super(message);
+ }
+
+ public OOMDashboardException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public OOMDashboardException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/ecd-app-common/src/main/java/org/onap/oom/dashboard/rest/ControllerRestClientMockImpl.java b/ecd-app-common/src/main/java/org/onap/oom/dashboard/rest/ControllerRestClientMockImpl.java
index bd855ea..b8f5d77 100644
--- a/ecd-app-common/src/main/java/org/onap/oom/dashboard/rest/ControllerRestClientMockImpl.java
+++ b/ecd-app-common/src/main/java/org/onap/oom/dashboard/rest/ControllerRestClientMockImpl.java
@@ -30,6 +30,7 @@ import java.util.List;
import java.util.Map;
import java.util.Scanner;
+import org.onap.oom.dashboard.exception.OOMDashboardException;
import org.onap.oom.dashboard.model.CloudifyBlueprintContent;
import org.onap.oom.dashboard.model.CloudifyBlueprintList;
import org.onap.oom.dashboard.model.CloudifyBlueprintUpload;
@@ -73,7 +74,7 @@ public class ControllerRestClientMockImpl implements IControllerRestClient {
try {
InputStream is = getClass().getResourceAsStream(path);
if (is == null)
- throw new Exception("Failed to find resource at path " + path);
+ throw new OOMDashboardException("Failed to find resource at path " + path);
Scanner scanner = new Scanner(is, "UTF-8");
result = scanner.useDelimiter("\\A").next();
scanner.close();
@@ -303,7 +304,7 @@ public class ControllerRestClientMockImpl implements IControllerRestClient {
List<ConsulServiceHealthHistory> list9 = client.getServiceHealthHistory("mock", Instant.now(), Instant.now());
if (list1 == null || list2 == null || list3 == null || list4 == null || list5 == null || list6 == null
|| list7 == null || list8 == null || list9 == null)
- throw new Exception("Failed");
+ throw new OOMDashboardException("Failed");
System.out.println("Pass.");
}