diff options
Diffstat (limited to 'ecd-app-common')
7 files changed, 62 insertions, 31 deletions
diff --git a/ecd-app-common/pom.xml b/ecd-app-common/pom.xml index fcfcdb8..07aea5d 100644 --- a/ecd-app-common/pom.xml +++ b/ecd-app-common/pom.xml @@ -1,25 +1,15 @@ <?xml version="1.0"?> -<!-- - =============LICENSE_START========================================================= - - ================================================================================= - Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. - ================================================================================ - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ============LICENSE_END========================================================= - - ECOMP is a trademark and service mark of AT&T Intellectual Property. - --> +<!-- =============LICENSE_START========================================================= + ================================================================================= + Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); you may not + use this file except in compliance with the License. You may obtain a copy + of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required + by applicable law or agreed to in writing, software distributed under the + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS + OF ANY KIND, either express or implied. See the License for the specific + language governing permissions and limitations under the License. ============LICENSE_END========================================================= + ECOMP is a trademark and service mark of AT&T Intellectual Property. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> @@ -138,6 +128,16 @@ </executions> </plugin> + <!-- no deployment needed --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> </build> 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."); } |