summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common/src
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-BE-common/src')
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java6
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java11
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java7
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java16
-rw-r--r--ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java53
-rw-r--r--ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppExceptionTest.java3
-rw-r--r--ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java56
7 files changed, 136 insertions, 16 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java
index d36cf6cb..33006c92 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java
@@ -54,6 +54,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
import io.swagger.annotations.ApiOperation;
@@ -75,14 +77,14 @@ public class SessionCommunicationController extends EPRestrictedRESTfulBaseCont
@ApiOperation(value = "Gets session slot-check interval, a duration in milliseconds.",
response = Integer.class)
- @RequestMapping(value={"/getSessionSlotCheckInterval"}, method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value={"/getSessionSlotCheckInterval"}, produces = "application/json")
public Integer getSessionSlotCheckInterval(HttpServletRequest request, HttpServletResponse response) throws Exception {
return manageService.fetchSessionSlotCheckInterval();
}
@ApiOperation(value = "Extends session timeout values for all on-boarded applications.",
response = Boolean.class)
- @RequestMapping(value={"/extendSessionTimeOuts"}, method = RequestMethod.POST)
+ @PostMapping(value={"/extendSessionTimeOuts"})
public Boolean extendSessionTimeOuts(HttpServletRequest request, HttpServletResponse response, @RequestParam String sessionMap) {
manageService.extendSessionTimeOuts(sessionMap);
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java
index 46f96d66..12deabe3 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright © 2018 AT&T Intellectual Property. All rights reserved.
* ===================================================================
+ * Modifications Copyright (c) 2020 IBM
+ * ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the "License");
@@ -55,12 +57,11 @@ public class MusicSessionRepositoryHandler {
public Session get(String id) {
if(musicCache){
- // todo need to add the clean up for "sessions" map if musicCache is enabled
+ // need to add the clean up for "sessions" map if musicCache is enabled
return this.sessions.get(id);
}else{
try {
- Session session = MusicService.getMetaAttribute(id);
- return session;
+ return MusicService.getMetaAttribute(id);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "get failed with id " + id, e);
return null;
@@ -72,7 +73,7 @@ public class MusicSessionRepositoryHandler {
public void remove(String id) {
if(musicCache){
- // todo need to add the clean up for "sessions" map if musicCache is enabled
+ // need to add the clean up for "sessions" map if musicCache is enabled
sessions.remove(id);
}else{
try {
@@ -87,7 +88,7 @@ public class MusicSessionRepositoryHandler {
public void put(String id, MusicSession musicSession) {
if(musicCache){
- // todo need to add the clean up for "sessions" map if musicCache is enabled
+ //need to add the clean up for "sessions" map if musicCache is enabled
sessions.put(id, musicSession);
}else{
try {
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java
index 557e4dc3..6ff16fc8 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java
@@ -62,6 +62,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+
@RestController
@org.springframework.context.annotation.Configuration
@@ -90,7 +93,7 @@ public class AppCatalogController extends EPRestrictedBaseController {
* @throws IOException If sendError fails
* @return List of items suitable for display
*/
- @RequestMapping(value = { "/portalApi/appCatalog" }, method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = { "/portalApi/appCatalog" }, produces = "application/json")
public List<AppCatalogItem> getAppCatalog(HttpServletRequest request, HttpServletResponse response)
throws IOException {
EPUser user = EPUserUtils.getUserSession(request);
@@ -125,7 +128,7 @@ public class AppCatalogController extends EPRestrictedBaseController {
* @return FieldsValidator
* @throws IOException If sendError fails
*/
- @RequestMapping(value = { "/portalApi/appCatalog" }, method = RequestMethod.PUT, produces = "application/json")
+ @PutMapping(value = { "/portalApi/appCatalog" }, produces = "application/json")
public FieldsValidator putAppCatalogSelection(HttpServletRequest request,
@RequestBody AppCatalogPersonalization persRequest, HttpServletResponse response) throws IOException {
FieldsValidator result = new FieldsValidator();
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java
index 8f456fde..e9119de8 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java
@@ -63,6 +63,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
@RestController
@RequestMapping("/portalApi/contactus")
@@ -94,7 +96,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
* @param request HttpServletRequest
* @return PortalRestResponse
*/
- @RequestMapping(value = "/feedback", method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = "/feedback", produces = "application/json")
public PortalRestResponse<String> getPortalDetails(HttpServletRequest request) {
PortalRestResponse<String> portalRestResponse;
try {
@@ -123,7 +125,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
* @param request HttpServletRequest
* @return PortalRestResponse<List<AppContactUsItem>>
*/
- @RequestMapping(value = "/list", method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = "/list", produces = "application/json")
public PortalRestResponse<List<AppContactUsItem>> getAppContactUsList(HttpServletRequest request) {
PortalRestResponse<List<AppContactUsItem>> portalRestResponse;
try {
@@ -145,7 +147,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
* @param request HttpServletRequest
* @return PortalRestResponse<List<AppContactUsItem>>
*/
- @RequestMapping(value = "/allapps", method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = "/allapps", produces = "application/json")
public PortalRestResponse<List<AppContactUsItem>> getAppsAndContacts(HttpServletRequest request) {
PortalRestResponse<List<AppContactUsItem>> portalRestResponse;
try {
@@ -167,7 +169,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
* @param request HttpServletRequest
* @return PortalRestResponse<List<AppCategoryFunctionsItem>>
*/
- @RequestMapping(value = "/functions", method = RequestMethod.GET, produces = "application/json")
+ @GetMapping(value = "/functions", produces = "application/json")
public PortalRestResponse<List<AppCategoryFunctionsItem>> getAppCategoryFunctions(HttpServletRequest request) {
PortalRestResponse<List<AppCategoryFunctionsItem>> portalRestResponse;
try {
@@ -190,7 +192,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
* @param contactUs AppContactUsItem
* @return PortalRestResponse<String>
*/
- @RequestMapping(value = "/save", method = RequestMethod.POST, produces = "application/json")
+ @PostMapping(value = "/save", produces = "application/json")
public PortalRestResponse<String> save(@RequestBody AppContactUsItem contactUs) {
if (contactUs == null || contactUs.getAppName() == null) {
@@ -210,7 +212,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
return new PortalRestResponse<>(PortalRestStatusEnum.OK, saveAppContactUs, "");
}
- @RequestMapping(value = "/saveAll", method = RequestMethod.POST, produces = "application/json")
+ @PostMapping(value = "/saveAll", produces = "application/json")
public PortalRestResponse<String> save(@RequestBody List<AppContactUsItem> contactUsList) {
if (contactUsList == null) {
@@ -237,7 +239,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
* @param id app ID
* @return PortalRestResponse<String>
*/
- @RequestMapping(value = "/delete/{appid}", method = RequestMethod.POST, produces = "application/json")
+ @PostMapping(value = "/delete/{appid}", produces = "application/json")
public PortalRestResponse<String> delete(@PathVariable("appid") Long id) {
String saveAppContactUs = FAILURE;
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java
new file mode 100644
index 00000000..9154e8d0
--- /dev/null
+++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2020 IBM Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ *
+ */
+package org.onap.portalapp.portal.exceptions;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class DuplicateRecordExceptionTest {
+ @Test
+ public void Test1()
+ {
+ String s1 = "Duplicate Record";
+ DuplicateRecordException mde=new DuplicateRecordException(s1);
+ assertEquals(mde.getMessage(),"Duplicate Record");
+
+ }
+}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppExceptionTest.java
index 7109b2d0..d2958437 100644
--- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppExceptionTest.java
+++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NonCentralizedAppExceptionTest.java
@@ -39,11 +39,14 @@ package org.onap.portalapp.portal.exceptions;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
public class NonCentralizedAppExceptionTest {
@Test
public void TestException2() {
String s1 = "Value1";
NonCentralizedAppException nca = new NonCentralizedAppException(s1);
+ assertEquals(nca.toString(),"Value1 is not Centralized Application");
}
}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java
new file mode 100644
index 00000000..db17e784
--- /dev/null
+++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/RoleFunctionExceptionTest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START============================================
+ * ONAP Portal
+ * =====================================================================
+ * Copyright (C) 2020 IBM Intellectual Property. All rights reserved.
+ * =====================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END================================================
+ *
+ *
+ */
+
+package org.onap.portalapp.portal.exceptions;
+
+import org.apache.commons.codec.DecoderException;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class RoleFunctionExceptionTest {
+
+ @Test
+ public void TestRoleFunctionConstructor()
+ {
+ String s1 = "Rolefunction Exception Occured";
+ String s2 = "value2";
+ DecoderException e=new DecoderException(s2);
+ RoleFunctionException rfe=new RoleFunctionException(s1,e);
+ assertEquals(rfe.getMessage(),"Rolefunction Exception Occured");
+ }
+}