summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java2
-rw-r--r--ecomp-sdk/epsdk-app-common/README.md1
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java5
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/package-info.java37
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/package-info.java37
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java77
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/SanityTest.java37
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborationControllerTest.java50
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/NetMapTest.java37
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/core/MockApplicationContextTestSuite.java197
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/ProfileServiceTest.java52
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/workflow/services/WorkflowScheduleServiceTest.java57
-rw-r--r--ecomp-sdk/epsdk-app-os/README.md2
-rw-r--r--ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/lm/FusionLicenseManagerImpl.java106
-rw-r--r--ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/lm/LicenseableClassImpl.java86
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java12
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Layout.java2
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/listener/ApplicationContextListener.java64
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/FusionLicenseManager.java73
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/FusionLicenseManagerUtils.java79
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/LicenseableClass.java62
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java4
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/support/ServiceLocatorImpl.java13
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/web/support/UserUtils.java20
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java37
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/fusion/core/MockHibernateMappingLocations.java37
-rw-r--r--ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java71
-rw-r--r--ecomp-sdk/pom.xml90
28 files changed, 644 insertions, 703 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java
index 7252243b..04795bf4 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java
@@ -583,7 +583,7 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
printFooterInDownload = nvls(
raptorProperties.getProperty("print_footer_in_download"), "no")
.toUpperCase().startsWith("Y");
- footerFirstLine = nvls(raptorProperties.getProperty("footer_first_line"), "AT&T Proprietary");
+ footerFirstLine = nvls(raptorProperties.getProperty("footer_first_line"), "Raptor report");
footerSecondLine = nvls(raptorProperties.getProperty("footer_second_line"), "Use Pursuant to Company Instructions");
reportsInPoPUpWindow = nvls(
raptorProperties.getProperty("report_in_popup_window"), "no")
diff --git a/ecomp-sdk/epsdk-app-common/README.md b/ecomp-sdk/epsdk-app-common/README.md
index 1823262f..fa3e7bc4 100644
--- a/ecomp-sdk/epsdk-app-common/README.md
+++ b/ecomp-sdk/epsdk-app-common/README.md
@@ -30,6 +30,7 @@ Version 1.4.0
- PORTAL-72 Address Sonar Scan code issues
- PORTAL-90 Use approved ONAP license text
- Portal-86 Remove application specific usages from tests and other files
+- PORTAL-78 Fix SingleSignon by force session creation prior to redirection to portal
Version 1.3.0, 28 August 2017
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java
index 17630643..fb2e3b80 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java
@@ -202,6 +202,11 @@ public class SingleSignOnController extends UnRestrictedBaseController {
final String redirectUrl = portalUrl + "?uebAppKey=" + uebAppKey + "&redirectUrl=" + encodedReturnToAppUrl;
logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: portal-bound redirect URL is {}",
redirectUrl);
+
+ // this line may not be necessary but jsessionid coockie is not getting created in all cases;
+ // so force the cookie creation
+ request.getSession(true);
+
return new ModelAndView("redirect:" + redirectUrl);
}
}
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/package-info.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/package-info.java
index 3cbcb3ba..a9db4ea1 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/package-info.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/package-info.java
@@ -1,3 +1,40 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.controller.core;
/**
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/package-info.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/package-info.java
index 57b7d4a4..6b6effca 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/package-info.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/package-info.java
@@ -1,3 +1,40 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.controller.sample;
/**
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java
index 9c77441d..3efe46fd 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java
@@ -55,10 +55,14 @@ import org.onap.portalsdk.core.onboarding.client.AppContextManager;
import org.onap.portalsdk.core.onboarding.crossapi.IPortalRestAPIService;
import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
import org.onap.portalsdk.core.onboarding.listener.PortalTimeoutHandler;
+import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
+import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
import org.onap.portalsdk.core.restful.domain.EcompRole;
import org.onap.portalsdk.core.restful.domain.EcompUser;
+import org.onap.portalsdk.core.service.RestApiRequestBuilder;
import org.onap.portalsdk.core.service.RoleService;
import org.onap.portalsdk.core.service.UserProfileService;
+import org.onap.portalsdk.core.service.UserService;
import org.onap.portalsdk.core.service.WebServiceCallService;
import org.onap.portalsdk.core.util.JSONUtil;
import org.onap.portalsdk.core.util.SystemProperties;
@@ -66,6 +70,9 @@ import org.onap.portalsdk.core.web.support.UserUtils;
import org.slf4j.MDC;
import org.springframework.context.ApplicationContext;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
/**
* Implements the REST API interface to answer requests made by Portal app about
* users and active sessions.
@@ -84,7 +91,14 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
private IAdminAuthExtension adminAuthExtensionServiceImpl;
private LoginStrategy loginStrategy;
-
+ private UserService userService;
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ private static final String isAccessCentralized = PortalApiProperties
+ .getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED);
+
+ private static final String isCentralized = "remote";
+
public OnBoardingApiServiceImpl() {
// Defend against null-pointer exception during server startup
// that was caused by a spurious Spring annotation on this class.
@@ -96,6 +110,10 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
loginStrategy = appContext.getBean(LoginStrategy.class);
// initialize the base class definition for Admin Auth Extension
adminAuthExtensionServiceImpl = appContext.getBean(IAdminAuthExtension.class);
+ userService = appContext.getBean(UserService.class);
+ if(isCentralized.equals(isAccessCentralized)){
+ restApiRequestBuilder = appContext.getBean(RestApiRequestBuilder.class);
+ }
}
private void setCurrentAttributes(User user, EcompUser userJson) {
@@ -200,7 +218,15 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
try {
if (logger.isDebugEnabled())
logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: {}", loginId);
- User user = userProfileService.getUserByLoginId(loginId);
+
+ User user = null;
+ if(isCentralized.equals(isAccessCentralized)){
+ String responseString = restApiRequestBuilder.getViaREST("/user/" + loginId, true, loginId);
+ user = userService.userMapper(responseString);
+ }
+ else{
+ user = userProfileService.getUserByLoginId(loginId);
+ }
if (user == null) {
logger.info(EELFLoggerDelegate.debugLogger, "User + " + loginId + " doesn't exist");
return null;
@@ -224,16 +250,36 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
@Override
public List<EcompUser> getUsers() throws PortalAPIException {
+ String users_List = "";
try {
- List<User> users = userProfileService.findAllActive();
- List<EcompUser> ecompUsers = new ArrayList<EcompUser>();
- for (User user : users)
- ecompUsers.add(UserUtils.convertToEcompUser(user));
- return ecompUsers;
+ if (isCentralized.equals(isAccessCentralized)) {
+ List<EcompUser> UsersList = new ArrayList<>();
+ List<EcompUser> finalUsersList = new ArrayList<>();
+ users_List = restApiRequestBuilder.getViaREST("/users", true, null);
+ ObjectMapper mapper = new ObjectMapper();
+ UsersList = mapper.readValue(users_List,
+ TypeFactory.defaultInstance().constructCollectionType(List.class, EcompUser.class));
+ for (EcompUser userString : UsersList) {
+ EcompUser ecompUser = mapper.convertValue(userString, EcompUser.class);
+ finalUsersList.add(ecompUser);
+ }
+ return UsersList;
+ }
+ else {
+ List<User> users = userProfileService.findAllActive();
+ List<EcompUser> ecompUsers = new ArrayList<EcompUser>();
+ for (User user : users)
+ ecompUsers.add(UserUtils.convertToEcompUser(user));
+ return ecompUsers;
+ }
} catch (Exception e) {
String response = "OnboardingApiService.getUsers failed";
logger.error(EELFLoggerDelegate.errorLogger, response, e);
- throw new PortalAPIException(response, e);
+ if (users_List.equals("")) {
+ throw new PortalAPIException("Application is Inactive");
+ } else {
+ throw new PortalAPIException(response, e);
+ }
}
}
@@ -301,6 +347,20 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: {}", loginId);
List<EcompRole> ecompRoles = new ArrayList<EcompRole>();
try {
+
+ if(isCentralized.equals(isAccessCentralized)){
+ User user = null;
+ String responseString = restApiRequestBuilder.getViaREST("/user/" + loginId, true, loginId);
+ user = userService.userMapper(responseString);
+ SortedSet<Role> currentRoles = null;
+ if (user != null) {
+ currentRoles = user.getRoles();
+ if (currentRoles != null)
+ for (Role role : currentRoles)
+ ecompRoles.add(UserUtils.convertToEcompRole(role));
+ }
+ }
+ else{
User user = userProfileService.getUserByLoginId(loginId);
SortedSet<Role> currentRoles = null;
if (user != null) {
@@ -309,6 +369,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
for (Role role : currentRoles)
ecompRoles.add(UserUtils.convertToEcompRole(role));
}
+ }
return ecompRoles;
} catch (Exception e) {
String response = "OnboardingApiService.getUserRoles failed";
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/SanityTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/SanityTest.java
index 259aecd4..479f83e0 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/SanityTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/SanityTest.java
@@ -1,3 +1,40 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp;
import org.junit.Assert;
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborationControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborationControllerTest.java
index 97786046..e6e604cb 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborationControllerTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborationControllerTest.java
@@ -1,3 +1,40 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.controller;
import org.junit.Assert;
@@ -9,21 +46,18 @@ import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+public class CollaborationControllerTest extends MockApplicationContextTestSuite {
-
-public class CollaborationControllerTest extends MockApplicationContextTestSuite{
-
@Test
public void testGetAvailableRoles() throws Exception {
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/collaborate_list");
User user = new User();
user.setId(1l);
- //user.setOrgUserId("abc");
+ // user.setOrgUserId("abc");
requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user);
-
- ResultActions ra =getMockMvc().perform(requestBuilder);
- Assert.assertEquals(2,ra.andReturn().getModelAndView().getModelMap().size());
- }
+ ResultActions ra = getMockMvc().perform(requestBuilder);
+ Assert.assertEquals(2, ra.andReturn().getModelAndView().getModelMap().size());
+ }
}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/NetMapTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/NetMapTest.java
index 0ab09291..61973f64 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/NetMapTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/NetMapTest.java
@@ -1,3 +1,40 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.controller;
import org.junit.Assert;
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/core/MockApplicationContextTestSuite.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/core/MockApplicationContextTestSuite.java
index cede7e0c..ee9db320 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/core/MockApplicationContextTestSuite.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/core/MockApplicationContextTestSuite.java
@@ -1,3 +1,40 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.core;
import java.io.IOException;
@@ -23,105 +60,91 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-
-
/**
- *
- *
- *
- * In order to write a unit test,
- * 1. inherit this class - See SanityTest.java
- * 2. place the "war" folder on your test class's classpath
- * 3. run the test with the following VM argument; This is important because when starting the application from Container, the System Properties file (SystemProperties.java) can have the direct path
- * but, when running from the Mock Junit container, the path should be prefixed with "classpath" to enable the mock container to search for the file in the classpath
- * -Dcontainer.classpath="classpath:"
+ * In order to write a unit test, 1. inherit this class - See SanityTest.java 2.
+ * place the "war" folder on your test class's classpath 3. run the test with
+ * the following VM argument; This is important because when starting the
+ * application from Container, the System Properties file
+ * (SystemProperties.java) can have the direct path but, when running from the
+ * Mock Junit container, the path should be prefixed with "classpath" to enable
+ * the mock container to search for the file in the classpath
+ * -Dcontainer.classpath="classpath:"
*
*/
-
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
-@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = {MockAppConfig.class})
-@ActiveProfiles(value="test")
+@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { MockAppConfig.class })
+@ActiveProfiles(value = "test")
public class MockApplicationContextTestSuite {
-
- @Autowired
- public WebApplicationContext wac;
-
- private MockMvc mockMvc;
-
- @Before
- public void setup() {
- if(mockMvc == null) {
- this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
-
- }
- }
-
- public Object getBean(String name) {
- return this.wac.getBean(name);
- }
+ @Autowired
+ public WebApplicationContext wac;
- public MockMvc getMockMvc() {
- return mockMvc;
- }
+ private MockMvc mockMvc;
+
+ @Before
+ public void setup() {
+ if (mockMvc == null) {
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
- public void setMockMvc(MockMvc mockMvc) {
- this.mockMvc = mockMvc;
- }
-
- public WebApplicationContext getWebApplicationContext() {
- return wac;
}
-
-
-
-
+ }
+
+ public Object getBean(String name) {
+ return this.wac.getBean(name);
+ }
+
+ public MockMvc getMockMvc() {
+ return mockMvc;
+ }
+
+ public void setMockMvc(MockMvc mockMvc) {
+ this.mockMvc = mockMvc;
+ }
+
+ public WebApplicationContext getWebApplicationContext() {
+ return wac;
+ }
+
}
-
-
- @Configuration
- @ComponentScan(basePackages = "org.onap",
- excludeFilters = {
- }
- )
- @Profile("test")
- class MockAppConfig extends AppConfig {
-
- @Bean
- public SystemProperties systemProperties(){
- return new MockSystemProperties();
- }
-
- @Bean
- public AbstractCacheManager cacheManager() {
- return new CacheManager() {
-
- public void configure() throws IOException {
-
- }
- };
- }
-
- protected String[] tileDefinitions() {
- return new String[] {"classpath:/WEB-INF/fusion/defs/definitions.xml", "classpath:/WEB-INF/defs/definitions.xml"};
- }
-
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- //registry.addInterceptor(new SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
- //registry.addInterceptor(resourceInterceptor());
+
+@Configuration
+@ComponentScan(basePackages = "org.onap", excludeFilters = {})
+@Profile("test")
+class MockAppConfig extends AppConfig {
+
+ @Bean
+ public SystemProperties systemProperties() {
+ return new MockSystemProperties();
+ }
+
+ @Bean
+ public AbstractCacheManager cacheManager() {
+ return new CacheManager() {
+
+ public void configure() throws IOException {
+
}
-
- public static class MockSystemProperties extends SystemProperties {
-
- public MockSystemProperties() {
- }
-
- }
-
+ };
+ }
+
+ protected String[] tileDefinitions() {
+ return new String[] { "classpath:/WEB-INF/fusion/defs/definitions.xml",
+ "classpath:/WEB-INF/defs/definitions.xml" };
+ }
+
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ // registry.addInterceptor(new
+ // SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
+ // registry.addInterceptor(resourceInterceptor());
+ }
+
+ public static class MockSystemProperties extends SystemProperties {
+
+ public MockSystemProperties() {
}
-
-
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/ProfileServiceTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/ProfileServiceTest.java
index 0e90c501..36d54ba6 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/ProfileServiceTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/ProfileServiceTest.java
@@ -1,3 +1,40 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.service;
import java.util.List;
@@ -11,27 +48,24 @@ import org.onap.portalsdk.core.service.ProfileService;
import org.onap.portalsdk.core.service.UserProfileService;
import org.springframework.beans.factory.annotation.Autowired;
-
-
-
public class ProfileServiceTest extends MockApplicationContextTestSuite {
-
+
@Autowired
ProfileService service;
-
+
@Autowired
UserProfileService userProfileService;
-
+
@Test
- public void testFindAll() throws Exception{
-
+ public void testFindAll() throws Exception {
+
List<Profile> profiles = service.findAll();
Assert.assertTrue(profiles.size() > 0);
}
@Test
public void testFindAllActive() {
-
+
List<User> users = userProfileService.findAllActive();
List<User> activeUsers = userProfileService.findAllActive();
Assert.assertTrue(users.size() - activeUsers.size() >= 0);
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/workflow/services/WorkflowScheduleServiceTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/workflow/services/WorkflowScheduleServiceTest.java
index c59619d2..e26c35ab 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/workflow/services/WorkflowScheduleServiceTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/workflow/services/WorkflowScheduleServiceTest.java
@@ -1,3 +1,40 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.portalapp.workflow.services;
import java.util.Calendar;
@@ -9,20 +46,14 @@ import org.onap.portalsdk.workflow.domain.WorkflowSchedule;
import org.onap.portalsdk.workflow.services.WorkflowScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
-
-
public class WorkflowScheduleServiceTest extends MockApplicationContextTestSuite {
-
+
@Autowired
WorkflowScheduleService service;
-// @Autowired
-// SchedulerFactoryBean schedulerBean;
-
+
@Test
public void testFire() {
-
- // List<WorkflowSchedule> wfs = service.findAll();
-
+
final WorkflowSchedule ws = new WorkflowSchedule();
ws.setId(999L);
ws.setWorkflowKey("test");
@@ -30,15 +61,15 @@ public class WorkflowScheduleServiceTest extends MockApplicationContextTestSuite
final Calendar instance = Calendar.getInstance();
instance.add(Calendar.YEAR, 3);
ws.setEndDateTime(instance.getTime());
-
+
ws.setStartDateTime(Calendar.getInstance().getTime());
- try{
+ try {
service.saveWorkflowSchedule(ws);
Assert.assertTrue(true);
- } catch(Exception e) {
+ } catch (Exception e) {
Assert.fail(e.getMessage());
}
-
+
}
}
diff --git a/ecomp-sdk/epsdk-app-os/README.md b/ecomp-sdk/epsdk-app-os/README.md
index 70875b6f..3bbe0008 100644
--- a/ecomp-sdk/epsdk-app-os/README.md
+++ b/ecomp-sdk/epsdk-app-os/README.md
@@ -19,7 +19,7 @@ Version 1.4.0, <?day> <?month> 2017
- PORTAL-72 Address Sonar Scan code issues
- PORTAL-79 remove unwanted SDK left menu under Report-sample dashboard
- PORTAL-90 Use approved ONAP license text
-- Portal-86 Remove application specific usages from tests and other files
+- Portal-86 Remove application specific usages from tests and other files (rework)
* Put new entries here *
diff --git a/ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/lm/FusionLicenseManagerImpl.java b/ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/lm/FusionLicenseManagerImpl.java
deleted file mode 100644
index 66208e19..00000000
--- a/ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/lm/FusionLicenseManagerImpl.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalapp.lm;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-
-import org.onap.portalsdk.core.lm.FusionLicenseManager;
-import org.springframework.stereotype.Component;
-
-/*
- * Please note that this class is not being used; its a dummy stub to have a qualifying bean for the interface.
- */
-
-@Component
-public class FusionLicenseManagerImpl implements FusionLicenseManager {
-
- @Override
- public void initKeyStoreParam() {
- // a dummy stub for the interface
- }
-
- @Override
- public void initCipherParam() {
- // a dummy stub for the interface
- }
-
- @Override
- public void initLicenseParam() {
- // a dummy stub for the interface
- }
-
- @Override
- public void doInitWork() {
- // a dummy stub for the interface
- }
-
- @Override
- public int installLicense() {
- return 0;
- }
-
- @Override
- public synchronized int verifyLicense(ServletContext context) {
- return 0;
- }
-
- @Override
- public void generateLicense(Map<String, String> clientInfoMap, List<String> ipAddressList) throws Exception {
- // a dummy stub for the interface
- }
-
- @Override
- public String nvl(String s) {
- return null;
- }
-
- @Override
- public Date getExpiredDate() {
- return null;
- }
-
- @Override
- public void setExpiredDate(Date expiredDate) {
- // a dummy stub for the interface
- }
-
-}
diff --git a/ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/lm/LicenseableClassImpl.java b/ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/lm/LicenseableClassImpl.java
deleted file mode 100644
index 074814dc..00000000
--- a/ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/lm/LicenseableClassImpl.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalapp.lm;
-
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-import org.onap.portalsdk.core.lm.LicenseableClass;
-
-/*
- * Please note that this class is not being used; its a dummy stub to have a qualifying bean for the interface.
- */
-public class LicenseableClassImpl implements LicenseableClass {
-
- @Override
- public String getApplicationName() {
- return "";
- }
-
- @Override
- public InputStream getPublicKeystoreAsInputStream() throws FileNotFoundException {
- return null;
- }
-
- @Override
- public String getAlias() {
- return "";
- }
-
- @Override
- public String getKeyPasswd() {
- return "";
- }
-
- @Override
- public String getPublicKeystorePassword() {
- return "";
- }
-
- @Override
- public String getCipherParamPassword() {
- return "";
- }
-
- @Override
- @SuppressWarnings("rawtypes")
- public Class getClassToLicense() {
- return this.getClass();
- }
-
-}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java
index 2ef50419..afd4f589 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Domain.java
@@ -201,22 +201,12 @@ public class Domain {
if (containerRowCol != null && containerRowCol.containsKey(String.valueOf(i) + String.valueOf(j))) {
Container c = containerRowCol.get(String.valueOf(i) + String.valueOf(j));
Position p = new Position();
- if (this.getName().equals("VNI")) {
- p.x = j * (interContWd - 2) + xsum + domainToLayoutWd;
- } else
- p.x = j * interContWd + xsum + domainToLayoutWd;
+ p.x = j * interContWd + xsum + domainToLayoutWd;
double ysum = 0;
for (int k = 0; k < i; k++) {
if (containerRowCol.containsKey(String.valueOf(k) + String.valueOf(j)))
ysum += containerRowCol.get(String.valueOf(k) + String.valueOf(j)).computeSize()
.getHeight();
-
- else if (j > 0 && containerRowCol.containsKey(String.valueOf(k) + String.valueOf(j - 1))
- && !containerRowCol.get(String.valueOf(i) + String.valueOf(j)).getName()
- .equals("AIC - Alpharetta")) {
- ysum += containerRowCol.get(String.valueOf(k) + String.valueOf(j - 1)).computeSize()
- .getHeight();
- }
}
p.y = domainToLayoutH + ysum + this.computeSize().getHeight() + domainToContH + i * interContH;
c.setP(p);
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Layout.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Layout.java
index 09c8372d..c729eef4 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Layout.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/domain/support/Layout.java
@@ -631,8 +631,6 @@ public class Layout {
else
newX = domainstoUpd.get(i).getP().getX() + 38;
- if (d.getName().equals("Datacenter with AIC"))
- newX += 5;
d.setDomainToLayoutWd(newX);
d.computeConatinerPositions();
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/listener/ApplicationContextListener.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/listener/ApplicationContextListener.java
deleted file mode 100644
index 89e9382f..00000000
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/listener/ApplicationContextListener.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalsdk.core.listener;
-
-import javax.servlet.ServletContext;
-import javax.servlet.annotation.WebListener;
-
-import org.onap.portalsdk.core.lm.FusionLicenseManagerUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.event.ContextRefreshedEvent;
-import org.springframework.stereotype.Component;
-
-@WebListener
-@Component
-public class ApplicationContextListener implements ApplicationListener<ContextRefreshedEvent> {
-
- @Autowired
- private ServletContext context;
- @Autowired
- private FusionLicenseManagerUtils fusionLicenseManagerUtils;
-
- @Override
- public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
- int licenseStatus = fusionLicenseManagerUtils.verifyLicense(context);
- context.setAttribute("licenseVerification", licenseStatus);
- }
-
-}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/FusionLicenseManager.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/FusionLicenseManager.java
deleted file mode 100644
index 1943c390..00000000
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/FusionLicenseManager.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalsdk.core.lm;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-
-public interface FusionLicenseManager {
-
- public static final int DEVELOPER_LICENSE = 0;
- public static final int EXPIRED_LICENSE = 1;
- public static final int VALID_LICENSE = 2;
- public static final int INVALID_LICENSE = 3;
- public static final int OPENSOURCE_LICENSE = 4;
-
- public void initKeyStoreParam();
-
- public void initCipherParam();
-
- public void initLicenseParam();
-
- public void doInitWork();
-
- public int installLicense();
-
- public int verifyLicense(ServletContext context);
-
- public void generateLicense(Map<String, String> clientInfoMap, List<String> ipAddressList) throws Exception;
-
- public String nvl(String s);
-
- public Date getExpiredDate();
-
- public void setExpiredDate(Date expiredDate);
-} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/FusionLicenseManagerUtils.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/FusionLicenseManagerUtils.java
deleted file mode 100644
index 9fb576f5..00000000
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/FusionLicenseManagerUtils.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalsdk.core.lm;
-
-import java.util.Date;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.onap.portalsdk.core.util.SystemProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.servlet.support.RequestContextUtils;
-
-@Component
-public class FusionLicenseManagerUtils {
-
- @Autowired
- private FusionLicenseManager licenseManager;
-
- @Autowired
- private SystemProperties sysProps;
-
- public int verifyLicense(ServletContext context) {
- if (sysProps == null) {
- try {
- sysProps = new SystemProperties();
- sysProps.setServletContext(context);
- System.out.println(licenseManager);
- licenseManager.installLicense();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- return licenseManager.verifyLicense(context);
- }
-
- public static Date getLicenseExpiryDate(HttpServletRequest request) {
- WebApplicationContext ctx = RequestContextUtils.getWebApplicationContext(request);
- return ((FusionLicenseManager) ctx.getBean("fusionLicenseManager")).getExpiredDate();
- }
-}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/LicenseableClass.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/LicenseableClass.java
deleted file mode 100644
index 4d14a359..00000000
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/lm/LicenseableClass.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * ============LICENSE_START==========================================
- * ONAP Portal SDK
- * ===================================================================
- * Copyright © 2017 AT&T 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============================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.onap.portalsdk.core.lm;
-
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-/**
- * created by Alvin Alexander of http://devdaily.com. modified by Sundar
- * Ramalingam
- */
-public interface LicenseableClass {
- public String getApplicationName();
-
- public InputStream getPublicKeystoreAsInputStream() throws FileNotFoundException;
-
- public String getAlias();
-
- public String getPublicKeystorePassword();
-
- public String getKeyPasswd();
-
- public String getCipherParamPassword();
-
- public Class getClassToLicense();
-
-}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java
index d24bd503..e838e783 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java
@@ -87,10 +87,10 @@ public class ElementMapService {
// Used to build image file relative URLs
final String iconRelPath = SystemProperties.getProperty("element_map_icon_path");
- Map<String, Domain> resultAICDomain = layout.getDomainRowCol();
+ Map<String, Domain> resultDomain = layout.getDomainRowCol();
Map<String, List<Domain>> domainMap = new HashMap<>();
List<Domain> domainList = new ArrayList<>();
- for (Domain d : resultAICDomain.values()) {
+ for (Domain d : resultDomain.values()) {
d.setWidth(10 * d.computeSize().getWidth());
d.setHeight(10 * d.computeSize().getHeight());
d.setLeft(10 * d.getP().getX());
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/support/ServiceLocatorImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/support/ServiceLocatorImpl.java
index 704cd39a..fb705728 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/support/ServiceLocatorImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/support/ServiceLocatorImpl.java
@@ -96,17 +96,4 @@ public class ServiceLocatorImpl implements ServiceLocator {
return dirContext;
}
- // Get an LDAP directory context - LDAPv3-style
- /*
- * public InitialLdapContext getLdapContext() { //throws NamingException { if
- * (ldapContext == null) { Properties properties = new Properties(); // @todo -
- * need to parameterize context factoy class and url
- * properties.put(Context.INITIAL_CONTEXT_FACTORY,
- * AttLdap.DIR_INITIAL_CONTEXT_FACTORY); properties.put(Context.PROVIDER_URL,
- * AttLdap.DIR_PROVIDER_URL); properties.put(Context.SECURITY_PRINCIPAL,
- * AttLdap.DIR_SECURITY_PRINCIPAL); Control[] ctrl = null; try { ldapContext =
- * new InitialLdapContext(properties, ctrl); } catch (NamingException ne) { //
- * MJ FIX log exception? } } return ldapContext; }
- */
-
}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/web/support/UserUtils.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/web/support/UserUtils.java
index 5395521b..89f34050 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/web/support/UserUtils.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/web/support/UserUtils.java
@@ -57,7 +57,6 @@ import org.onap.portalsdk.core.domain.Role;
import org.onap.portalsdk.core.domain.RoleFunction;
import org.onap.portalsdk.core.domain.User;
import org.onap.portalsdk.core.exception.SessionExpiredException;
-import org.onap.portalsdk.core.lm.FusionLicenseManager;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.menu.MenuBuilder;
import org.onap.portalsdk.core.restful.domain.EcompRole;
@@ -99,24 +98,7 @@ public class UserUtils {
String displayName = "";
if (SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME) != null)
displayName = SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME);
- switch (licenseVarificationFlag) {
- case FusionLicenseManager.DEVELOPER_LICENSE:
- session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME),
- displayName + " [Development Version]");
- break;
- case FusionLicenseManager.EXPIRED_LICENSE:
- session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME),
- displayName + " [LICENSE EXPIRED]");
- break;
- case FusionLicenseManager.VALID_LICENSE:
- session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), displayName);
- break;
- default:
- session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME),
- displayName + " [INVALID LICENSE]");
- break;
- }
-
+ session.setAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME), displayName);
session.setAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME),
MenuBuilder.filterMenu(applicationMenuData, request));
session.setAttribute(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME),
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java
index fa248385..25578bd4 100644
--- a/ecomp-sdk/epsdk-core/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/fusion/core/MockApplicationContextTestSuite.java
@@ -1,3 +1,40 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.fusion.core;
import java.io.IOException;
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/fusion/core/MockHibernateMappingLocations.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/fusion/core/MockHibernateMappingLocations.java
index d61bc690..44be13a0 100644
--- a/ecomp-sdk/epsdk-core/src/test/java/org/onap/fusion/core/MockHibernateMappingLocations.java
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/fusion/core/MockHibernateMappingLocations.java
@@ -1,3 +1,40 @@
+/*
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * Copyright © 2017 AT&T 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============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
package org.onap.fusion.core;
import org.onap.portalsdk.core.conf.HibernateMappingLocatable;
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java
index 1dec7b7c..1303aad5 100644
--- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java
+++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java
@@ -104,6 +104,11 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
* Client-supplied class that implements our interface.
*/
private static IPortalRestAPIService portalRestApiServiceImpl;
+ private static final String isAccessCentralized = PortalApiProperties
+ .getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED);
+ private static final String errorMessage = "Access Management is not allowed for Centralized applications." ;
+ private static final String isCentralized = "remote";
+
public PortalRestAPIProxy() {
// Ensure that any additional fields sent by the Portal
@@ -237,11 +242,17 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
// Example: /user <-- create user
if (requestUri.endsWith(PortalApiConstants.API_PREFIX + "/user")) {
try {
- EcompUser user = mapper.readValue(requestBody, EcompUser.class);
- pushUser(user);
- logger.debug("doPost: pushUser: success");
- responseJson = buildJsonResponse(true, null);
- response.setStatus(HttpServletResponse.SC_OK);
+ if (isCentralized.equals(isAccessCentralized)) {
+ responseJson = buildJsonResponse(true, errorMessage);
+ response.setStatus(HttpServletResponse.SC_OK);
+ } else {
+ EcompUser user = mapper.readValue(requestBody, EcompUser.class);
+ pushUser(user);
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: pushUser: success");
+ responseJson = buildJsonResponse(true, null);
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
} catch (Exception ex) {
responseJson = buildJsonResponse(ex);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
@@ -252,11 +263,17 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
if (requestUri.contains(PortalApiConstants.API_PREFIX + "/user/") && !(requestUri.endsWith("/roles"))) {
String loginId = requestUri.substring(requestUri.lastIndexOf('/') + 1);
try {
- EcompUser user = mapper.readValue(requestBody, EcompUser.class);
- editUser(loginId, user);
- logger.debug("doPost: editUser: success");
- responseJson = buildJsonResponse(true, null);
- response.setStatus(HttpServletResponse.SC_OK);
+ if (isCentralized.equals(isAccessCentralized)) {
+ responseJson = buildJsonResponse(true, errorMessage);
+ response.setStatus(HttpServletResponse.SC_OK);
+ } else {
+ EcompUser user = mapper.readValue(requestBody, EcompUser.class);
+ editUser(loginId, user);
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: editUser: success");
+ responseJson = buildJsonResponse(true, null);
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
} catch (Exception ex) {
responseJson = buildJsonResponse(ex);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
@@ -268,13 +285,19 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
String loginId = requestUri.substring(requestUri.indexOf("/user/") + ("/user").length() + 1,
requestUri.lastIndexOf('/'));
try {
- TypeReference<List<EcompRole>> typeRef = new TypeReference<List<EcompRole>>() {
- };
- List<EcompRole> roles = mapper.readValue(requestBody, typeRef);
- pushUserRole(loginId, roles);
- logger.debug("doPost: pushUserRole: success");
- responseJson = buildJsonResponse(true, null);
- response.setStatus(HttpServletResponse.SC_OK);
+ if (isCentralized.equals(isAccessCentralized)) {
+ responseJson = buildJsonResponse(true, errorMessage);
+ response.setStatus(HttpServletResponse.SC_OK);
+ } else {
+ TypeReference<List<EcompRole>> typeRef = new TypeReference<List<EcompRole>>() {
+ };
+ List<EcompRole> roles = mapper.readValue(requestBody, typeRef);
+ pushUserRole(loginId, roles);
+ if (logger.isDebugEnabled())
+ logger.debug("doPost: pushUserRole: success");
+ responseJson = buildJsonResponse(true, null);
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
} catch (Exception ex) {
responseJson = buildJsonResponse(ex);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
@@ -381,11 +404,11 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
*/
if (requestUri.endsWith("/sessionTimeOuts")) {
- responseJson = getSessionTimeOuts();
- if (responseJson != null && responseJson.length() > 0) {
+ try {
+ responseJson = getSessionTimeOuts();
logger.debug("doGet: got session timeouts");
response.setStatus(HttpServletResponse.SC_OK);
- } else {
+ } catch(Exception ex) {
String msg = "Failed to get session time outs";
logger.error("doGet: " + msg);
responseJson = buildJsonResponse(false, msg);
@@ -400,7 +423,7 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
if (logger.isDebugEnabled())
logger.debug("doGet: getUsers: " + responseJson);
} catch (Exception ex) {
- responseJson = buildJsonResponse(ex);
+ responseJson = buildShortJsonResponse(ex);
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
logger.error("doGet: getUsers: caught exception", ex);
}
@@ -610,6 +633,12 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
t.printStackTrace(pw);
return buildJsonResponse(false, sw.toString());
}
+
+ private String buildShortJsonResponse(Throwable t)
+ {
+ String errorMessage = t.getMessage();
+ return buildJsonResponse(false, errorMessage);
+ }
@Override
public String getUserId(HttpServletRequest request) throws PortalAPIException {
diff --git a/ecomp-sdk/pom.xml b/ecomp-sdk/pom.xml
index bf6e711f..d02aa727 100644
--- a/ecomp-sdk/pom.xml
+++ b/ecomp-sdk/pom.xml
@@ -3,6 +3,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <!-- OParent provides audits, distribution management, etc. -->
+ <parent>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>0.1.1</version>
+ <relativePath />
+ </parent>
+
<!-- Portal SDK Maven parent project -->
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
@@ -11,16 +19,6 @@
<name>portal-sdk</name>
<url>https://wiki.onap.org/display/DW/Portal</url>
- <!-- OParent provides license audit, code audit, distribution management,
- etc.
- But jenkins build fails, so comment out for now.
- <parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>0.1.0</version>
- </parent>
- -->
-
<modules>
<module>epsdk-fw</module>
<module>epsdk-core</module>
@@ -36,34 +34,49 @@
<springframework.version>4.2.0.RELEASE</springframework.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<skiptests>true</skiptests>
- <nexusproxy>https://nexus.onap.org</nexusproxy>
- <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath>
- <stagingNexusPath>content/repositories/staging/</stagingNexusPath>
- <releaseNexusPath>content/repositories/releases/</releaseNexusPath>
</properties>
- <repositories>
- <repository>
- <id>releases</id>
- <name>ONAP - Release Repository</name>
- <url>${nexusproxy}/${releaseNexusPath}</url>
- </repository>
- <repository>
- <id>staging</id>
- <name>ONAP - Staging Repository</name>
- <url>${nexusproxy}/${stagingNexusPath}</url>
- </repository>
- <repository>
- <id>snapshots</id>
- <name>ONAP - Snapshot Repository</name>
- <url>${nexusproxy}/${snapshotNexusPath}</url>
- </repository>
- <repository>
- <id>public</id>
- <name>ONAP public Repository</name>
- <url>${nexusproxy}/content/groups/public</url>
- </repository>
- </repositories>
+ <!-- Specify the repositories here to avoid coordination of ~/.m2/settings.xml
+ files among all developers. Also use values (not properties) so oparent can
+ be resolved. -->
+ <repositories>
+ <repository>
+ <id>onap-releases</id>
+ <name>ONAP - Release Repository</name>
+ <url>https://nexus.onap.org/content/repositories/releases</url>
+ </repository>
+ <repository>
+ <id>onap-staging</id>
+ <name>ONAP - Staging Repository</name>
+ <url>https://nexus.onap.org/content/repositories/staging</url>
+ </repository>
+ <repository>
+ <id>onap-snapshots</id>
+ <name>ONAP - Snapshot Repository</name>
+ <url>https://nexus.onap.org/content/repositories/snapshots</url>
+ </repository>
+ <repository>
+ <id>onap-public</id>
+ <url>https://nexus.onap.org/content/groups/public</url>
+ </repository>
+ </repositories>
+
+ <!-- Specify the repositories here to avoid coordination of ~/.m2/settings.xml
+ files among all developers. -->
+ <pluginRepositories>
+ <pluginRepository>
+ <id>onap-plugin-release</id>
+ <url>https://nexus.onap.org/content/repositories/releases/</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>onap-plugin-staging</id>
+ <url>https://nexus.onap.org/content/repositories/staging/</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>onap-plugin-snapshots</id>
+ <url>https://nexus.onap.org/content/repositories/snapshots/</url>
+ </pluginRepository>
+ </pluginRepositories>
<profiles>
<!-- disable doclint, a new feature in Java 8, when generating javadoc -->
@@ -199,7 +212,8 @@
</build>
<distributionManagement>
- <!-- The id below must match .m2/settings.xml/servers/server/id -->
+ <!-- Override the OParent sections which use id "ecomp-releases" etc.
+ The ids below must match .m2/settings.xml/servers/server/id -->
<repository>
<id>releases</id>
<name>OpenECOMP - Release Repository</name>
@@ -213,7 +227,7 @@
<!-- Javadocs -->
<site>
<id>ecomp-site</id>
- <url>dav:${nexusproxy}${sitePath}</url>
+ <url>dav:https://nexus.onap.org/content/sites/site/${project.groupId}/${project.artifactId}/${project.version}</url>
</site>
</distributionManagement>