summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-analytics/pom.xml2
-rw-r--r--ecomp-sdk/epsdk-app-common/pom.xml2
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java43
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/util/CustomLoggingFilter.java2
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/AngularSinglePageControllerTest.java73
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/BroadcastControllerTest.java160
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/BroadcastListControllerTest.java142
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CallflowControllerTest.java64
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CamundaCockpitControllerTest.java91
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborateListControllerTest.java142
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborationControllerTest.java114
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/DS2SampleControllerTest.java77
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ElasticSearchControllerTest.java145
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ElementModelControllerTest.java117
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/LeafletMapContollerTest.java70
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/NetMapControllerTest.java79
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/PostDroolsControllerTest.java141
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ReportDashboardControllerTest.java70
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/SamplePageControllerTest.java71
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/AngularAdminControllerTest.java (renamed from ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/AngularAdminControllerTest.java)1
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FnMenuControllerTest.java229
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FuncMenuControllerTest.java176
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java156
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java241
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileControllerTest.java310
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java171
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/SDKLoginControllerTest.java135
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UsageListControllerTest.java69
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UserProfileControllerTest.java88
-rw-r--r--ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/WelcomeControllerTest.java74
-rw-r--r--ecomp-sdk/epsdk-app-os/README.md1
-rw-r--r--ecomp-sdk/epsdk-app-os/pom.xml2
-rw-r--r--ecomp-sdk/epsdk-app-os/src/main/resources/portal.properties4
-rw-r--r--ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties2
-rw-r--r--ecomp-sdk/epsdk-app-overlay/pom.xml2
-rw-r--r--ecomp-sdk/epsdk-core/pom.xml2
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/LoginBeanTest.java88
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostDroolsBeanTest.java65
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostSearchBeanTest.java193
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/UserRowBeanTest.java76
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/support/SearchResultTest.java76
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AppTest.java123
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java73
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java101
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java98
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java83
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java73
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java77
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java65
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java68
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java72
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java84
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java70
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java69
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java111
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java77
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java75
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java87
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java89
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserTest.java216
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/sessionmgt/TimeoutVOTest.java82
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AppServiceImplTest.java97
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AuditServiceImplTest.java60
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/BroadcastServiceImplTest.java182
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/DataAccessServiceImplTest.java350
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementLinkServiceTest.java204
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementMapServiceTest.java481
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FnMenuServiceImplTest.java181
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java77
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceImplTest.java79
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LdapServiceImplTest.java156
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LocalAccessConditionTest.java78
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImplTest.java200
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceImplTest.java185
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/PostSearchServiceImplTest.java188
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceCentralizedImplTest.java89
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceImplTest.java99
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RestApiRequestBuilderTest.java292
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java165
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceImplTest.java256
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UrlAccessImplTest.java97
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserProfileServiceImplTest.java91
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java79
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java60
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java193
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java143
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java107
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java64
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java77
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java65
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java336
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java82
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java68
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java69
-rw-r--r--ecomp-sdk/epsdk-core/src/test/java/org/onap/sdkapp/core/onboarding/client/AppContextManagerTest.java64
-rw-r--r--ecomp-sdk/epsdk-fw/pom.xml2
-rw-r--r--ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/IPortalRestCentralService.java103
-rw-r--r--ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java200
-rw-r--r--ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java40
-rw-r--r--ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/PortalApiConstants.java2
-rw-r--r--ecomp-sdk/epsdk-workflow/pom.xml2
-rw-r--r--ecomp-sdk/pom.xml2
102 files changed, 10888 insertions, 36 deletions
diff --git a/ecomp-sdk/epsdk-analytics/pom.xml b/ecomp-sdk/epsdk-analytics/pom.xml
index 76e0df1b..414c6f7d 100644
--- a/ecomp-sdk/epsdk-analytics/pom.xml
+++ b/ecomp-sdk/epsdk-analytics/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
</parent>
<!-- GroupId is inherited from parent -->
diff --git a/ecomp-sdk/epsdk-app-common/pom.xml b/ecomp-sdk/epsdk-app-common/pom.xml
index 8252897e..ae2cb96c 100644
--- a/ecomp-sdk/epsdk-app-common/pom.xml
+++ b/ecomp-sdk/epsdk-app-common/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
</parent>
<!-- GroupId is inherited from parent -->
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 3efe46fd..bfd0fc89 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
@@ -37,9 +37,12 @@
*/
package org.onap.portalapp.service;
+import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -47,18 +50,24 @@ import java.util.TreeSet;
import javax.servlet.http.HttpServletRequest;
import org.onap.portalsdk.core.auth.LoginStrategy;
+import org.onap.portalsdk.core.domain.App;
import org.onap.portalsdk.core.domain.Role;
import org.onap.portalsdk.core.domain.User;
import org.onap.portalsdk.core.domain.UserApp;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.onboarding.client.AppContextManager;
import org.onap.portalsdk.core.onboarding.crossapi.IPortalRestAPIService;
+import org.onap.portalsdk.core.onboarding.crossapi.IPortalRestCentralService;
+import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
import org.onap.portalsdk.core.onboarding.listener.PortalTimeoutHandler;
+import org.onap.portalsdk.core.onboarding.util.CipherUtil;
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.AppService;
+import org.onap.portalsdk.core.service.AppServiceImpl;
import org.onap.portalsdk.core.service.RestApiRequestBuilder;
import org.onap.portalsdk.core.service.RoleService;
import org.onap.portalsdk.core.service.UserProfileService;
@@ -82,7 +91,7 @@ import com.fasterxml.jackson.databind.type.TypeFactory;
* 'injection' is done indirectly using AppContextManager class.
*
*/
-public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
+public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalRestCentralService {
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(OnBoardingApiServiceImpl.class);
@@ -93,6 +102,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
private LoginStrategy loginStrategy;
private UserService userService;
private RestApiRequestBuilder restApiRequestBuilder;
+ private AppService appServiceImpl;
private static final String isAccessCentralized = PortalApiProperties
.getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED);
@@ -113,6 +123,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
userService = appContext.getBean(UserService.class);
if(isCentralized.equals(isAccessCentralized)){
restApiRequestBuilder = appContext.getBean(RestApiRequestBuilder.class);
+ appServiceImpl = appContext.getBean(AppService.class);
}
}
@@ -226,6 +237,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
}
else{
user = userProfileService.getUserByLoginId(loginId);
+ user.getRoles().removeIf(role -> (role.getActive() == false));
}
if (user == null) {
logger.info(EELFLoggerDelegate.debugLogger, "User + " + loginId + " doesn't exist");
@@ -365,6 +377,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
SortedSet<Role> currentRoles = null;
if (user != null) {
currentRoles = user.getRoles();
+ currentRoles.removeIf(role -> (role.getActive() == false));
if (currentRoles != null)
for (Role role : currentRoles)
ecompRoles.add(UserUtils.convertToEcompRole(role));
@@ -435,4 +448,32 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService {
public String getUserId(HttpServletRequest request) throws PortalAPIException {
return loginStrategy.getUserId(request);
}
+
+ @Override
+ public Map<String, String> getAppCredentials() throws PortalAPIException{
+ Map<String, String> credentialsMap = new HashMap<>();
+ String appName = null;
+ String appUserName = null;
+ String decryptedPwd = null;
+ App app = appServiceImpl.getDefaultApp();
+ if (app != null) {
+ appName = app.getName();
+ appUserName = app.getUsername();
+ try {
+ decryptedPwd = CipherUtil.decryptPKC(app.getAppPassword(),
+ SystemProperties.getProperty(SystemProperties.Decryption_Key));
+ } catch (CipherUtilException e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getAppCredentials failed", e);
+ }
+ } else {
+ logger.warn(EELFLoggerDelegate.errorLogger,
+ "getAppCredentials: Unable to locate the app information from the database.");
+ appUserName = "unknown";
+ appName = SystemProperties.SDK_NAME;
+ }
+ credentialsMap.put("username", appUserName);
+ credentialsMap.put("password", decryptedPwd);
+ credentialsMap.put("appName", appName);
+ return credentialsMap;
+ }
}
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/util/CustomLoggingFilter.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/util/CustomLoggingFilter.java
index ccabb12c..74914840 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/util/CustomLoggingFilter.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/util/CustomLoggingFilter.java
@@ -59,7 +59,7 @@ public class CustomLoggingFilter extends Filter<ILoggingEvent> {
try {
if ((event.getLevel() != Level.ERROR || event.getLevel() != Level.WARN) &&
(event.getThreadName().equalsIgnoreCase("UEBConsumerThread")) &&
- (event.getLoggerName().contains("org.openecomp.nsa") || event.getLoggerName().contains("org.apache.http"))
+ (event.getLoggerName().contains("org.onap.nsa") || event.getLoggerName().contains("org.apache.http"))
) {
return FilterReply.DENY;
} else {
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/AngularSinglePageControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/AngularSinglePageControllerTest.java
new file mode 100644
index 00000000..68aa06ef
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/AngularSinglePageControllerTest.java
@@ -0,0 +1,73 @@
+/*
+ * ============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 static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.AngularSinglePageController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.springframework.web.servlet.ModelAndView;
+
+public class AngularSinglePageControllerTest {
+
+ @InjectMocks
+ AngularSinglePageController angularSinglePageController = new AngularSinglePageController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test
+ public void welcomeTest() {
+ ModelAndView expectedResluts = angularSinglePageController.view(mockedRequest);
+ assertEquals(expectedResluts.getViewName(),"single_page_sample");
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/BroadcastControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/BroadcastControllerTest.java
new file mode 100644
index 00000000..a2068ea9
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/BroadcastControllerTest.java
@@ -0,0 +1,160 @@
+/*
+ * ============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 static org.junit.Assert.assertNull;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.BroadcastController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.BroadcastMessage;
+import org.onap.portalsdk.core.service.BroadcastService;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.web.support.AppUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.web.servlet.ModelAndView;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class, AppUtils.class })
+public class BroadcastControllerTest {
+
+ @InjectMocks
+ BroadcastController broadcastController = new BroadcastController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Mock
+ BroadcastService broadcastService;
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test
+ public void broadcastTest() {
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(broadcastService.getBroadcastMessage(mockedRequest)).thenReturn(new BroadcastMessage());
+ Mockito.when(SystemProperties.getProperty(SystemProperties.CLUSTERED)).thenReturn("true");
+ Mockito.when(AppUtils.getLookupList("fn_lu_broadcast_site", "broadcast_site_cd", "broadcast_site_descr", "",
+ "broadcast_site_descr")).thenReturn(new ArrayList<>());
+ ModelAndView expectedResult = broadcastController.broadcast(mockedRequest);
+ assertNull(expectedResult.getViewName());
+ }
+
+ @Test
+ public void broadcastExceptionTest() {
+ Mockito.when(broadcastService.getBroadcastMessage(mockedRequest)).thenThrow(new NullPointerException());
+ ModelAndView expectedResult = broadcastController.broadcast(mockedRequest);
+ assertNull(expectedResult.getViewName());
+
+ }
+
+ @Test
+ public void broadcastIfCLusterIsFalseTest() {
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(broadcastService.getBroadcastMessage(mockedRequest)).thenReturn(new BroadcastMessage());
+ Mockito.when(SystemProperties.getProperty(SystemProperties.CLUSTERED)).thenReturn("false");
+ Mockito.when(AppUtils.getLookupList("fn_lu_broadcast_site", "broadcast_site_cd", "broadcast_site_descr", "",
+ "broadcast_site_descr")).thenReturn(new ArrayList<>());
+ ModelAndView expectedResult = broadcastController.broadcast(mockedRequest);
+ assertNull(expectedResult.getViewName());
+ }
+
+ @Test
+ public void getBroadcastTest() throws IOException {
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(broadcastService.getBroadcastMessage(mockedRequest)).thenReturn(new BroadcastMessage());
+ Mockito.when(SystemProperties.getProperty(SystemProperties.CLUSTERED)).thenReturn("true");
+ Mockito.when(AppUtils.getLookupList("fn_lu_broadcast_site", "broadcast_site_cd", "broadcast_site_descr", "",
+ "broadcast_site_descr")).thenReturn(new ArrayList<>());
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ broadcastController.getBroadcast(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getBroadcastExcptionTest() throws IOException {
+ Mockito.when(broadcastService.getBroadcastMessage(mockedRequest)).thenThrow(new NullPointerException());
+ broadcastController.getBroadcast(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void saveTest() throws Exception {
+
+ String json = "{\"broadcastMessage\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"messageText\":null,\"locationId\":null,\"startDate\":null,\"endDate\":null,\"sortOrder\":null,\"active\":true,\"siteCd\":null}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(broadcastController.save(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void saveExceptionTest() throws Exception {
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(broadcastController.save(mockedRequest, mockedResponse));
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/BroadcastListControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/BroadcastListControllerTest.java
new file mode 100644
index 00000000..14f4ab0a
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/BroadcastListControllerTest.java
@@ -0,0 +1,142 @@
+/*
+ * ============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 static org.junit.Assert.assertNull;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.BroadcastListController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.service.BroadcastService;
+import org.springframework.web.servlet.ModelAndView;
+
+public class BroadcastListControllerTest {
+
+ @InjectMocks
+ BroadcastListController broadcastListController = new BroadcastListController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Mock
+ BroadcastService broadcastService;
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
+
+
+ @Test
+ public void broadcastListTest() {
+ Mockito.when(broadcastService.getBcModel(mockedRequest)).thenReturn(new HashMap<>());
+ ModelAndView expectedResult = broadcastListController.broadcastList(mockedRequest);
+ assertNull(expectedResult.getViewName());
+ }
+
+ @Test
+ public void getBroadcastTest() throws IOException {
+ Mockito.when(broadcastService.getBcModel(mockedRequest)).thenReturn(new HashMap<>());
+ Mockito.when(broadcastService.getBcModel(mockedRequest).get("messagesList")).thenReturn(new HashMap<>());
+ Mockito.when(broadcastService.getBcModel(mockedRequest).get("messageLocations")).thenReturn(new HashMap<>());
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ broadcastListController.getBroadcast(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getBroadcastExceptionTest() throws IOException {
+ Mockito.when(broadcastService.getBcModel(mockedRequest)).thenThrow(nullPointerException);
+ broadcastListController.getBroadcast(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void removeTest() throws Exception {
+ String json = "{\"broadcastMessage\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"messageText\":null,\"locationId\":null,\"startDate\":null,\"endDate\":null,\"sortOrder\":null,\"active\":true,\"siteCd\":null}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(broadcastListController.remove(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void removeExceptionTest() throws Exception {
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(broadcastListController.remove(mockedRequest, mockedResponse));
+ }
+
+
+ @Test
+ public void toggleActiveTest() throws Exception {
+ String json = "{\"broadcastMessage\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"messageText\":null,\"locationId\":null,\"startDate\":null,\"endDate\":null,\"sortOrder\":null,\"active\":true,\"siteCd\":null}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(broadcastListController.toggleActive(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void toggleActiveExceptionTest() throws Exception {
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(broadcastListController.toggleActive(mockedRequest, mockedResponse));
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CallflowControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CallflowControllerTest.java
new file mode 100644
index 00000000..047e16f5
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CallflowControllerTest.java
@@ -0,0 +1,64 @@
+/*
+ * ============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 static org.junit.Assert.assertNull;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.CallflowController;
+import org.springframework.web.servlet.ModelAndView;
+
+public class CallflowControllerTest {
+
+ @InjectMocks
+ CallflowController callflowController = new CallflowController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void welcomeTest() {
+ ModelAndView expectedResluts = callflowController.plot();
+ assertNull(expectedResluts.getViewName());
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CamundaCockpitControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CamundaCockpitControllerTest.java
new file mode 100644
index 00000000..4aee7752
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CamundaCockpitControllerTest.java
@@ -0,0 +1,91 @@
+/*
+ * ============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 static org.junit.Assert.assertEquals;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.CamundaCockpitController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class})
+public class CamundaCockpitControllerTest {
+
+ @InjectMocks
+ CamundaCockpitController camundaCockpitController = new CamundaCockpitController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test
+ public void getCamundaCockpitLinkTest() {
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.containsProperty("camunda_cockpit_link")).thenReturn(true);
+ Map expectedresult = camundaCockpitController.getCamundaCockpitLink(mockedRequest, mockedResponse);
+ assertEquals(expectedresult.size(), 2);
+ }
+
+ @Test
+ public void getCamundaCockpitLinkFalseTest() {
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.containsProperty("camunda_cockpit_link")).thenReturn(false);
+ Map expectedresult = camundaCockpitController.getCamundaCockpitLink(mockedRequest, mockedResponse);
+ assertEquals(expectedresult.size(), 2);
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborateListControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborateListControllerTest.java
new file mode 100644
index 00000000..7346aeab
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborateListControllerTest.java
@@ -0,0 +1,142 @@
+/*
+ * ============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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.CollaborateListController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.service.UserProfileService;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.springframework.web.servlet.ModelAndView;
+
+public class CollaborateListControllerTest {
+
+
+ @InjectMocks
+ CollaborateListController collaborateListController = new CollaborateListController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+ @Mock
+ UserProfileService service;
+
+ @Mock
+ UserUtils userUtils = new UserUtils();
+
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
+
+
+ @Test
+ public void profileSearchTest()
+ {
+ List<User> userList = new ArrayList<>();
+ User user = new User();
+ user.setOrgUserId("test12");
+ userList.add(user);
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(service.findAllUserWithOnOffline(user.getOrgUserId())).thenReturn(userList);
+ ModelAndView expectedResult = collaborateListController.ProfileSearch(mockedRequest);
+ assertEquals(expectedResult.getModel().size(), userList.size());
+ }
+
+ @Test
+ public void profileSearchExceptionTest()
+ {
+ List<User> userList = new ArrayList<>();
+ User user = new User();
+ user.setOrgUserId("test12");
+ userList.add(user);
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(service.findAllUserWithOnOffline(user.getOrgUserId())).thenThrow(nullPointerException);
+ ModelAndView expectedResult = collaborateListController.ProfileSearch(mockedRequest);
+ assertNull(expectedResult.getViewName());
+ }
+
+ @Test
+ public void getCollaborateListTest() throws IOException
+ {
+ List<User> userList = new ArrayList<>();
+ User user = new User();
+ user.setOrgUserId("test12");
+ userList.add(user);
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(service.findAllUserWithOnOffline(user.getOrgUserId())).thenReturn(userList);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ collaborateListController.getCollaborateList(mockedRequest,mockedResponse);
+
+ }
+
+ @Test
+ public void getCollaborateListExceptionTest() throws IOException
+ {
+ List<User> userList = new ArrayList<>();
+ User user = new User();
+ user.setOrgUserId("test12");
+ userList.add(user);
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(service.findAllUserWithOnOffline(user.getOrgUserId())).thenThrow(nullPointerException);
+ collaborateListController.getCollaborateList(mockedRequest,mockedResponse);
+
+ }
+}
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
new file mode 100644
index 00000000..f91082c8
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/CollaborationControllerTest.java
@@ -0,0 +1,114 @@
+/*
+ * ============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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.CollaborationController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.springframework.web.servlet.ModelAndView;
+
+public class CollaborationControllerTest {
+
+ @InjectMocks
+ CollaborationController collaborationController = new CollaborationController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
+
+ @Mock
+ UserUtils userUtils = new UserUtils();
+
+ @Test
+ public void viewTest() {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ModelAndView expectedResult = collaborationController.view(mockedRequest);
+ assertNull(expectedResult.getViewName());
+ }
+
+ @Test
+ public void viewUserLastTest() {
+ User user = new User();
+ user.setOrgUserId("test12");
+ user.setLastName("test");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ModelAndView expectedResult = collaborationController.view(mockedRequest);
+ assertNull(expectedResult.getViewName());
+ }
+
+ @Test
+ public void openCollaborationTest() {
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ModelAndView expectedResult = collaborationController.openCollaboration(mockedRequest);
+ assertEquals(expectedResult.getViewName(),"openCollaboration");
+ }
+
+ @Test
+ public void openCollaborationLastNameTest() {
+ User user = new User();
+ user.setOrgUserId("test12");
+ user.setLastName("test");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ModelAndView expectedResult = collaborationController.openCollaboration(mockedRequest);
+ assertEquals(expectedResult.getViewName(),"openCollaboration");
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/DS2SampleControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/DS2SampleControllerTest.java
new file mode 100644
index 00000000..a81aab48
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/DS2SampleControllerTest.java
@@ -0,0 +1,77 @@
+/*
+ * ============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 static org.junit.Assert.assertEquals;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.DS2SampleController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.service.ProfileService;
+import org.springframework.web.servlet.ModelAndView;
+
+public class DS2SampleControllerTest {
+
+ @InjectMocks
+ DS2SampleController dS2SampleController = new DS2SampleController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ NullPointerException nullPointerException = new NullPointerException();
+
+ @Mock
+ ProfileService service;
+
+ @Test
+ public void profileSearchTest()
+ {
+ ModelAndView expectedResult = dS2SampleController.ProfileSearch(mockedRequest);
+ assertEquals(expectedResult.getViewName(), "ds2_sample");
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ElasticSearchControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ElasticSearchControllerTest.java
new file mode 100644
index 00000000..7a0d47cd
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ElasticSearchControllerTest.java
@@ -0,0 +1,145 @@
+/*
+ * ============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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.ElasticSearchController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalapp.model.Result;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.google.gson.Gson;
+
+import io.searchbox.core.SearchResult;
+
+import io.searchbox.client.JestClient;
+import io.searchbox.client.JestClientFactory;
+import io.searchbox.client.config.HttpClientConfig;
+import io.searchbox.client.http.JestHttpClient;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ JestClientFactory.class, JestClient.class })
+public class ElasticSearchControllerTest {
+
+ @InjectMocks
+ ElasticSearchController elasticSearchController = new ElasticSearchController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+ @Mock
+ JestClientFactory factory;
+ @Mock
+ JestClient client ;
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test
+ public void searchTest()
+ {
+ ModelAndView expectedResult = elasticSearchController.search();
+ assertEquals(expectedResult.getViewName(), "es_search_demo");
+ }
+
+ @Test
+ public void suggestTest()
+ {
+ ModelAndView expectedResult = elasticSearchController.suggest();
+ assertEquals(expectedResult.getViewName(), "es_suggest_demo");
+ }
+
+// @Test
+// public void doSuggestTest() throws IOException
+// {
+// PowerMockito.mockStatic(JestClient.class);
+// PowerMockito.mockStatic(JestClientFactory.class);
+// SearchResult result = new SearchResult(new Gson());
+// Mockito.when(factory.getObject()).thenReturn(client);
+// Mockito.when(client.execute(Matchers.anyObject())).thenReturn(result);
+//// Mockito.doNothing().when(factory).setHttpClientConfig(new HttpClientConfig
+//// .Builder(Matchers.anyString())
+//// .multiThreaded(Matchers.anyBoolean())
+//// .build());
+//
+// JestClientFactory factory = Mockito.spy(new JestClientFactory());
+// HttpClientConfig httpClientConfig = Mockito.spy(new HttpClientConfig.Builder("http://localhost:9200")
+// .discoveryEnabled(true)
+// .build());
+// factory.setHttpClientConfig(httpClientConfig);
+// JestHttpClient jestClient = (JestHttpClient) factory.getObject();
+//
+// elasticSearchController.doSearch("{\"data\":\"1\",\"size\":\"1\"}");
+// }
+
+ @Test
+ public void sendResultTest()
+ {
+ ResponseEntity<Result> result = elasticSearchController.sendResult(null);
+ assertEquals(result.getStatusCode(), HttpStatus.OK);
+ }
+
+ @Test
+ public void isRestFultest()
+ {
+ assertTrue(elasticSearchController.isRESTfulCall());
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ElementModelControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ElementModelControllerTest.java
new file mode 100644
index 00000000..63d10f7d
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ElementModelControllerTest.java
@@ -0,0 +1,117 @@
+/*
+ * ============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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.io.FilenameUtils;
+import org.apache.xmlbeans.SystemProperties;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.ElementModelController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.service.ElementMapService;
+import org.onap.portalsdk.core.util.YamlUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({FilenameUtils.class, YamlUtils.class, SystemProperties.class})
+public class ElementModelControllerTest {
+
+ @InjectMocks
+ ElementModelController elementModelController = new ElementModelController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Mock
+ ElementMapService elementMapService = new ElementMapService();
+
+
+ @Test
+ public void layoutTest() throws Exception {
+ PowerMockito.mockStatic(FilenameUtils.class);
+ PowerMockito.mockStatic(YamlUtils.class);
+ Mockito.when(FilenameUtils.normalize(mockedRequest.getParameter(Matchers.anyString()))).thenReturn("test");
+ ServletContext servletContext = Mockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getServletContext()).thenReturn(servletContext);
+ Mockito.when(YamlUtils.readYamlFile(Matchers.anyString(), Matchers.anyString())).thenReturn(new HashMap<>());
+ System.out.println(elementModelController.layout(mockedRequest, mockedResponse));
+ assertTrue(elementModelController.layout(mockedRequest, mockedResponse).contains("domainList"));
+ }
+
+ @Test
+ public void callflowTest() throws Exception {
+ PowerMockito.mockStatic(FilenameUtils.class);
+ PowerMockito.mockStatic(YamlUtils.class);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(Matchers.anyString())).thenReturn("customTest");
+ Mockito.when(FilenameUtils.normalize(mockedRequest.getParameter(Matchers.anyString()))).thenReturn("test");
+ ServletContext servletContext = Mockito.mock(ServletContext.class);
+ Mockito.when(mockedRequest.getServletContext()).thenReturn(servletContext);
+ Mockito.when(FilenameUtils.normalize("test")).thenReturn("test");
+ Map<String, Object> callflow = new HashMap<>();
+ callflow.put("callSequenceSteps", new Object());
+ callflow.put("callSequenceSteps", new ArrayList<>());
+ Mockito.when(YamlUtils.readYamlFile(Matchers.anyString(), Matchers.anyString())).thenReturn(callflow);
+ assertEquals(elementModelController.callflow(mockedRequest, mockedResponse), "");
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/LeafletMapContollerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/LeafletMapContollerTest.java
new file mode 100644
index 00000000..0139102c
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/LeafletMapContollerTest.java
@@ -0,0 +1,70 @@
+/*
+ * ============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 static org.junit.Assert.assertNull;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.LeafletMapContoller;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.springframework.web.servlet.ModelAndView;
+
+public class LeafletMapContollerTest {
+
+ @InjectMocks
+ LeafletMapContoller leafletMapContoller = new LeafletMapContoller();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+
+ @Test
+ public void plotTest() {
+ ModelAndView expectedResluts = leafletMapContoller.plot();
+ assertNull(expectedResluts.getViewName());
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/NetMapControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/NetMapControllerTest.java
new file mode 100644
index 00000000..1072e5d5
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/NetMapControllerTest.java
@@ -0,0 +1,79 @@
+/*
+ * ============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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.NetMapController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.springframework.web.servlet.ModelAndView;
+
+public class NetMapControllerTest {
+
+
+ @InjectMocks
+ NetMapController netMapController = new NetMapController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+
+ @Test
+ public void plotTest() {
+ ModelAndView expectedResluts = netMapController.plot(mockedRequest);
+ assertEquals(expectedResluts.getViewName(),"frame_insert");
+ }
+
+ @Test
+ public void plot2Test() {
+ ModelAndView expectedResluts = netMapController.plot2();
+ assertNull(expectedResluts.getViewName());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/PostDroolsControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/PostDroolsControllerTest.java
new file mode 100644
index 00000000..0fe919f7
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/PostDroolsControllerTest.java
@@ -0,0 +1,141 @@
+/*
+ * ============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 static org.junit.Assert.assertNull;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.PostDroolsController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.command.PostDroolsBean;
+import org.onap.portalsdk.core.service.PostDroolsService;
+import org.springframework.web.servlet.ModelAndView;
+
+public class PostDroolsControllerTest {
+
+ @InjectMocks
+ PostDroolsController postDroolsController = new PostDroolsController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Mock
+ PostDroolsService postDroolsService;
+
+ @Test
+ public void droolsTest() {
+ ModelAndView expectedResluts = postDroolsController.drools(mockedRequest);
+ assertNull(expectedResluts.getViewName());
+ }
+
+ @Test
+ public void getDroolsTest() throws IOException {
+ List<PostDroolsBean> beanList = new ArrayList<>();
+ Mockito.when(postDroolsService.fetchDroolBeans()).thenReturn(beanList);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ postDroolsController.getDrools(mockedRequest,mockedResponse);
+ }
+
+ @Test
+ public void getDroolsExceptionTest() throws IOException {
+ Mockito.when(postDroolsService.fetchDroolBeans()).thenThrow(new NullPointerException());
+ postDroolsController.getDrools(mockedRequest,mockedResponse);
+ }
+
+
+ @Test
+ public void getDroolDetailsTest() throws IOException {
+ Mockito.when(mockedRequest.getParameter("selectedFile")).thenReturn("test");
+ Mockito.when(postDroolsService.retrieveClass("test")).thenReturn("result");
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ postDroolsController.getDroolDetails(mockedRequest,mockedResponse);
+ }
+ @Test
+ public void getDroolDetailsExceptionTest() throws IOException {
+ Mockito.when(mockedRequest.getParameter("selectedFile")).thenReturn("test");
+ Mockito.when(postDroolsService.retrieveClass("test")).thenThrow(new NullPointerException());
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ postDroolsController.getDroolDetails(mockedRequest,mockedResponse);
+ }
+
+ @Test
+ public void searchTest() throws Exception {
+ String json = "{\"postDroolsBean\": {\"droolsFile\":\"test\",\"className\":null,\"selectedRules\":null}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ Mockito.when(postDroolsService.execute(Matchers.anyString(),
+ Matchers.anyString(), Matchers.anyString())).thenReturn("result");
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(postDroolsController.search(mockedRequest,mockedResponse));
+ }
+
+ @Test
+ public void searchExceptionTest() throws Exception {
+ assertNull(postDroolsController.search(mockedRequest,mockedResponse));
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ReportDashboardControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ReportDashboardControllerTest.java
new file mode 100644
index 00000000..05c921c7
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/ReportDashboardControllerTest.java
@@ -0,0 +1,70 @@
+/*
+ * ============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 static org.junit.Assert.assertNull;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.ReportDashboardController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.springframework.web.servlet.ModelAndView;
+
+public class ReportDashboardControllerTest {
+
+ @InjectMocks
+ ReportDashboardController reportDashboardController = new ReportDashboardController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ @Test
+ public void adminViewTest()
+ {
+ ModelAndView expectedResult = reportDashboardController.adminView(mockedRequest);
+ assertNull(expectedResult.getViewName());
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/SamplePageControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/SamplePageControllerTest.java
new file mode 100644
index 00000000..0d36b95f
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/SamplePageControllerTest.java
@@ -0,0 +1,71 @@
+/*
+ * ============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 static org.junit.Assert.assertEquals;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.sample.SamplePageController;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.springframework.web.servlet.ModelAndView;
+
+public class SamplePageControllerTest {
+
+ @InjectMocks
+ SamplePageController samplePageController = new SamplePageController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+
+ @Test
+ public void adminViewTest()
+ {
+ ModelAndView expectedResult = samplePageController.plot(mockedRequest);
+ assertEquals(expectedResult.getViewName(),"samplePage");
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/AngularAdminControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/AngularAdminControllerTest.java
index 02755b4a..2ae922aa 100644
--- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/AngularAdminControllerTest.java
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/AngularAdminControllerTest.java
@@ -50,6 +50,7 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.controller.core.AngularAdminController;
import org.onap.portalapp.framework.MockitoTestSuite;
import org.onap.portalsdk.core.domain.User;
import org.onap.portalsdk.core.web.support.UserUtils;
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FnMenuControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FnMenuControllerTest.java
new file mode 100644
index 00000000..1f1d2db3
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FnMenuControllerTest.java
@@ -0,0 +1,229 @@
+/*
+ * ============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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.Menu;
+import org.onap.portalsdk.core.domain.MenuData;
+import org.onap.portalsdk.core.domain.RoleFunction;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.service.FnMenuService;
+import org.onap.portalsdk.core.service.FunctionalMenuListService;
+import org.onap.portalsdk.core.web.support.UserUtils;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class FnMenuControllerTest {
+
+ @InjectMocks
+ FnMenuController fnMenuController = new FnMenuController();
+
+ @Mock
+ FnMenuService fnMenuService;
+
+ @Mock
+ FunctionalMenuListService functionalMenuListService;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ NullPointerException nullPointerException = new NullPointerException();
+
+ User user = new User();
+
+ @Mock
+ UserUtils userUtils = new UserUtils();
+
+ @Mock
+ ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void getParentListTest() throws Exception{
+ @SuppressWarnings("rawtypes")
+ List<List> list = new ArrayList<>();
+ Mockito.when(fnMenuService.getParentList()).thenReturn(list);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ fnMenuController.getParentList(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getParentListExceptionTest() throws Exception{
+ Mockito.when(fnMenuService.getParentList()).thenThrow(nullPointerException);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ fnMenuController.getParentList(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getFunctionCDListTest() throws Exception{
+ List<RoleFunction> roleFunctionList = new ArrayList<RoleFunction>();
+ Mockito.when(functionalMenuListService.getFunctionCDList(mockedRequest)).thenReturn(roleFunctionList);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ fnMenuController.getFunctionCDList(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getFunctionCDListExceptionTest() throws Exception{
+ Mockito.when(functionalMenuListService.getFunctionCDList(mockedRequest)).thenThrow(nullPointerException);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ fnMenuController.getFunctionCDList(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getFnMenuListTest() throws IOException{
+ List<MenuData> menuList = new ArrayList<>();
+ MenuData menudata = new MenuData();
+ menudata.setId((long) 1);
+ menudata.setLabel("test");
+ menudata.setParentMenu(menudata);
+ menuList.add(menudata);
+ Mockito.when(fnMenuService.getFnMenuItems()).thenReturn(menuList);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ fnMenuController.getFnMenuList(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getFnMenuListExceptionTest() throws IOException{
+ List<MenuData> menuList = new ArrayList<>();
+ MenuData menudata = new MenuData();
+ menudata.setId((long) 1);
+ menudata.setLabel("test");
+ menudata.setParentMenu(menudata);
+ menuList.add(menudata);
+ Mockito.when(fnMenuService.getFnMenuItems()).thenThrow(nullPointerException);
+ fnMenuController.getFnMenuList(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void updateFnMenuTest() throws Exception{
+
+ String fnMenuItem = "{\"availableFnMenuItem\":{\"id\":9,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\""
+ + ":null,\"auditTrail\":null,\"menuLevel\":null,\"label\":\"Profile\",\"parentId\":1,\"action\":\"userProfile\",\"functionCd\":\"menu_profile\","
+ + "\"sortOrder\":90,\"servlet\":\"N/A\",\"queryString\":\"N/A\",\"externalUrl\":\"test\",\"target\":\"N/A\",\"active\":true,\"menuSetCode\":\"APP\","
+ + "\"separator\":false,\"imageSrc\":\"icon-people-oneperson\",\"parentMenu\":null,\"childMenus\":[],\"activeAsString\":\"true\","
+ + "\"parentIdAsString\":\"1\",\"separatorAsString\":\"false\",\"active_yn\":false,\"$$hashKey\":\"object:99\"}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(fnMenuItem)));
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(fnMenuController.updateFnMenu(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void updateFnMenuExceptionTest() throws Exception{
+ Menu fnMenuItemObj = new Menu();
+ fnMenuItemObj.setLabel("test");
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(fnMenuController.updateFnMenu(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void removeFnMenuTest() throws Exception{
+ String fnMenuItem = "{\"fnMenuItem\":{\"id\":9,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\""
+ + ":null,\"auditTrail\":null,\"menuLevel\":null,\"label\":\"Profile\",\"parentId\":1,\"action\":\"userProfile\",\"functionCd\":\"menu_profile\","
+ + "\"sortOrder\":90,\"servlet\":\"N/A\",\"queryString\":\"N/A\",\"externalUrl\":\"test\",\"target\":\"N/A\",\"active\":true,\"menuSetCode\":\"APP\","
+ + "\"separator\":false,\"imageSrc\":\"icon-people-oneperson\",\"parentMenu\":null,\"childMenus\":[],\"activeAsString\":\"true\","
+ + "\"parentIdAsString\":\"1\",\"separatorAsString\":\"false\",\"active_yn\":false,\"$$hashKey\":\"object:99\"}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(fnMenuItem)));
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(fnMenuController.removeFnMenu(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void removeFnMenuExceptionTest() throws Exception{
+ String fnMenuItem = "{\"availableFnMenuItem\":{\"id\":9,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\""
+ + ":null,\"auditTrail\":null,\"menuLevel\":null,\"label\":\"Profile\",\"parentId\":1,\"action\":\"userProfile\",\"functionCd\":\"menu_profile\","
+ + "\"sortOrder\":90,\"servlet\":\"N/A\",\"queryString\":\"N/A\",\"externalUrl\":\"test\",\"target\":\"N/A\",\"active\":true,\"menuSetCode\":\"APP\","
+ + "\"separator\":false,\"imageSrc\":\"icon-people-oneperson\",\"parentMenu\":null,\"childMenus\":[],\"activeAsString\":\"true\","
+ + "\"parentIdAsString\":\"1\",\"separatorAsString\":\"false\",\"active_yn\":false,\"$$hashKey\":\"object:99\"}}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(fnMenuItem)));
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(fnMenuController.removeFnMenu(mockedRequest, mockedResponse));
+ }
+
+ @Test
+ public void getViewNameTest() {
+ String expectedResult = "test";
+ fnMenuController.setViewName(expectedResult);
+ String actualResult = fnMenuController.getViewName();
+ assertEquals(expectedResult, actualResult);
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FuncMenuControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FuncMenuControllerTest.java
new file mode 100644
index 00000000..d1d3f741
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FuncMenuControllerTest.java
@@ -0,0 +1,176 @@
+/*
+ * ============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;
+
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.App;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.onboarding.ueb.UebException;
+import org.onap.portalsdk.core.onboarding.ueb.UebManager;
+import org.onap.portalsdk.core.onboarding.ueb.UebMsg;
+import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
+import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
+import org.onap.portalsdk.core.service.AppService;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({UebManager.class, PortalApiProperties.class, PortalApiConstants.class})
+public class FuncMenuControllerTest {
+
+ @InjectMocks
+ FuncMenuController funcMenuController = new FuncMenuController();
+
+ @Mock
+ AppService appService;
+
+ @Mock
+ UebManager uebManager;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ NullPointerException nullPointerException = new NullPointerException();
+
+ User user = new User();
+
+ @Mock
+ UserUtils userUtils = new UserUtils();
+
+ @Mock
+ ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void functionalMenuUserExistsTest() throws IOException, UebException{
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ PowerMockito.mockStatic(UebManager.class);
+
+ Mockito.when(UebManager.getInstance()).thenReturn(uebManager);
+ Mockito.when(uebManager.requestReply(Matchers.anyObject())).thenReturn(new UebMsg());
+ funcMenuController.functionalMenu(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void functionalMenuUserNotExistsTest() throws IOException, UebException{
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+
+ funcMenuController.functionalMenu(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void functionalMenuViaRestTest() throws IOException, UebException{
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ PowerMockito.mockStatic(UebManager.class);
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ PowerMockito.mockStatic(PortalApiConstants.class);
+ Mockito.when(PortalApiProperties
+ .getProperty(PortalApiConstants.USE_REST_FOR_FUNCTIONAL_MENU)).thenReturn("test");
+ Mockito.when(UebManager.getInstance()).thenReturn(uebManager);
+ funcMenuController.functionalMenu(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void functionalMenuViaRestAppNullTest() throws IOException, UebException{
+ App app = new App();
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+ PowerMockito.mockStatic(UebManager.class);
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ PowerMockito.mockStatic(PortalApiConstants.class);
+ Mockito.when(PortalApiProperties
+ .getProperty(PortalApiConstants.USE_REST_FOR_FUNCTIONAL_MENU)).thenReturn("test");
+ Mockito.when(UebManager.getInstance()).thenReturn(uebManager);
+ funcMenuController.functionalMenu(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void functionalMenuExceptionTest() throws IOException{
+ User user = new User();
+ user.setOrgUserId("test12");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ funcMenuController.functionalMenu(mockedRequest, mockedResponse);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java
new file mode 100644
index 00000000..954103d2
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java
@@ -0,0 +1,156 @@
+/*
+ * ============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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.onboarding.ueb.UebManager;
+import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
+import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
+import org.onap.portalsdk.core.service.AppService;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({PortalApiProperties.class, PortalApiConstants.class, PortalApiConstants.class,RequestContextHolder.class})
+public class LogoutControllerTest {
+
+ @InjectMocks
+ LogoutController logoutController = new LogoutController();
+
+ @Mock
+ AppService appService;
+
+ @Mock
+ UebManager uebManager;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ NullPointerException nullPointerException = new NullPointerException();
+
+ User user = new User();
+
+ @Mock
+ UserUtils userUtils = new UserUtils();
+
+ @Mock
+ ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void globalLogoutTest(){
+ ModelAndView modelView = null;
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ PowerMockito.mockStatic(PortalApiConstants.class);
+ PowerMockito.mockStatic(RequestContextHolder.class);
+ ServletRequestAttributes ServletRequestAttributes = new ServletRequestAttributes(mockedRequest);
+ Mockito.when(RequestContextHolder.currentRequestAttributes()).thenReturn(ServletRequestAttributes);
+ Mockito.when(PortalApiProperties
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ logoutController.globalLogout(mockedRequest);
+ }
+
+ @Test
+ public void globalLogoutExceptionTest(){
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ PowerMockito.mockStatic(PortalApiConstants.class);
+ Mockito.when(PortalApiProperties
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ assertNull(logoutController.globalLogout(mockedRequest));
+ }
+
+ @Test
+ public void appLogoutTest(){
+ ModelAndView actualModelView = new ModelAndView("redirect:https://portal.openecomp.org/ecompportal/process_csp");
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ PowerMockito.mockStatic(PortalApiConstants.class);
+ PowerMockito.mockStatic(RequestContextHolder.class);
+ ServletRequestAttributes ServletRequestAttributes = new ServletRequestAttributes(mockedRequest);
+ Mockito.when(RequestContextHolder.currentRequestAttributes()).thenReturn(ServletRequestAttributes);
+ Mockito.when(PortalApiProperties
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ ModelAndView expectedModelView = logoutController.appLogout(mockedRequest);
+ assertEquals(actualModelView.getViewName(), expectedModelView.getViewName());
+ }
+
+ @Test
+ public void appLogoutExceptionTest(){
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ PowerMockito.mockStatic(PortalApiConstants.class);
+ Mockito.when(PortalApiProperties
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ assertNull(logoutController.appLogout(mockedRequest));
+ }
+
+ @Test
+ public void getUserTest(){
+ User expectedUser = new User();
+ expectedUser.setActive(false);
+ user.setActive(false);
+ logoutController.setUser(user);
+ User actualUser = logoutController.getUser();
+ assertEquals(expectedUser.getActive(), actualUser.getActive());
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java
new file mode 100644
index 00000000..655cccb4
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java
@@ -0,0 +1,241 @@
+/*
+ * ============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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.MenuData;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
+import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
+import org.onap.portalsdk.core.restful.client.SharedContextRestClient;
+import org.onap.portalsdk.core.service.FnMenuService;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({PortalApiProperties.class, PortalApiConstants.class, SystemProperties.class})
+public class MenuListControllerTest {
+
+ @InjectMocks
+ MenuListController menuListController = new MenuListController();
+
+ @Mock
+ FnMenuService fnMenuService;
+
+ @Mock
+ private SharedContextRestClient sharedContextRestClient;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ NullPointerException nullPointerException = new NullPointerException();
+
+ User user = new User();
+
+ @Mock
+ UserUtils userUtils = new UserUtils();
+
+ @Test
+ public void getMenuTest() throws IOException{
+ List<List<MenuData>> childItemList = new ArrayList<List<MenuData>>();
+ List<MenuData> parentList = new ArrayList<MenuData>();
+ Set<MenuData> menuResult = new HashSet<MenuData>();
+ Mockito.doThrow(new NullPointerException()).when(fnMenuService).setMenuDataStructure(childItemList, parentList, menuResult);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+
+ menuListController.getMenu(mockedRequest, mockedResponse);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getMenuExceptionTest() throws IOException{
+ Mockito.doThrow(new NullPointerException()).when(fnMenuService).setMenuDataStructure(Matchers.anyList(), Matchers.anyList(), (Set<MenuData>) Matchers.anySet());
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ menuListController.getMenu(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getAppNameTest() throws IOException{
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ menuListController.getAppName(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getAppNameExceptionTest(){
+ menuListController.getAppName(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getLeftMenuJSPTest() throws IOException{
+ Map<String, Object> actualResult = new HashMap<>();
+ List<String> list = new ArrayList<String>();
+ Map<String, Object> expectedResult = new HashMap<>();
+ expectedResult.put("childItemList", list);
+ expectedResult.put("parentList", list);
+ List<List<MenuData>> childItemList = new ArrayList<List<MenuData>>();
+ List<MenuData> parentList = new ArrayList<MenuData>();
+ Set<MenuData> menuResult = new HashSet<MenuData>();
+ Mockito.doThrow(new NullPointerException()).when(fnMenuService).setMenuDataStructure(childItemList, parentList, menuResult);
+ actualResult = menuListController.getLeftMenuJSP(mockedRequest);
+ assertEquals(actualResult.size(), expectedResult.size());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getLeftMenuJSPExceptionTest() throws IOException{
+ Mockito.doThrow(new NullPointerException()).when(fnMenuService).setMenuDataStructure(Matchers.anyList(), Matchers.anyList(), Matchers.anySet());
+ menuListController.getLeftMenuJSP(mockedRequest);
+ }
+
+ @Test
+ public void getUserInfoTest() throws IOException{
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ menuListController.getUserInfo(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getUserInfoExceptionTest() throws IOException{
+ menuListController.getUserInfo(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getTopMenuExceptionTest(){
+ menuListController.getTopMenu(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getTopMenuTest() throws IOException{
+ PowerMockito.mockStatic(SystemProperties.class);
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ PowerMockito.mockStatic(PortalApiConstants.class);
+ HttpSession session = mockedRequest.getSession();
+ Mockito.when(SystemProperties.getProperty(SystemProperties.USER_NAME)).thenReturn("test");
+ Mockito.when(session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_NAME))).thenReturn("userName");
+ Mockito.when(session.getAttribute(SystemProperties.FIRST_NAME)).thenReturn("firstName");
+ Mockito.when(session.getAttribute(SystemProperties.LAST_NAME)).thenReturn("lastName");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).thenReturn("user");
+ Mockito.when(session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME))).thenReturn(user);
+ Mockito.when(PortalApiProperties
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ menuListController.getTopMenu(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void pageRedirectContactTest() throws IOException{
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ PowerMockito.mockStatic(PortalApiConstants.class);
+ Mockito.when(mockedRequest.getParameter("page")).thenReturn("contact");
+ Mockito.when(PortalApiProperties
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ menuListController.pageRedirect(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void pageRedirectAccessTest() throws IOException{
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ PowerMockito.mockStatic(PortalApiConstants.class);
+ Mockito.when(mockedRequest.getParameter("page")).thenReturn("access");
+ Mockito.when(PortalApiProperties
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ menuListController.pageRedirect(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void pageRedirectExceptionTest() throws IOException{
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ PowerMockito.mockStatic(PortalApiConstants.class);
+ Mockito.when(PortalApiProperties
+ .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp");
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ menuListController.pageRedirect(mockedRequest, mockedResponse);
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileControllerTest.java
new file mode 100644
index 00000000..41367a16
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileControllerTest.java
@@ -0,0 +1,310 @@
+/*
+ * ============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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.restful.client.SharedContextRestClient;
+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.util.SystemProperties;
+import org.onap.portalsdk.core.web.support.AppUtils;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.web.servlet.ModelAndView;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class, AppUtils.class ,UserUtils.class})
+public class ProfileControllerTest {
+
+ @InjectMocks
+ ProfileController profileController = new ProfileController();
+
+ @Mock
+ UserProfileService service;
+
+ @Mock
+ UserService userService;
+
+ @Mock
+ RoleService roleService;
+
+ @Mock
+ private SharedContextRestClient sharedContextRestClient;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ NullPointerException nullPointerException = new NullPointerException();
+
+ User user = new User();
+
+ @Mock
+ UserUtils userUtils = new UserUtils();
+
+ @Test
+ public void profileTest() throws IOException{
+ ModelAndView actualModelAndView = new ModelAndView("profile");
+ User user = new User();
+ user.setOrgUserId("test");
+ Long profileId = null;
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(mockedRequest.getRequestURI()).thenReturn("self_profile.htm");
+ Mockito.when(mockedRequest.getParameter("profile_id")).thenReturn("test");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD")).thenReturn(new ArrayList<>());
+ Mockito.when(userService.getUser(String.valueOf(profileId))).thenReturn(user);
+ ModelAndView expectedModelAndView = profileController.profile(mockedRequest);
+ assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
+ }
+
+ @Test
+ public void profileRequestURITest() throws IOException{
+ ModelAndView actualModelAndView = new ModelAndView("profile");
+ User user = new User();
+ user.setOrgUserId("test");
+ int profileId = 1;
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(mockedRequest.getRequestURI()).thenReturn("test");
+ Mockito.when(mockedRequest.getParameter("profile_id")).thenReturn("1");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(userService.getUser(String.valueOf(profileId))).thenReturn(user);
+ Mockito.when(AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD")).thenReturn(new ArrayList<>());
+ Mockito.when(userService.getUser(String.valueOf(profileId))).thenReturn(user);
+ ModelAndView expectedModelAndView = profileController.profile(mockedRequest);
+ assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
+ }
+
+ @Test
+ public void profileExceptionTest() throws IOException{
+ ModelAndView actualModelAndView = new ModelAndView("profile");
+ User profile = null;
+ Long profileId = null;
+ Mockito.when(mockedRequest.getRequestURI()).thenReturn("self_profile.htm");
+ Mockito.when(mockedRequest.getParameter("profile_id")).thenReturn("test");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(userService.getUser(String.valueOf(profileId))).thenReturn(profile);
+ ModelAndView expectedModelAndView = profileController.profile(mockedRequest);
+ assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
+ }
+
+ @Test
+ public void selfProfileTest() throws Exception{
+ ModelAndView actualModelAndView = new ModelAndView("profile");
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD")).thenReturn(new ArrayList<>());
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ ModelAndView expectedModelAndView = profileController.selfProfile(mockedRequest);
+ assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
+ }
+
+ @Test
+ public void selfProfileExceptionTest() throws Exception{
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ profileController.selfProfile(mockedRequest);
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Test
+ public void getStatesTest(){
+ List actualList = new ArrayList();
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD")).thenReturn(new ArrayList<>());
+ List expectedlist =profileController.getStates();
+ assertEquals(actualList.size(), expectedlist.size());
+ }
+
+ @Test
+ public void getSelfProfileTest() throws IOException{
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD")).thenReturn(new ArrayList<>());
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ profileController.getSelfProfile(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getSelfProfileExceptionTest(){
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ profileController.getSelfProfile(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getUserTest() throws IOException{
+ User user = new User();
+ user.setOrgUserId("test");
+ Long profileId = null;
+ PowerMockito.mockStatic(AppUtils.class);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(mockedRequest.getRequestURI()).thenReturn("self_profile.htm");
+ Mockito.when(mockedRequest.getParameter("profile_id")).thenReturn("test");
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(AppUtils.getLookupList("FN_LU_STATE", "STATE_CD", "STATE", null, "STATE_CD")).thenReturn(new ArrayList<>());
+ Mockito.when(userService.getUser(String.valueOf(profileId))).thenReturn(user);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ profileController.getUser(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getUserExceptionTest(){
+ profileController.getUser(mockedRequest, mockedResponse);
+ }
+
+ /*@Test
+ public void saveProfileTest() throws IOException{
+ String json = "{\"role\":{\"id\":1,\"created\":null,\"modified\":null,\"createdId\":null,\"modifiedId\":null,\"rowNum\":null,\"auditUserId\":null,\"auditTrail\":null,\"name\":\"test1\",\"active\":false,\"priority\":\"1\",\"roleFunctions\":[],\"childRoles\":[],\"editUrl\":\"/role.htm?role_id=1\",\"toggleActiveImage\":\"/static/fusion/images/inactive.png\",\"toggleActiveAltText\":\"Click to Activate Role\"},\"childRoles\":[],\"roleFunctions\":[]}";
+ Mockito.when(mockedRequest.getReader()).thenReturn(new BufferedReader(new StringReader(json)));
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(profileController.saveProfile(mockedRequest, mockedResponse));
+ }*/
+
+ @Test
+ public void saveProfilePrintWriterExceptionTest() throws IOException{
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ assertNull(profileController.saveProfile(mockedRequest, mockedResponse));
+ }
+
+ /*@SuppressWarnings("unchecked")
+ @Test
+ public void saveProfileExceptionTest() throws IOException{
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenThrow(IOException.class);
+ profileController.saveProfile(mockedRequest, mockedResponse);
+ }*/
+
+ /*@Test
+ public void removeRoleTest() throws IOException{
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ profileController.removeRole(mockedRequest, mockedResponse);
+ }*/
+
+ @Test
+ public void removeRolePrintWriterExceptionTest() throws IOException{
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ profileController.removeRole(mockedRequest, mockedResponse);
+ }
+
+ /*@SuppressWarnings("unchecked")
+ @Test
+ public void removeRoleExceptionTest() throws IOException{
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenThrow(IOException.class);
+ profileController.removeRole(mockedRequest, mockedResponse);
+ }*/
+
+ /*@Test
+ public void addNewRoleTest() throws IOException{
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ profileController.addNewRole(mockedRequest, mockedResponse);
+ }*/
+
+ @Test
+ public void addNewRoleExceptionTest() throws IOException{
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ profileController.addNewRole(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getViewNameTest(){
+ String actualResult = null;
+ profileController.setViewName(null);
+ String expectedResult = profileController.getViewName();
+ assertEquals(actualResult, expectedResult);
+ }
+
+ @SuppressWarnings({ "rawtypes", "null", "unchecked" })
+ @Test
+ public void getAvailableRolesTest() throws IOException{
+ List actualList = null;
+ List list = null;
+ Mockito.when(roleService.getAvailableRoles(null)).thenReturn(list);
+ List expectedList = profileController.getAvailableRoles(null);
+ assertEquals(actualList, expectedList);
+ }
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java
new file mode 100644
index 00000000..c4b6e5a0
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/ProfileSearchControllerTest.java
@@ -0,0 +1,171 @@
+/*
+ * ============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;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.drools.core.command.assertion.AssertEquals;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.restful.client.SharedContextRestClient;
+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.web.support.UserUtils;
+import org.springframework.web.servlet.ModelAndView;
+
+public class ProfileSearchControllerTest {
+
+ @InjectMocks
+ ProfileSearchController profileSearchController = new ProfileSearchController();
+
+ @Mock
+ UserProfileService service;
+
+ @Mock
+ UserService userService;
+
+ @Mock
+ RoleService roleService;
+
+ @Mock
+ private SharedContextRestClient sharedContextRestClient;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ NullPointerException nullPointerException = new NullPointerException();
+
+ User user = new User();
+
+ @Mock
+ UserUtils userUtils = new UserUtils();
+
+ @Test
+ public void profileSearchTest(){
+ ModelAndView actualModelAndView = new ModelAndView();
+ List<User> userList = new ArrayList<User>();
+ Mockito.when(service.findAll()).thenReturn(userList);
+ ModelAndView expectedModelAndView = profileSearchController.profileSearch(mockedRequest);
+ assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
+ }
+
+ @Test
+ public void profileSearchExceptionTest(){
+ ModelAndView actualModelAndView = new ModelAndView();
+ List<User> userList = new ArrayList<User>();
+ Mockito.when(service.findAll()).thenThrow(nullPointerException);
+ profileSearchController.profileSearch(mockedRequest);
+ }
+
+ @Test
+ public void getUserTest() throws IOException{
+ List<User> profileList = null;
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ Mockito.when(service.findAll()).thenReturn(profileList);
+ profileSearchController.getUser(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getUserExceptionTest(){
+ List<User> profileList = null;
+ Mockito.when(service.findAll()).thenReturn(profileList);
+ profileSearchController.getUser(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getUserPaginationTest() throws IOException{
+ List<User> profileList = new ArrayList<User>();
+ Mockito.when(mockedRequest.getParameter("pageNum")).thenReturn("1");
+ Mockito.when(mockedRequest.getParameter("viewPerPage")).thenReturn("1");
+ Mockito.when(service.findAll()).thenReturn(profileList);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ profileSearchController.getUserPagination(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void getUserPaginationExceptionTest(){
+ List<User> profileList = null;
+ Mockito.when(mockedRequest.getParameter("pageNum")).thenReturn("1");
+ Mockito.when(mockedRequest.getParameter("viewPerPage")).thenReturn("1");
+ Mockito.when(service.findAll()).thenReturn(profileList);
+ profileSearchController.getUserPagination(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void toggleProfileActiveTest() throws IOException{
+ User user = new User();
+ Mockito.when(mockedRequest.getParameter("profile_id")).thenReturn("1");
+ Mockito.when(userService.getUser("1")).thenReturn(user);
+ StringWriter sw = new StringWriter();
+ PrintWriter writer = new PrintWriter(sw);
+ Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
+ profileSearchController.toggleProfileActive(mockedRequest, mockedResponse);
+ }
+
+ @Test
+ public void toggleProfileActiveExceptionTest() throws IOException{
+ profileSearchController.toggleProfileActive(mockedRequest, mockedResponse);
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/SDKLoginControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/SDKLoginControllerTest.java
new file mode 100644
index 00000000..045f3823
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/SDKLoginControllerTest.java
@@ -0,0 +1,135 @@
+/*
+ * ============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;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.auth.LoginStrategy;
+import org.onap.portalsdk.core.service.LoginService;
+import org.onap.portalsdk.core.service.RoleService;
+import org.springframework.web.servlet.ModelAndView;
+
+public class SDKLoginControllerTest {
+
+ @InjectMocks
+ SDKLoginController sdkLoginController = new SDKLoginController();
+
+ @Mock
+ RoleService roleService;
+
+ @Mock
+ LoginService loginService;
+
+ @Mock
+ LoginStrategy loginStrategy;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+
+ @Test
+ public void loginTest(){
+ ModelAndView actualModelAndView = new ModelAndView("login");
+ ModelAndView expectedModelAndView = sdkLoginController.login();
+ assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
+ }
+
+ @Test
+ public void externalLogon(){
+ ModelAndView actualModelAndView = new ModelAndView("login_external");
+ ModelAndView expectedModelAndView = sdkLoginController.externalLogin();
+ assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
+ }
+
+ @Test
+ public void doexternalLoginTest() throws IOException{
+ ModelAndView actualModelAndView = new ModelAndView();
+ Mockito.when(loginStrategy.doExternalLogin(mockedRequest, mockedResponse)).thenReturn(actualModelAndView);
+ ModelAndView expectedModelAndView = sdkLoginController.doexternalLogin(mockedRequest, mockedResponse);
+ assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
+ }
+
+ @Test
+ public void doLoginTest() throws Exception{
+ ModelAndView actualModelAndView = new ModelAndView();
+ Mockito.when(loginStrategy.doLogin(mockedRequest, mockedResponse)).thenReturn(actualModelAndView);
+ ModelAndView expectedModelAndView = sdkLoginController.doLogin(mockedRequest, mockedResponse);
+ assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
+ }
+
+ @Test
+ public void getJessionIdTest(){
+ String expectedResult = null;
+ String actualResult = sdkLoginController.getJessionId(mockedRequest);
+ assertEquals(expectedResult, actualResult);
+ }
+
+ @Test
+ public void getViewNameTest(){
+ String actualResult ="test";
+ sdkLoginController.setViewName("test");
+ String expectedResult = sdkLoginController.getViewName();
+ assertEquals(expectedResult, actualResult);
+ }
+
+ @Test
+ public void getLoginServiceTest(){
+ sdkLoginController.setLoginService(loginService);
+ LoginService expectedResult = sdkLoginController.getLoginService();
+ assertEquals(expectedResult.getClass(), sdkLoginController.getLoginService().getClass());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UsageListControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UsageListControllerTest.java
new file mode 100644
index 00000000..98a23e8f
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UsageListControllerTest.java
@@ -0,0 +1,69 @@
+/*
+ * ============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;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.service.ProfileService;
+
+public class UsageListControllerTest {
+
+ @InjectMocks
+ UsageListController usageListController = new UsageListController();
+
+ @Mock
+ ProfileService service;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
+
+}
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UserProfileControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UserProfileControllerTest.java
new file mode 100644
index 00000000..8d0a5a91
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/UserProfileControllerTest.java
@@ -0,0 +1,88 @@
+/*
+ * ============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;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.onap.portalsdk.core.domain.Profile;
+import org.onap.portalsdk.core.service.ProfileService;
+import org.springframework.web.servlet.ModelAndView;
+
+public class UserProfileControllerTest {
+
+ @InjectMocks
+ UserProfileController userProfileController = new UserProfileController();
+
+ @Mock
+ ProfileService service;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
+
+ @Test
+ public void userProfileTest() throws IOException{
+ ModelAndView actualModelAndView = new ModelAndView("user_profile");
+ List<Profile> profileList = new ArrayList<Profile>();
+ Mockito.when(service.findAll()).thenReturn(profileList);
+ ModelAndView expectedModelAndView = userProfileController.userProfile();
+ assertEquals(actualModelAndView.getViewName(), expectedModelAndView.getViewName());
+ }
+}
+
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/WelcomeControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/WelcomeControllerTest.java
new file mode 100644
index 00000000..4c49e3d2
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/WelcomeControllerTest.java
@@ -0,0 +1,74 @@
+/*
+ * ============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;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.framework.MockitoTestSuite;
+import org.springframework.web.servlet.ModelAndView;
+
+public class WelcomeControllerTest {
+
+ @InjectMocks
+ WelcomeController welcomeController = new WelcomeController();
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
+ HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
+ NullPointerException nullPointerException = new NullPointerException();
+
+ @Test
+ public void welcomeTest(){
+ ModelAndView expectedResult = null;
+ expectedResult = welcomeController.welcome();
+ assertNull(expectedResult.getViewName());
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-os/README.md b/ecomp-sdk/epsdk-app-os/README.md
index f74d043f..9d35d03a 100644
--- a/ecomp-sdk/epsdk-app-os/README.md
+++ b/ecomp-sdk/epsdk-app-os/README.md
@@ -29,6 +29,7 @@ Version 1.4.0
- PORTAL-104 Replaced the sql connector to maria db
- PORTAL-127 Remove GreenSock license code from b2b library
- PORTAL-118 Missing Error page in Portal-SDK app when there is an exception happen in the backend.
+- PORTAL-19 Replaced openecomp keyword to onap
* Put new entries here *
diff --git a/ecomp-sdk/epsdk-app-os/pom.xml b/ecomp-sdk/epsdk-app-os/pom.xml
index 059c5ea0..062d013b 100644
--- a/ecomp-sdk/epsdk-app-os/pom.xml
+++ b/ecomp-sdk/epsdk-app-os/pom.xml
@@ -10,7 +10,7 @@
<parent>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
</parent>
<!-- GroupId is inherited from parent -->
diff --git a/ecomp-sdk/epsdk-app-os/src/main/resources/portal.properties b/ecomp-sdk/epsdk-app-os/src/main/resources/portal.properties
index 1a8cd1fe..713c6449 100644
--- a/ecomp-sdk/epsdk-app-os/src/main/resources/portal.properties
+++ b/ecomp-sdk/epsdk-app-os/src/main/resources/portal.properties
@@ -56,10 +56,10 @@ use_rest_for_functional_menu=true
portal.api.impl.class = org.onap.portalapp.service.OnBoardingApiServiceImpl
# URL of the Portal where this app is onboarded
-ecomp_redirect_url = https://portal.openecomp.org/ecompportal/process_csp
+ecomp_redirect_url = https://portal.onap.org/ecompportal/process_csp
# URL of the ECOMP Portal REST API
-ecomp_rest_url = http://portal.openecomp.org:50580/ecompportal/auxapi
+ecomp_rest_url = http://portal.onap.org:50580/ecompportal/auxapi
# Applications do not need to run a UEB listener after 1607.
ueb_listeners_enable = false
diff --git a/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties b/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties
index 0dc81301..7e2b7d13 100644
--- a/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties
+++ b/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties
@@ -66,7 +66,7 @@ instance_uuid=8da691c9-987d-43ed-a358-00ac2f35685d
# Application base URL has the host and app context only; a proper prefix of the on-boarded URL.
# Only required for applications using FE/BE separation. For example:
-# app_base_url = https://www.openecomp.org/app_context/
+# app_base_url = https://www.onap.org/app_context/
#authenticate user server
authenticate_user_server=http://todo_enter_auth_server_hostname:8383/openid-connect-server-webapp/allUsers
diff --git a/ecomp-sdk/epsdk-app-overlay/pom.xml b/ecomp-sdk/epsdk-app-overlay/pom.xml
index 8415cf49..b78973df 100644
--- a/ecomp-sdk/epsdk-app-overlay/pom.xml
+++ b/ecomp-sdk/epsdk-app-overlay/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
</parent>
<!-- GroupId is inherited from parent -->
diff --git a/ecomp-sdk/epsdk-core/pom.xml b/ecomp-sdk/epsdk-core/pom.xml
index c47effa6..b3f59223 100644
--- a/ecomp-sdk/epsdk-core/pom.xml
+++ b/ecomp-sdk/epsdk-core/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
</parent>
<!-- GroupId is inherited from parent -->
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/LoginBeanTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/LoginBeanTest.java
new file mode 100644
index 00000000..11fbe61a
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/LoginBeanTest.java
@@ -0,0 +1,88 @@
+/*
+ * ============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.command;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class LoginBeanTest {
+
+
+ public LoginBean mockLoginBean()
+ {
+ LoginBean mockLoginBean = new LoginBean();
+ mockLoginBean.setLoginId("test12");
+ mockLoginBean.setLoginPwd("testPwd");
+ mockLoginBean.setHrid(null);
+ mockLoginBean.setUserid("test12");
+ mockLoginBean.setSiteAccess("testSiteAccess");
+ mockLoginBean.setLoginErrorMessage("error");
+ mockLoginBean.setUser(null);
+ mockLoginBean.setBusinessDirectMenu(null);
+ mockLoginBean.setMenu(null);
+ return mockLoginBean;
+ }
+
+ @Test
+ public void loginBeanTest()
+ {
+ LoginBean mockLoginBean = mockLoginBean();
+ LoginBean loginBean = new LoginBean();
+ loginBean.setLoginId("test12");
+ loginBean.setLoginPwd("testPwd");
+ loginBean.setHrid(null);
+ loginBean.setUserid("test12");
+ loginBean.setSiteAccess("testSiteAccess");
+ loginBean.setLoginErrorMessage("error");
+ loginBean.setUser(null);
+ loginBean.setBusinessDirectMenu(null);
+ loginBean.setMenu(null);
+
+ assertEquals(loginBean.getLoginId(),mockLoginBean.getLoginId());
+ assertEquals(loginBean.getLoginPwd(),mockLoginBean.getLoginPwd());
+ assertEquals(loginBean.getHrid(),mockLoginBean.getHrid());
+ assertEquals(loginBean.getSiteAccess(),mockLoginBean.getSiteAccess());
+ assertEquals(loginBean.getUserid(),mockLoginBean.getUserid());
+ assertEquals(loginBean.getLoginErrorMessage(),mockLoginBean.getLoginErrorMessage());
+ assertEquals(loginBean.getUser(),mockLoginBean.getUser());
+ assertEquals(loginBean.getBusinessDirectMenu(),mockLoginBean.getBusinessDirectMenu());
+ assertEquals(loginBean.getMenu(),mockLoginBean.getMenu());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostDroolsBeanTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostDroolsBeanTest.java
new file mode 100644
index 00000000..58e946ae
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostDroolsBeanTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============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.command;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class PostDroolsBeanTest {
+
+ public PostDroolsBean mockPostDroolsBean() {
+ PostDroolsBean mockpostDroolsBean = new PostDroolsBean();
+ mockpostDroolsBean.setDroolsFile("testFile");
+ mockpostDroolsBean.setClassName("testClass");
+ mockpostDroolsBean.setSelectedRules("testRules");
+ return mockpostDroolsBean;
+ }
+
+ @Test
+ public void postDroolsBeanTest() {
+ PostDroolsBean mockpostDroolsBean = mockPostDroolsBean();
+ PostDroolsBean postDroolsBean = new PostDroolsBean();
+ postDroolsBean.setDroolsFile("testFile");
+ postDroolsBean.setClassName("testClass");
+ postDroolsBean.setSelectedRules("testRules");
+ assertEquals(postDroolsBean.getDroolsFile(), mockpostDroolsBean.getDroolsFile());
+ assertEquals(postDroolsBean.getClassName(), mockpostDroolsBean.getClassName());
+ assertEquals(postDroolsBean.getSelectedRules(), mockpostDroolsBean.getSelectedRules());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostSearchBeanTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostSearchBeanTest.java
new file mode 100644
index 00000000..b5bc3477
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/PostSearchBeanTest.java
@@ -0,0 +1,193 @@
+/*
+ * ============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.command;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class PostSearchBeanTest {
+
+
+ public PostSearchBean mockPostSearchBean()
+ {
+ PostSearchBean postSearchBean= new PostSearchBean();
+// postSearchBean.setUser(null);
+// postSearchBean.setUserOrig(null);
+ postSearchBean.setSelected(new String[] {"testSelected"});
+ postSearchBean.setPostHrid(new String[] {"testPostHrid"});
+ postSearchBean.setPostOrgUserId(new String[] {"testPostOrgUserId"});
+ postSearchBean.setPostFirstName(new String[] {"testPostFirstName"});
+ postSearchBean.setPostLastName(new String[] {"testPostLastName"});
+ postSearchBean.setPostOrgCode(new String[] {"testPostOrgCode"});
+ postSearchBean.setPostPhone(new String[] {"testPostPhone"});
+ postSearchBean.setPostEmail(new String[] {"testPostEmail"});
+ postSearchBean.setPostAddress1(new String[] {"testPostAddress1"});
+ postSearchBean.setPostAddress2(new String[] {"testPostAddress2"});
+ postSearchBean.setPostCity(new String[] {"testPostCity"});
+ postSearchBean.setPostState(new String[] {"testPostState"});
+ postSearchBean.setPostZipCode(new String[] {"testPostZipCode"});
+ postSearchBean.setPostLocationClli(new String[] {"testPostLocationClli"});
+ postSearchBean.setPostBusinessCountryCode(new String[] {"testPostBusinessCountryCode"});
+ postSearchBean.setPostBusinessCountryName(new String[] {"testPostBusinessCountryName"});
+ postSearchBean.setPostDepartment(new String[] {"testPostDepartment"});
+ postSearchBean.setPostDepartmentName(new String[] {"testPostDepartmentName"});
+ postSearchBean.setPostBusinessUnit(new String[] {"testPostBusinessUnit"});
+ postSearchBean.setPostBusinessUnitName(new String[] {"testPostBusinessUnitName"});
+ postSearchBean.setPostJobTitle(new String[] {"testPostJobTitle"});
+ postSearchBean.setPostOrgManagerUserId(new String[] {"testPostOrgManagerUserId"});
+ postSearchBean.setPostCommandChain(new String[] {"testPostCommandChain"});
+ postSearchBean.setPostCompanyCode(new String[] {"testPostCompanyCode"});
+ postSearchBean.setPostCompany(new String[] {"testPostCompany"});
+ postSearchBean.setPostCostCenter(new String[] {"testPostCostCenter"});
+ postSearchBean.setPostSiloStatus(new String[] {"testPostSiloStatus"});
+ postSearchBean.setPostFinancialLocCode(new String[] {"testPostFinancialLocCode"});
+ postSearchBean.setFirstName("testFirstName");
+ postSearchBean.setLastName("testLastName");
+ postSearchBean.setHrid("testHrid");
+ postSearchBean.setOrgUserId("testOrgUserID");
+ postSearchBean.setOrgCode("testOrgCode");
+ postSearchBean.setEmail("testEmail");
+ postSearchBean.setOrgManagerUserId("testOrgManagerUserId");
+ postSearchBean.setFirstNameOrig("testFirstNameOrig");
+ postSearchBean.setLastNameOrig("testLastNameOrig");
+ postSearchBean.setHridOrig("testHridOrig");
+ postSearchBean.setOrgUserIdOrig("testOrgUserIdOrig");
+ postSearchBean.setOrgCodeOrig("testOrgCodeOrig");
+ postSearchBean.setEmailOrig("testEmailOrig");
+ postSearchBean.setOrgManagerUserIdOrig("testOrgManagerUserIdOrig");
+
+ return postSearchBean;
+ }
+
+ @Test
+ public void postSearchBeanTest()
+ {
+
+ PostSearchBean mockPostSearchBean= mockPostSearchBean();
+ PostSearchBean postSearchBean= new PostSearchBean();
+// postSearchBean.setUser(null);
+// postSearchBean.setUserOrig(null);
+ postSearchBean.setSelected(new String[] {"testSelected"});
+ postSearchBean.setPostHrid(new String[] {"testPostHrid"});
+ postSearchBean.setPostOrgUserId(new String[] {"testPostOrgUserId"});
+ postSearchBean.setPostFirstName(new String[] {"testPostFirstName"});
+ postSearchBean.setPostLastName(new String[] {"testPostLastName"});
+ postSearchBean.setPostOrgCode(new String[] {"testPostOrgCode"});
+ postSearchBean.setPostPhone(new String[] {"testPostPhone"});
+ postSearchBean.setPostEmail(new String[] {"testPostEmail"});
+ postSearchBean.setPostAddress1(new String[] {"testPostAddress1"});
+ postSearchBean.setPostAddress2(new String[] {"testPostAddress2"});
+ postSearchBean.setPostCity(new String[] {"testPostCity"});
+ postSearchBean.setPostState(new String[] {"testPostState"});
+ postSearchBean.setPostZipCode(new String[] {"testPostZipCode"});
+ postSearchBean.setPostLocationClli(new String[] {"testPostLocationClli"});
+ postSearchBean.setPostBusinessCountryCode(new String[] {"testPostBusinessCountryCode"});
+ postSearchBean.setPostBusinessCountryName(new String[] {"testPostBusinessCountryName"});
+ postSearchBean.setPostDepartment(new String[] {"testPostDepartment"});
+ postSearchBean.setPostDepartmentName(new String[] {"testPostDepartmentName"});
+ postSearchBean.setPostBusinessUnit(new String[] {"testPostBusinessUnit"});
+ postSearchBean.setPostBusinessUnitName(new String[] {"testPostBusinessUnitName"});
+ postSearchBean.setPostJobTitle(new String[] {"testPostJobTitle"});
+ postSearchBean.setPostOrgManagerUserId(new String[] {"testPostOrgManagerUserId"});
+ postSearchBean.setPostCommandChain(new String[] {"testPostCommandChain"});
+ postSearchBean.setPostCompanyCode(new String[] {"testPostCompanyCode"});
+ postSearchBean.setPostCompany(new String[] {"testPostCompany"});
+ postSearchBean.setPostCostCenter(new String[] {"testPostCostCenter"});
+ postSearchBean.setPostSiloStatus(new String[] {"testPostSiloStatus"});
+ postSearchBean.setPostFinancialLocCode(new String[] {"testPostFinancialLocCode"});
+ postSearchBean.setFirstName("testFirstName");
+ postSearchBean.setLastName("testLastName");
+ postSearchBean.setHrid("testHrid");
+ postSearchBean.setOrgUserId("testOrgUserID");
+ postSearchBean.setOrgCode("testOrgCode");
+ postSearchBean.setEmail("testEmail");
+ postSearchBean.setOrgManagerUserId("testOrgManagerUserId");
+ postSearchBean.setFirstNameOrig("testFirstNameOrig");
+ postSearchBean.setLastNameOrig("testLastNameOrig");
+ postSearchBean.setHridOrig("testHridOrig");
+ postSearchBean.setOrgUserIdOrig("testOrgUserIdOrig");
+ postSearchBean.setOrgCodeOrig("testOrgCodeOrig");
+ postSearchBean.setEmailOrig("testEmailOrig");
+ postSearchBean.setOrgManagerUserIdOrig("testOrgManagerUserIdOrig");
+ assertNull(postSearchBean.getUser().getCity());
+ assertNull(postSearchBean.getUserOrig().getCity());
+ assertEquals(postSearchBean.getSelected().length, mockPostSearchBean.getSelected().length);
+ assertEquals(postSearchBean.getPostHrid().length, mockPostSearchBean.getPostHrid().length);
+ assertEquals(postSearchBean.getPostOrgUserId().length, mockPostSearchBean.getPostOrgUserId().length);
+ assertEquals(postSearchBean.getPostFirstName().length,mockPostSearchBean.getPostFirstName().length);
+ assertEquals(postSearchBean.getPostLastName().length,mockPostSearchBean.getPostLastName().length);
+ assertEquals(postSearchBean.getPostOrgCode().length,mockPostSearchBean.getPostOrgCode().length);
+ assertEquals(postSearchBean.getPostPhone().length,mockPostSearchBean.getPostPhone().length);
+ assertEquals(postSearchBean.getPostEmail().length,mockPostSearchBean.getPostEmail().length);
+ assertEquals(postSearchBean.getPostAddress1().length,mockPostSearchBean.getPostAddress1().length);
+ assertEquals(postSearchBean.getPostAddress2().length,mockPostSearchBean.getPostAddress2().length);
+ assertEquals(postSearchBean.getPostCity().length,mockPostSearchBean.getPostCity().length);
+ assertEquals(postSearchBean.getPostState().length,mockPostSearchBean.getPostState().length);
+ assertEquals(postSearchBean.getPostZipCode().length,mockPostSearchBean.getPostZipCode().length);
+ assertEquals(postSearchBean.getPostLocationClli().length,mockPostSearchBean.getPostLocationClli().length);
+ assertEquals(postSearchBean.getPostBusinessCountryCode().length,mockPostSearchBean.getPostBusinessCountryCode().length);
+ assertEquals(postSearchBean.getPostBusinessCountryName().length,mockPostSearchBean.getPostBusinessCountryName().length);
+ assertEquals(postSearchBean.getPostDepartment().length,mockPostSearchBean.getPostDepartment().length);
+ assertEquals(postSearchBean.getPostDepartmentName().length,mockPostSearchBean.getPostDepartmentName().length);
+ assertEquals(postSearchBean.getPostBusinessUnit().length,mockPostSearchBean.getPostBusinessUnit().length);
+ assertEquals(postSearchBean.getPostBusinessUnitName().length,mockPostSearchBean.getPostBusinessUnitName().length);
+ assertEquals(postSearchBean.getPostJobTitle().length,mockPostSearchBean.getPostJobTitle().length);
+ assertEquals(postSearchBean.getPostOrgManagerUserId().length,mockPostSearchBean.getPostOrgManagerUserId().length);
+ assertEquals(postSearchBean.getPostCommandChain().length,mockPostSearchBean.getPostCommandChain().length);
+ assertEquals(postSearchBean.getPostCompanyCode().length,mockPostSearchBean.getPostCompanyCode().length);
+ assertEquals(postSearchBean.getPostCompany().length,mockPostSearchBean.getPostCompany().length);
+ assertEquals(postSearchBean.getPostCostCenter().length,mockPostSearchBean.getPostCostCenter().length);
+ assertEquals(postSearchBean.getPostSiloStatus().length,mockPostSearchBean.getPostSiloStatus().length);
+ assertEquals(postSearchBean.getPostFinancialLocCode().length,mockPostSearchBean.getPostFinancialLocCode().length);
+ assertEquals(postSearchBean.getFirstName(),mockPostSearchBean.getFirstName());
+ assertEquals(postSearchBean.getLastName(),mockPostSearchBean.getLastName());
+ assertEquals(postSearchBean.getHrid(),mockPostSearchBean.getHrid());
+ assertEquals(postSearchBean.getOrgCode(),mockPostSearchBean.getOrgCode());
+ assertEquals(postSearchBean.getEmail(),mockPostSearchBean.getEmail());
+ assertEquals(postSearchBean.getOrgManagerUserId(),mockPostSearchBean.getOrgManagerUserId());
+ assertEquals(postSearchBean.getFirstNameOrig(),mockPostSearchBean.getFirstNameOrig());
+ assertEquals(postSearchBean.getLastNameOrig(),mockPostSearchBean.getLastNameOrig());
+ assertEquals(postSearchBean.getHridOrig(),mockPostSearchBean.getHridOrig());
+ assertEquals(postSearchBean.getOrgUserIdOrig(),mockPostSearchBean.getOrgUserIdOrig());
+ assertEquals(postSearchBean.getOrgCodeOrig(),mockPostSearchBean.getOrgCodeOrig());
+ assertEquals(postSearchBean.getEmailOrig(),mockPostSearchBean.getEmailOrig());
+ assertEquals(postSearchBean.getOrgManagerUserIdOrig(),mockPostSearchBean.getOrgManagerUserIdOrig());
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/UserRowBeanTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/UserRowBeanTest.java
new file mode 100644
index 00000000..78c139e0
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/UserRowBeanTest.java
@@ -0,0 +1,76 @@
+/*
+ * ============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.command;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class UserRowBeanTest {
+
+ public UserRowBean mockUserRowBean()
+ {
+ UserRowBean userRowBean = new UserRowBean();
+ userRowBean.setSessionId("testSessionId");
+ userRowBean.setLastAccess("testLastAccess");
+ userRowBean.setRemaining("testRemaining");
+ userRowBean.setLoginTime("testLoginTime");
+ userRowBean.setLastLoginTime("testLastLoginTime");
+ return userRowBean;
+ }
+
+ @Test
+ public void userRowBeanTest()
+ {
+ UserRowBean mockUserRowBean = mockUserRowBean();
+ UserRowBean userRowBean = new UserRowBean();
+ userRowBean.setSessionId("testSessionId");
+ userRowBean.setLastAccess("testLastAccess");
+ userRowBean.setRemaining("testRemaining");
+ userRowBean.setLoginTime("testLoginTime");
+ userRowBean.setLastLoginTime("testLastLoginTime");
+
+ assertEquals(userRowBean.getSessionId(),mockUserRowBean.getSessionId());
+ assertEquals(userRowBean.getLastAccess(),mockUserRowBean.getLastAccess());
+ assertEquals(userRowBean.getRemaining(),mockUserRowBean.getRemaining());
+ assertEquals(userRowBean.getLoginTime(),mockUserRowBean.getLoginTime());
+ assertEquals(userRowBean.getLastLoginTime(),mockUserRowBean.getLastLoginTime());
+
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/support/SearchResultTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/support/SearchResultTest.java
new file mode 100644
index 00000000..5f49cf09
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/command/support/SearchResultTest.java
@@ -0,0 +1,76 @@
+/*
+ * ============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.command.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class SearchResultTest {
+
+ public SearchResult mockSearchResult(){
+
+ SearchResult SearchResult = new SearchResult();
+
+ SearchResult.setAccessType("test");
+ SearchResult.setDataSize(1);
+ SearchResult.setPageNo(1);
+ SearchResult.setPageSize(1);
+
+ return SearchResult;
+ }
+
+ @Test
+ public void searchResultTest(){
+ SearchResult searchResult1 = mockSearchResult();
+
+ SearchResult SearchResult = new SearchResult();
+
+ SearchResult.setAccessType("test");
+ SearchResult.setDataSize(1);
+ SearchResult.setPageNo(1);
+ SearchResult.setPageSize(1);
+
+ assertEquals(SearchResult.getAccessType(), searchResult1.getAccessType());
+ assertEquals(SearchResult.getDataSize(), searchResult1.getDataSize());
+ assertEquals(SearchResult.getPageNo(), searchResult1.getPageNo());
+ assertEquals(SearchResult.getPageSize(), searchResult1.getPageSize());
+ assertEquals(SearchResult.getSize(), searchResult1.getSize());
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AppTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AppTest.java
new file mode 100644
index 00000000..8deaf877
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AppTest.java
@@ -0,0 +1,123 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class AppTest {
+
+ public App mockApp() {
+ App app = new App();
+ app.setName("testApp");
+ app.setImageUrl("testmageUrl");
+ app.setDescription("testdescription");
+ app.setNotes("testNotes");
+ app.setUrl("testUrl");
+ app.setAlternateUrl("testAlternateUrl");
+ app.setRestEndpoint("testRestEndpoint");
+ app.setMlAppName("testMlAppName");
+ app.setMlAppAdminId("testMlAppAdminId");
+ app.setMotsId("testMotsId");
+ app.setAppPassword("testAppPassword");
+ app.setOpen("testOpen");
+ app.setEnabled("testEnabled");
+ app.setThumbnail(null);
+ app.setUsername("testUsername");
+ app.setUebKey("testUebKey");
+ app.setUebSecret("testUebSecret");
+ app.setUebTopicName("testuebTopicName");
+ return app;
+ }
+
+ @Test
+ public void appTest()
+ {
+ App mockApp = mockApp();
+ App app = new App();
+ app.setName("testApp");
+ app.setImageUrl("testmageUrl");
+ app.setDescription("testdescription");
+ app.setNotes("testNotes");
+ app.setUrl("testUrl");
+ app.setAlternateUrl("testAlternateUrl");
+ app.setRestEndpoint("testRestEndpoint");
+ app.setMlAppName("testMlAppName");
+ app.setMlAppAdminId("testMlAppAdminId");
+ app.setMotsId("testMotsId");
+ app.setAppPassword("testAppPassword");
+ app.setOpen("testOpen");
+ app.setEnabled("testEnabled");
+ app.setThumbnail(null);
+ app.setUsername("testUsername");
+ app.setUebKey("testUebKey");
+ app.setUebSecret("testUebSecret");
+ app.setUebTopicName("testuebTopicName");
+
+ assertEquals(app.getName(), mockApp.getName());
+ assertEquals(app.getImageUrl(), mockApp.getImageUrl());
+ assertEquals(app.getDescription(), mockApp.getDescription());
+ assertEquals(app.getNotes(), mockApp.getNotes());
+ assertEquals(app.getUrl(), mockApp.getUrl());
+ assertEquals(app.getAlternateUrl(), mockApp.getAlternateUrl());
+ assertEquals(app.getRestEndpoint(), mockApp.getRestEndpoint());
+ assertEquals(app.getMlAppName(), mockApp.getMlAppName());
+ assertEquals(app.getMlAppAdminId(), mockApp.getMlAppAdminId());
+ assertEquals(app.getMotsId(), mockApp.getMotsId());
+ assertEquals(app.getOpen(), mockApp.getOpen());
+ assertEquals(app.getEnabled(), mockApp.getEnabled());
+ assertEquals(app.getThumbnail(), mockApp.getThumbnail());
+ assertEquals(app.getUsername(), mockApp.getUsername());
+ assertEquals(app.getUebKey(), mockApp.getUebKey());
+ assertEquals(app.getUebSecret(), mockApp.getUebSecret());
+ assertEquals(app.getUebTopicName(), mockApp.getUebTopicName());
+ assertEquals(app.getAppPassword(), mockApp.getAppPassword());
+
+ }
+
+ @Test
+ public void compareToTest()
+ {
+ App app = new App();
+ app.setId((long) 1);
+ int result = app.compareTo(app);
+ assertEquals(result, 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java
new file mode 100644
index 00000000..8b43053e
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/AuditLogTest.java
@@ -0,0 +1,73 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class AuditLogTest {
+
+ public AuditLog mockAuditLog()
+ {
+ AuditLog auditLog = new AuditLog();
+ auditLog.setActivityCode("activityCode");
+ auditLog.setAffectedRecordId("affectedRecordId");
+ auditLog.setComments("comments");
+ auditLog.setAuditDate(null);
+ auditLog.setUserId((long) 1);
+ return auditLog;
+ }
+
+ @Test
+ public void auditLogTest()
+ {
+ AuditLog mockAuditLog = mockAuditLog();
+ AuditLog auditLog = new AuditLog();
+ auditLog.setActivityCode("activityCode");
+ auditLog.setAffectedRecordId("affectedRecordId");
+ auditLog.setComments("comments");
+ auditLog.setAuditDate(null);
+ auditLog.setUserId((long) 1);
+ assertEquals(auditLog.getActivityCode(), mockAuditLog.getActivityCode());
+ assertEquals(auditLog.getAffectedRecordId(), mockAuditLog.getAffectedRecordId());
+ assertEquals(auditLog.getComments(), mockAuditLog.getComments());
+ assertEquals(auditLog.getAuditDate(), mockAuditLog.getAuditDate());
+ assertEquals(auditLog.getUserId(), mockAuditLog.getUserId());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java
new file mode 100644
index 00000000..6174a413
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/BroadcastMessageTest.java
@@ -0,0 +1,101 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class BroadcastMessageTest {
+
+ public BroadcastMessage mockBroadcastMessage() {
+ BroadcastMessage broadcastMessage = new BroadcastMessage();
+ broadcastMessage.setMessageText("messageText");
+ broadcastMessage.setLocationId(1);
+ broadcastMessage.setStartDate(null);
+ broadcastMessage.setEndDate(null);
+ broadcastMessage.setSortOrder(1);
+ broadcastMessage.setActive(false);
+ broadcastMessage.setSiteCd("siteCd");
+ return broadcastMessage;
+ }
+
+ @Test
+ public void broadcastMessageTest() {
+ BroadcastMessage mockBroadcastMessage = mockBroadcastMessage();
+ BroadcastMessage broadcastMessage = new BroadcastMessage();
+ broadcastMessage.setMessageText("messageText");
+ broadcastMessage.setLocationId(1);
+ broadcastMessage.setStartDate(null);
+ broadcastMessage.setEndDate(null);
+ broadcastMessage.setSortOrder(1);
+ broadcastMessage.setActive(false);
+ broadcastMessage.setSiteCd("siteCd");
+ assertEquals(broadcastMessage.getMessageText(), mockBroadcastMessage.getMessageText());
+ assertEquals(broadcastMessage.getLocationId(), mockBroadcastMessage.getLocationId());
+ assertEquals(broadcastMessage.getStartDate(), mockBroadcastMessage.getStartDate());
+ assertEquals(broadcastMessage.getEndDate(), mockBroadcastMessage.getEndDate());
+ assertEquals(broadcastMessage.getSortOrder(), mockBroadcastMessage.getSortOrder());
+ assertEquals(broadcastMessage.getActive(), mockBroadcastMessage.getActive());
+ assertEquals(broadcastMessage.getSiteCd(), mockBroadcastMessage.getSiteCd());
+ }
+
+ @Test
+ public void compareToTest()
+ {
+ BroadcastMessage broadcastMessage = new BroadcastMessage();
+ broadcastMessage.setLocationId(1);
+ broadcastMessage.setSortOrder(1);
+ broadcastMessage.setId((long) 2);
+ int result = broadcastMessage.compareTo(broadcastMessage);
+ assertEquals(result, 0);
+ }
+
+ @Test
+ public void compareToDiffTest()
+ {
+ BroadcastMessage broadcastMessage = new BroadcastMessage();
+ BroadcastMessage broadcastMessage1 = new BroadcastMessage();
+ broadcastMessage.setLocationId(0);
+ broadcastMessage1.setLocationId(1);
+ broadcastMessage.setSortOrder(1);
+ broadcastMessage.setId((long) 2);
+ int result = broadcastMessage1.compareTo(broadcastMessage);
+ assertEquals(result, 1);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java
new file mode 100644
index 00000000..0c57a2d4
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/FnMenuTest.java
@@ -0,0 +1,98 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class FnMenuTest {
+
+ public FnMenu mockFnMenuTest() {
+ FnMenu fnMenu = new FnMenu();
+ fnMenu.setMenuId(1);
+ fnMenu.setLabel("label");
+ fnMenu.setParentId(1);
+ fnMenu.setAction("action");
+ fnMenu.setFunctionCd("functionCd");
+ fnMenu.setSortOrder(1);
+ fnMenu.setServlet("servlet");
+ fnMenu.setQueryString("queryString");
+ fnMenu.setExternalUrl("externalUrl");
+ fnMenu.setTarget("target");
+ fnMenu.setActive("active");
+ fnMenu.setSeparator("separator");
+ fnMenu.setImageSrc("imageSrc");
+ fnMenu.setMenuSetCode("menuSetCode");
+ return fnMenu;
+ }
+
+ @Test
+ public void fnMenuTest() {
+ FnMenu mockFnMenu = mockFnMenuTest();
+ FnMenu fnMenu = new FnMenu();
+ fnMenu.setMenuId(1);
+ fnMenu.setLabel("label");
+ fnMenu.setParentId(1);
+ fnMenu.setAction("action");
+ fnMenu.setFunctionCd("functionCd");
+ fnMenu.setSortOrder(1);
+ fnMenu.setServlet("servlet");
+ fnMenu.setQueryString("queryString");
+ fnMenu.setExternalUrl("externalUrl");
+ fnMenu.setTarget("target");
+ fnMenu.setActive("active");
+ fnMenu.setSeparator("separator");
+ fnMenu.setImageSrc("imageSrc");
+ fnMenu.setMenuSetCode("menuSetCode");
+ assertEquals(fnMenu.getMenuId(), mockFnMenu.getMenuId());
+ assertEquals(fnMenu.getLabel(), mockFnMenu.getLabel());
+ assertEquals(fnMenu.getParentId(), mockFnMenu.getParentId());
+ assertEquals(fnMenu.getAction(), mockFnMenu.getAction());
+ assertEquals(fnMenu.getSortOrder(), mockFnMenu.getSortOrder());
+ assertEquals(fnMenu.getServlet(), mockFnMenu.getServlet());
+ assertEquals(fnMenu.getQueryString(), mockFnMenu.getQueryString());
+ assertEquals(fnMenu.getExternalUrl(), mockFnMenu.getExternalUrl());
+ assertEquals(fnMenu.getTarget(), mockFnMenu.getTarget());
+ assertEquals(fnMenu.getActive(), mockFnMenu.getActive());
+ assertEquals(fnMenu.getSeparator(), mockFnMenu.getSeparator());
+ assertEquals(fnMenu.getImageSrc(), mockFnMenu.getImageSrc());
+ assertEquals(fnMenu.getMenuSetCode(), mockFnMenu.getMenuSetCode());
+ assertEquals(fnMenu.getFunctionCd(), mockFnMenu.getFunctionCd());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java
new file mode 100644
index 00000000..7d4fbef2
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LoginBeanTest.java
@@ -0,0 +1,83 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class LoginBeanTest {
+
+ public LoginBean mockLoginBean() {
+ LoginBean loginBean = new LoginBean();
+ loginBean.setLoginId("loginId");
+ loginBean.setLoginPwd("loginPwd");
+ loginBean.setHrid("hrid");
+ loginBean.setOrgUserId("orgUserId");
+ loginBean.setSiteAccess("siteAccess");
+ loginBean.setLoginErrorMessage("loginErrorMessage");
+ loginBean.setUser(null);
+ loginBean.setMenu(null);
+ loginBean.setBusinessDirectMenu(null);
+ return loginBean;
+ }
+
+ @Test
+ public void loginBeanTest() {
+ LoginBean mockLoginBean = mockLoginBean();
+ LoginBean loginBean = new LoginBean();
+ loginBean.setLoginId("loginId");
+ loginBean.setLoginPwd("loginPwd");
+ loginBean.setHrid("hrid");
+ loginBean.setOrgUserId("orgUserId");
+ loginBean.setSiteAccess("siteAccess");
+ loginBean.setLoginErrorMessage("loginErrorMessage");
+ loginBean.setUser(null);
+ loginBean.setMenu(null);
+ loginBean.setBusinessDirectMenu(null);
+ assertEquals(loginBean.getLoginId(), mockLoginBean.getLoginId());
+ assertEquals(loginBean.getLoginPwd(), mockLoginBean.getLoginPwd());
+ assertEquals(loginBean.getHrid(), mockLoginBean.getHrid());
+ assertEquals(loginBean.getOrgUserId(), mockLoginBean.getOrgUserId());
+ assertEquals(loginBean.getSiteAccess(), mockLoginBean.getSiteAccess());
+ assertEquals(loginBean.getLoginErrorMessage(), mockLoginBean.getLoginErrorMessage());
+ assertEquals(loginBean.getUser(), mockLoginBean.getUser());
+ assertEquals(loginBean.getMenu(), mockLoginBean.getMenu());
+ assertEquals(loginBean.getBusinessDirectMenu(), mockLoginBean.getBusinessDirectMenu());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java
new file mode 100644
index 00000000..9dcd43f7
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LookupTest.java
@@ -0,0 +1,73 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.NameValueId;
+
+public class LookupTest {
+
+ public Lookup mockLookUp() {
+ Lookup lookup = new Lookup();
+ NameValueId nameValueId = new NameValueId();
+ nameValueId.setLab("label");
+ nameValueId.setVal("value");
+ lookup.setLabel(nameValueId.getLab());
+ lookup.setValue(nameValueId.getVal());
+ lookup.setNameValueId(nameValueId);
+ return lookup;
+ }
+
+ @Test
+ public void lookupTest() {
+ Lookup lookup = mockLookUp();
+ Lookup lookup1 = new Lookup("label", "value");
+ assertEquals(lookup.getLabel(), "label");
+ assertEquals(lookup.getValue(), "value");
+ assertEquals(lookup, lookup1);
+ assertNotNull(lookup.hashCode());
+ assertTrue(lookup.equals(lookup1));
+ Lookup lookup2 = null;
+ assertFalse(lookup.equals(lookup2));
+ NameValueId nameValueId = new NameValueId();
+ assertFalse(lookup.equals(nameValueId));
+ assertEquals(lookup.getNameValueId().getLab(), lookup1.getNameValueId().getLab());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java
new file mode 100644
index 00000000..a5afc07d
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuCountryTest.java
@@ -0,0 +1,77 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class LuCountryTest {
+
+ public LuCountry mockLuCountry() {
+ LuCountry luCountry = new LuCountry();
+ luCountry.setAbbr("abbr");
+ luCountry.setCountry("country");
+ luCountry.setFullName("fullName");
+ luCountry.setWebphoneCountryLabel("webphoneCountryLabel");
+ return luCountry;
+ }
+
+ @Test
+ public void luCountryTest() {
+ LuCountry mockluCountry = mockLuCountry();
+ LuCountry luCountry = new LuCountry();
+ luCountry.setAbbr("abbr");
+ luCountry.setCountry("country");
+ luCountry.setFullName("fullName");
+ luCountry.setWebphoneCountryLabel("webphoneCountryLabel");
+ assertEquals(luCountry.getAbbr(), mockluCountry.getAbbr());
+ assertEquals(luCountry.getCountry(), mockluCountry.getCountry());
+ assertEquals(luCountry.getFullName(), mockluCountry.getFullName());
+ assertEquals(luCountry.getWebphoneCountryLabel(), mockluCountry.getWebphoneCountryLabel());
+ }
+
+ @Test
+ public void compareToTest()
+ {
+ LuCountry mockluCountry = mockLuCountry();
+ LuCountry luCountry = new LuCountry();
+ luCountry.setCountry("test");
+ assertEquals(mockluCountry.compareTo(luCountry),-17);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java
new file mode 100644
index 00000000..902d9cee
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuStateTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class LuStateTest {
+
+ public LuState mockLuState() {
+ LuState luState = new LuState();
+ luState.setAbbr("abbr");
+ luState.setState("state");
+ return luState;
+ }
+
+ @Test
+ public void luStateTest() {
+ LuState mockluState = mockLuState();
+ LuState luState = new LuState();
+ luState.setAbbr("abbr");
+ luState.setState("state");
+ assertEquals(mockluState.getAbbr(), luState.getAbbr());
+ assertEquals(mockluState.getState(), luState.getState());
+ LuState luState1 = new LuState();
+ luState1.setState("stateTest");
+ assertEquals(luState.compareTo(luState1), -4);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java
new file mode 100644
index 00000000..cf5f9369
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/LuTimeZoneTest.java
@@ -0,0 +1,68 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class LuTimeZoneTest {
+
+ public LuTimeZone mockLuTimeZone() {
+ LuTimeZone luTimeZone = new LuTimeZone();
+ luTimeZone.setName("name");
+ luTimeZone.setTimezoneId((long) 1);
+ luTimeZone.setValue("value");
+ return luTimeZone;
+ }
+
+ @Test
+ public void luTimeZone()
+ {
+ LuTimeZone luTimeZone = mockLuTimeZone();
+ LuTimeZone luTimeZone1 = mockLuTimeZone();
+ assertEquals(luTimeZone.getName(), luTimeZone1.getName());
+ assertEquals(luTimeZone.getValue(), luTimeZone1.getValue());
+ assertEquals(luTimeZone.getTimezoneId(), luTimeZone1.getTimezoneId());
+ assertEquals(luTimeZone.getId(), null);
+ luTimeZone.setId((long) 1);
+ luTimeZone1.setId((long) 2);
+ assertTrue(luTimeZone.compareTo(luTimeZone1) == -1);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java
new file mode 100644
index 00000000..2b16c9ef
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuDataTest.java
@@ -0,0 +1,72 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class MenuDataTest {
+
+ public MenuData mockMenuTest() {
+ MenuData menuData = new MenuData();
+ menuData.setParentMenu(null);
+ menuData.setChildMenus(null);
+ return menuData;
+ }
+
+ @Test
+ public void menuDataTest() {
+ MenuData menuData = mockMenuTest();
+ assertNull(menuData.getParentMenu());
+ assertNull(menuData.getChildMenus());
+ assertEquals(menuData.getActiveAsString(), "false");
+ assertEquals(menuData.getParentIdAsString(), "null");
+ assertEquals(menuData.getSeparatorAsString(), "false");
+ MenuData menuData1 = mockMenuTest();
+ menuData1.setSortOrder(null);
+ assertTrue(menuData1.compareTo(menuData) == 1);
+ menuData1.setSortOrder((short) 1);
+ menuData.setSortOrder(null);
+ assertTrue(menuData1.compareTo(menuData) == 1);
+ menuData.setSortOrder((short) 1);
+ assertTrue(menuData1.compareTo(menuData) == 1);
+ menuData.setSortOrder((short) 2);
+ assertTrue(menuData1.compareTo(menuData) == -1);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java
new file mode 100644
index 00000000..ece93c87
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/MenuTest.java
@@ -0,0 +1,84 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class MenuTest {
+
+ public Menu mockMenu() {
+ Menu menu = new Menu();
+ menu.setMenuLevel("menuLevel");
+ menu.setLabel("label");
+ menu.setParentId((long) 1);
+ menu.setAction("action");
+ menu.setFunctionCd("functionCd");
+ menu.setSortOrder((short) 1);
+ menu.setServlet("servlet");
+ menu.setQueryString("queryString");
+ menu.setExternalUrl("externalUrl");
+ menu.setTarget("target");
+ menu.setActive(false);
+ menu.setMenuSetCode("menuSetCode");
+ menu.setSeparator(false);
+ menu.setImageSrc("imageSrc");
+ return menu;
+ }
+
+ @Test
+ public void menuTest() {
+ Menu menu = mockMenu();
+ Menu menu1 = mockMenu();
+ assertEquals(menu.getMenuLevel(), menu1.getMenuLevel());
+ assertEquals(menu.getLabel(), menu1.getLabel());
+ assertEquals(menu.getParentId(), menu1.getParentId());
+ assertEquals(menu.getAction(), menu1.getAction());
+ assertEquals(menu.getFunctionCd(), menu1.getFunctionCd());
+ assertEquals(menu.getSortOrder(), menu1.getSortOrder());
+ assertEquals(menu.getServlet(), menu1.getServlet());
+ assertEquals(menu.getQueryString(), menu1.getQueryString());
+ assertEquals(menu.getExternalUrl(), menu1.getExternalUrl());
+ assertEquals(menu.getTarget(), menu1.getTarget());
+ assertEquals(menu.isActive(), menu1.isActive());
+ assertEquals(menu.getMenuSetCode(), menu1.getMenuSetCode());
+ assertEquals(menu.isSeparator(), menu1.isSeparator());
+ assertEquals(menu.getImageSrc(), menu1.getImageSrc());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java
new file mode 100644
index 00000000..aab449a4
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/ProfileTest.java
@@ -0,0 +1,70 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ProfileTest {
+
+ public Profile mockProfile() {
+ Profile profile = new Profile();
+ profile.setId((long) 1);
+ profile.setFirst_name("first_name");
+ profile.setLast_name("last_name");
+ profile.setEmail("email");
+ profile.setOrgManagerUserId("orgManagerUserId");
+ profile.setActive_yn("active_yn");
+ profile.setOrgUserId("orgUserId");
+ return profile;
+ }
+
+ @Test
+ public void profileTest() {
+ Profile profile = mockProfile();
+ Profile profile1 = mockProfile();
+ assertEquals(profile.getId(), profile1.getId());
+ assertEquals(profile.getFirst_name(), profile1.getFirst_name());
+ assertEquals(profile.getLast_name(), profile1.getLast_name());
+ assertEquals(profile.getEmail(), profile1.getEmail());
+ assertEquals(profile.getOrgManagerUserId(), profile1.getOrgManagerUserId());
+ assertEquals(profile.getActive_yn(), profile1.getActive_yn());
+ assertEquals(profile.getOrgUserId(), profile1.getOrgUserId());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java
new file mode 100644
index 00000000..82f62fa2
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleFunctionTest.java
@@ -0,0 +1,69 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class RoleFunctionTest {
+
+ public RoleFunction mockRoleFunction() {
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setCode("code");
+ roleFunction.setName("name");
+ return roleFunction;
+ }
+
+ @Test
+ public void rolefunctionTest() {
+ RoleFunction roleFunction = mockRoleFunction();
+ RoleFunction roleFunction1 = mockRoleFunction();
+ assertEquals(roleFunction.getCode(), roleFunction1.getCode());
+ assertEquals(roleFunction.getName(), roleFunction1.getName());
+ assertEquals(roleFunction.getEditUrl(), roleFunction1.getEditUrl());
+ roleFunction1.setName(null);
+ assertTrue(roleFunction.compareTo(roleFunction1) == 1);
+ RoleFunction roleFunction2 = mockRoleFunction();
+ roleFunction2.setName(null);
+ RoleFunction roleFunction3 = mockRoleFunction();
+ assertTrue(roleFunction2.compareTo(roleFunction3) == 1);
+ assertTrue(roleFunction.compareTo(roleFunction3) == 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java
new file mode 100644
index 00000000..df952a07
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/RoleTest.java
@@ -0,0 +1,111 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.junit.Test;
+
+public class RoleTest {
+
+ public Role mockRole() {
+ Role role = new Role();
+ role.setName("test");
+ role.setActive(false);
+ role.setPriority(1);
+ Set roleFunctions = new TreeSet<>();
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setCode("code");
+ roleFunction.setName("name");
+ roleFunctions.add(roleFunction);
+ role.setRoleFunctions(roleFunctions);
+ Set roles = new TreeSet<>();
+ Role newrole = new Role();
+ role.setChildRoles(roles);
+ role.setParentRoles(roles);
+ return role;
+ }
+
+ @Test
+ public void roleTest() {
+ Role role = mockRole();
+ Role role1 = mockRole();
+ assertEquals(role.getName(), role1.getName());
+ assertEquals(role.getActive(), role1.getActive());
+ assertEquals(role.getRoleFunctions().size(), role1.getRoleFunctions().size());
+ assertEquals(role.getParentRoles(), role1.getParentRoles());
+ assertEquals(role.getChildRoles(), role1.getChildRoles());
+ assertEquals(role.getPriority(), role1.getPriority());
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setCode("code1");
+ roleFunction.setName("name1");
+ role.addRoleFunction(roleFunction);
+ Role parentrole = new Role();
+ parentrole.setId((long) 1);
+ role.addParentRole(parentrole);
+ Role childrole = new Role();
+ childrole.setId((long) 2);
+ role.addChildRole(childrole);
+ assertEquals(role.getToggleActiveAltText(), "Click to Activate Role");
+ assertEquals(role.getToggleActiveImage(), "/static/fusion/images/inactive.png");
+ role.removeChildRole((long) 2);
+ role.removeParentRole((long) 1);
+ role.removeRoleFunction("code1");
+ role.setActive(true);
+ assertEquals(role.getToggleActiveImage(), "/static/fusion/images/active.png");
+ assertEquals(role.getToggleActiveAltText(), "Click to Deactivate Role");
+ assertEquals(role.getEditUrl(),"/role.htm?role_id=null");
+ }
+
+ @Test
+ public void compareToTest() {
+ Role role = mockRole();
+ role.setName(null);
+ Role role1 = mockRole();
+ assertTrue(role.compareTo(role1) == 1);
+ role.setName("test");
+ role1.setName(null);
+ assertTrue(role.compareTo(role1) == 1);
+ role1.setName("test");
+ assertTrue(role.compareTo(role1) == 0);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java
new file mode 100644
index 00000000..c9864e0b
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleKeyTest.java
@@ -0,0 +1,77 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class UrlsAccessibleKeyTest {
+
+ public UrlsAccessibleKey mockUrlsAccessibleKey() {
+ UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey();
+ urlsAccessibleKey.setUrl("url");
+ urlsAccessibleKey.setFunctionCd("functionCd");
+ return urlsAccessibleKey;
+ }
+
+ @Test
+ public void urlsAccessibleKeyTest() {
+ UrlsAccessibleKey mockurlsAccessibleKey = mockUrlsAccessibleKey();
+ UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey("url", "functionCd");
+ assertEquals(urlsAccessibleKey.getUrl(), mockurlsAccessibleKey.getUrl());
+ assertEquals(urlsAccessibleKey.getFunctionCd(), mockurlsAccessibleKey.getFunctionCd());
+ }
+
+ @Test
+ public void equalsandHashCodetest() {
+ UrlsAccessibleKey mockurlsAccessibleKey = mockUrlsAccessibleKey();
+ UrlsAccessibleKey mockurlsAccessibleKey1 = mockUrlsAccessibleKey();
+ UrlsAccessibleKey urlsAccessibleKey = mockurlsAccessibleKey;
+ assertTrue(mockurlsAccessibleKey.equals(urlsAccessibleKey));
+ assertFalse(mockurlsAccessibleKey.equals(null));
+ User user = new User();
+ assertFalse(mockurlsAccessibleKey.equals(user));
+ assertTrue(mockurlsAccessibleKey.equals(mockurlsAccessibleKey1));
+ UrlsAccessibleKey mockurlsAccessibleKey2 = new UrlsAccessibleKey("test", "test");
+ assertFalse(mockurlsAccessibleKey2.equals(mockurlsAccessibleKey1));
+ UrlsAccessibleKey mockurlsAccessibleKey3 = new UrlsAccessibleKey("url", "test");
+ assertFalse(mockurlsAccessibleKey3.equals(mockurlsAccessibleKey1));
+ assertNotNull(mockurlsAccessibleKey2.hashCode());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java
new file mode 100644
index 00000000..f02e1c22
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UrlsAccessibleTest.java
@@ -0,0 +1,75 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class UrlsAccessibleTest {
+
+ public UrlsAccessible mockUrlsAccessible() {
+ UrlsAccessible urlsAccessible = new UrlsAccessible();
+ UrlsAccessibleKey urlsAccessibleKey = new UrlsAccessibleKey();
+ urlsAccessibleKey.setUrl("url");
+ urlsAccessibleKey.setFunctionCd("functionCd");
+ urlsAccessible.setUrlsAccessibleKey(urlsAccessibleKey);
+ return urlsAccessible;
+ }
+
+ @Test
+ public void urlsAccessibleTest() {
+ UrlsAccessible urlsAccessible = mockUrlsAccessible();
+ UrlsAccessible urlsAccessible1 = new UrlsAccessible("url", "functionCd");
+ assertEquals(urlsAccessible.getUrlsAccessibleKey(), urlsAccessible1.getUrlsAccessibleKey());
+ assertEquals(urlsAccessible.getUrl(), urlsAccessible1.getUrl());
+ assertEquals(urlsAccessible.getFunctionCd(), urlsAccessible1.getFunctionCd());
+ assertNotNull(urlsAccessible.hashCode());
+ }
+
+ @Test
+ public void equlasTest() {
+ UrlsAccessible urlsAccessible = mockUrlsAccessible();
+ UrlsAccessible urlsAccessible1 = mockUrlsAccessible();
+ User user = new User();
+ assertFalse(urlsAccessible.equals(null));
+ assertFalse(urlsAccessible.equals(user));
+ assertTrue(urlsAccessible.equals(urlsAccessible1));
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java
new file mode 100644
index 00000000..5a057f9f
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppIdTest.java
@@ -0,0 +1,87 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class UserAppIdTest {
+
+
+ public UserAppId mockUserAppId() {
+ UserAppId userAppId = new UserAppId();
+ Role role = new Role();
+ role.setId((long) 1);
+ App app = new App();
+ app.setId((long) 1);
+ userAppId.setUserId((long) 1);
+ userAppId.setApp(app);
+ userAppId.setRole(role);
+ return userAppId;
+ }
+
+ @Test
+ public void userAppIdTest() {
+ UserAppId userAppId = mockUserAppId();
+ UserAppId userAppId1 = mockUserAppId();
+ User user = new User();
+ assertEquals(userAppId.getUserId(), userAppId1.getUserId());
+ assertEquals(userAppId.getApp().getId(), userAppId1.getApp().getId());
+ assertEquals(userAppId.getRole().getId(), userAppId1.getRole().getId());
+ assertTrue(userAppId.equals(userAppId1));
+ assertFalse(userAppId1.equals(user));
+ assertFalse(userAppId1.equals(null));
+ UserAppId userAppId2 = userAppId1;
+ assertTrue(userAppId2.equals(userAppId1));
+ }
+
+ @Test
+ public void hashCodeTest() {
+ UserAppId userAppId = mockUserAppId();
+ assertNotNull(userAppId.hashCode());
+ userAppId.setUserId(null);
+ userAppId.getApp().setId(null);
+ userAppId.getRole().setId(null);
+ assertNotNull(userAppId.hashCode());
+
+
+ }
+
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java
new file mode 100644
index 00000000..76704354
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserAppTest.java
@@ -0,0 +1,89 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class UserAppTest {
+
+ public UserApp mockUserApp() {
+ UserApp userapp = new UserApp();
+ Role role = new Role();
+ role.setId((long) 1);
+ userapp.setRole(role);
+ App app = new App();
+ app.setId((long) 1);
+ userapp.setApp(app);
+ userapp.setUserId((long) 1);
+ userapp.setPriority(null);
+ return userapp;
+ }
+
+ @Test
+ public void userAppTest() {
+ UserApp userapp1 = mockUserApp();
+ UserApp userapp2 = mockUserApp();
+ userapp2.setUserId((long) 2);
+ assertNull(userapp1.getPriority());
+ assertEquals(userapp2.compareTo(userapp1), 1);
+ assertNotNull(userapp1.hashCode());
+ userapp2.setUserId((long) 1);
+ assertTrue(userapp1.equals(userapp2));
+ User user = new User();
+ assertFalse(userapp2.equals(user));
+ assertFalse(user.equals(null));
+ UserApp userapp3 = userapp2;
+ assertTrue(userapp3.equals(userapp2));
+ }
+
+
+ @Test
+ public void hashCodeTest() {
+ UserApp userapp1 = mockUserApp();
+ assertNotNull(userapp1.hashCode());
+ userapp1.setUserId(null);
+ userapp1.getApp().setId(null);
+ userapp1.getRole().setId(null);
+ userapp1.setPriority(null);
+ assertNotNull(userapp1.hashCode());
+
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserTest.java
new file mode 100644
index 00000000..7dee9529
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/UserTest.java
@@ -0,0 +1,216 @@
+/*
+ * ============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.domain;
+
+import static org.junit.Assert.*;
+
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.junit.Test;
+
+public class UserTest {
+
+ public User mockUser()
+ {
+ User user = new User();
+ user.setOrgId((long) 1);
+ user.setManagerId((long) 12);
+ user.setFirstName("firstName");
+ user.setMiddleInitial("middleInitial");
+ user.setLastName("lastName");
+ user.setPhone("phone");
+ user.setFax("fax");
+ user.setCellular("cellular");
+ user.setEmail("email");
+ user.setAddressId((long) 1);
+ user.setAlertMethodCd("alertMethodCd");
+ user.setHrid("hrid");
+ user.setOrgUserId("orgUserId");
+ user.setOrgCode("orgCode");
+ user.setAddress1("address1");
+ user.setAddress2("address2");
+ user.setCity("city");
+ user.setState("state");
+ user.setZipCode("zipCode");
+ user.setCountry("country");
+ user.setOrgManagerUserId("orgManagerUserId");
+ user.setLocationClli("locationClli");
+ user.setBusinessCountryCode("businessCountryCode");
+ user.setBusinessCountryName("businessCountryName");
+ user.setBusinessUnit("businessUnit");
+ user.setBusinessUnitName("businessUnitName");
+ user.setDepartment("department");
+ user.setDepartmentName("departmentName");
+ user.setCompanyCode("companyCode");
+ user.setCompany("company");
+ user.setZipCodeSuffix("zipCodeSuffix");
+ user.setJobTitle("jobTitle");
+ user.setCommandChain("commandChain");
+ user.setSiloStatus("siloStatus");
+ user.setCostCenter("costCenter");
+ user.setFinancialLocCode("financialLocCode");
+ user.setLoginId("loginId");
+ user.setLoginPwd("loginPwd");
+ user.setLastLoginDate(null);
+ user.setActive(false);
+ user.setInternal(false);
+ user.setSelectedProfileId((long) 1);
+ user.setTimeZoneId((long) 1);
+ user.setChatId("chatId");
+ user.setUserApps(null);
+ user.setPseudoRoles(null);
+ user.setOnline(false);
+ return user;
+ }
+
+ @Test
+ public void userTest()
+ {
+ User mockUser = mockUser();
+ User user = mockUser();
+ assertEquals(user.getOrgId(), mockUser.getOrgId());
+ assertEquals(user.getManagerId(), mockUser.getManagerId());
+ assertEquals(user.getFirstName(), mockUser.getFirstName());
+ assertEquals(user.getMiddleInitial(), mockUser.getMiddleInitial());
+ assertEquals(user.getLastName(), mockUser.getLastName());
+ assertEquals(user.getPhone(), mockUser.getPhone());
+ assertEquals(user.getFax(), mockUser.getFax());
+ assertEquals(user.getCellular(), mockUser.getCellular());
+ assertEquals(user.getEmail(), mockUser.getEmail());
+ assertEquals(user.getAddressId(), mockUser.getAddressId());
+ assertEquals(user.getAlertMethodCd(), mockUser.getAlertMethodCd());
+ assertEquals(user.getHrid(), mockUser.getHrid());
+ assertEquals(user.getOrgUserId(), mockUser.getOrgUserId());
+ assertEquals(user.getOrgCode(), mockUser.getOrgCode());
+ assertEquals(user.getAddress1(), mockUser.getAddress1());
+ assertEquals(user.getAddress2(), mockUser.getAddress2());
+ assertEquals(user.getCity(), mockUser.getCity());
+ assertEquals(user.getState(), mockUser.getState());
+ assertEquals(user.getZipCode(), mockUser.getZipCode());
+ assertEquals(user.getCountry(), mockUser.getCountry());
+ assertEquals(user.getOrgManagerUserId(), mockUser.getOrgManagerUserId());
+ assertEquals(user.getLocationClli(), mockUser.getLocationClli());
+ assertEquals(user.getBusinessCountryCode(), mockUser.getBusinessCountryCode());
+ assertEquals(user.getBusinessCountryName(), mockUser.getBusinessCountryName());
+ assertEquals(user.getBusinessUnit(), mockUser.getBusinessUnit());
+ assertEquals(user.getBusinessUnitName(), mockUser.getBusinessUnitName());
+ assertEquals(user.getDepartment(), mockUser.getDepartment());
+ assertEquals(user.getDepartmentName(), mockUser.getDepartmentName());
+ assertEquals(user.getCompanyCode(), mockUser.getCompanyCode());
+ assertEquals(user.getCompany(), mockUser.getCompany());
+ assertEquals(user.getZipCodeSuffix(), mockUser.getZipCodeSuffix());
+ assertEquals(user.getJobTitle(), mockUser.getJobTitle());
+ assertEquals(user.getCommandChain(), mockUser.getCommandChain());
+ assertEquals(user.getSiloStatus(), mockUser.getSiloStatus());
+ assertEquals(user.getCostCenter(), mockUser.getCostCenter());
+ assertEquals(user.getFinancialLocCode(), mockUser.getFinancialLocCode());
+ assertEquals(user.getLoginId(), mockUser.getLoginId());
+ assertEquals(user.getLoginPwd(), mockUser.getLoginPwd());
+ assertEquals(user.getLastLoginDate(), mockUser.getLastLoginDate());
+ assertEquals(user.getActive(), mockUser.getActive());
+ assertEquals(user.getInternal(), mockUser.getInternal());
+ assertEquals(user.getSelectedProfileId(), mockUser.getSelectedProfileId());
+ assertEquals(user.getTimeZoneId(), mockUser.getTimeZoneId());
+ assertEquals(user.getChatId(), mockUser.getChatId());
+ assertEquals(user.getUserApps(), mockUser.getUserApps());
+ assertEquals(user.getPseudoRoles(), mockUser.getPseudoRoles());
+ assertEquals(user.getFullName(), mockUser.getFullName());
+ assertFalse(user.isOnline());
+
+
+ }
+
+ @Test
+ public void addAppRolesIfRolesNullTest()
+ {
+ User user = mockUser();
+ Set userApps = new TreeSet();
+ UserApp userapp = new UserApp();
+ userApps.add(userapp);
+ user.setUserApps(userApps);
+ user.setUserApps(userApps);
+ App app = new App();
+ user.addAppRoles(app, null);
+ }
+
+ @Test
+ public void addAppRolesTest()
+ {
+ User user = mockUser();
+ App app = new App();
+
+ SortedSet<Role> roles = new TreeSet<>();
+ Role role = new Role();
+ role.setId((long) 1);
+ role.setName("test");
+ roles.add(role);
+ user.addAppRoles(app, roles);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void addandRemoveRoleTest()
+ {
+ User user = mockUser();
+ Set userApps = new TreeSet();
+ UserApp userapp = new UserApp();
+ SortedSet<Role> roles = new TreeSet();
+ Role role = new Role();
+ role.setId((long) 1);
+ roles.add(role);
+ userapp.setRole(role);
+ userApps.add(userapp);
+ user.setUserApps(userApps);
+ user.removeRole((long) 1);
+ user.addRole(role);
+ user.setRoles(roles);
+ UserApp userapplication = user.getDefaultUserApp();
+ assertTrue(userapplication.getRole().getId() == 1);
+ }
+
+ @Test
+ public void comapreToTest() {
+
+ User user1 = mockUser();
+ User user = mockUser();
+ user.setFirstName("test");
+ assertEquals(user.compareTo(user1), 14);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/sessionmgt/TimeoutVOTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/sessionmgt/TimeoutVOTest.java
new file mode 100644
index 00000000..30dfa083
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/domain/sessionmgt/TimeoutVOTest.java
@@ -0,0 +1,82 @@
+/*
+ * ============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.domain.sessionmgt;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.DomainVo;
+
+public class TimeoutVOTest {
+
+ public TimeoutVO mockTimeoutVO(){
+ TimeoutVO timeoutVO = new TimeoutVO("test", (long) 1);
+ timeoutVO.setjSessionId("test");
+ timeoutVO.setSessionTimOutMilliSec((long)1);
+
+ return timeoutVO;
+ }
+
+ @Test
+ public void timeoutVOTest(){
+ TimeoutVO timeoutVO1 = mockTimeoutVO();
+
+ TimeoutVO timeoutVO = new TimeoutVO("test", (long) 1);
+ timeoutVO.setjSessionId("test");
+ timeoutVO.setSessionTimOutMilliSec((long)1);
+
+ assertEquals(timeoutVO.getjSessionId(), timeoutVO1.getjSessionId());
+ assertEquals(timeoutVO.getSessionTimOutMilliSec(), timeoutVO1.getSessionTimOutMilliSec());
+
+ }
+
+ @Test
+ public void equalsTest(){
+ TimeoutVO timeoutVO1 = mockTimeoutVO();
+ TimeoutVO timeoutVO2 = mockTimeoutVO();
+ assertEquals(true, timeoutVO1.equals(timeoutVO2));
+ }
+
+ @Test
+ public void compareTest(){
+ TimeoutVO timeoutVO1 = mockTimeoutVO();
+ TimeoutVO timeoutVO2 = mockTimeoutVO();
+ assertEquals(0, timeoutVO1.compareTo(timeoutVO2));
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AppServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AppServiceImplTest.java
new file mode 100644
index 00000000..c16e9493
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AppServiceImplTest.java
@@ -0,0 +1,97 @@
+/*
+ * ============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.service;
+
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.portalsdk.core.domain.App;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AppServiceImplTest {
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @InjectMocks
+ private AppServiceImpl appServiceImpl;
+
+ @Test
+ public void getAppsTest() {
+ App app = new App();
+ List<App> appList = new ArrayList<>();
+ appList.add(app);
+ when(dataAccessService.getList(App.class, null)).thenReturn(appList);
+ List<App> list = appServiceImpl.getApps();
+ Assert.assertTrue(list.size() > 0);
+ }
+
+ @Test
+ public void getAppTest() {
+ Long appId = 1l;
+ when(dataAccessService.getDomainObject(App.class, appId, null)).thenReturn(new App());
+ App app = appServiceImpl.getApp(appId);
+ Assert.assertNotNull(app);
+ }
+
+ @Test
+ public void getDefaultAppTest() {
+ Long appId = 1l;
+ when(dataAccessService.getDomainObject(App.class, appId, null)).thenReturn(new App());
+ App app = appServiceImpl.getDefaultApp();
+ Assert.assertNotNull(app);
+ }
+
+ @Test
+ public void getDefaultAppNameTest() {
+ Long appId = 1l;
+ App app = new App();
+ app.setName("Default App");
+ when(dataAccessService.getDomainObject(App.class, appId, null)).thenReturn(app);
+ String defaultAppname = appServiceImpl.getDefaultAppName();
+ Assert.assertEquals(app.getName(), defaultAppname);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AuditServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AuditServiceImplTest.java
new file mode 100644
index 00000000..ade19911
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/AuditServiceImplTest.java
@@ -0,0 +1,60 @@
+/*
+ * ============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.service;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AuditServiceImplTest {
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @InjectMocks
+ private AuditServiceImpl auditServiceImpl;
+
+ @Test
+ public void logActivityTest(){
+ auditServiceImpl.logActivity(null, null);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/BroadcastServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/BroadcastServiceImplTest.java
new file mode 100644
index 00000000..83ae5a42
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/BroadcastServiceImplTest.java
@@ -0,0 +1,182 @@
+/*
+ * ============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.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.portalsdk.core.domain.BroadcastMessage;
+import org.onap.portalsdk.core.domain.Lookup;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.web.support.AppUtils;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.test.util.ReflectionTestUtils;
+
+@RunWith(MockitoJUnitRunner.class)
+public class BroadcastServiceImplTest {
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @InjectMocks
+ private BroadcastServiceImpl broadcastServiceImpl;
+
+ @Test
+ public void getBcModelTest(){
+ Lookup lookup = new Lookup();
+ lookup.setValue("123");
+ List<Lookup> lookupList = new ArrayList<>();
+ lookupList.add(lookup);
+
+ BroadcastMessage broadcastMessage = new BroadcastMessage();
+ broadcastMessage.setActive(false);
+ ReflectionTestUtils.invokeSetterMethod(new AppUtils(), "dataAccessService", dataAccessService);
+
+ List<BroadcastMessage> messagesList = new ArrayList<>();
+ BroadcastMessage message1 = new BroadcastMessage();
+ message1.setLocationId(123);
+ message1.setSortOrder(1);
+ message1.setId(1L);
+ BroadcastMessage message2 = new BroadcastMessage();
+ message2.setLocationId(456);
+ message2.setSortOrder(2);
+ message2.setId(2L);
+ messagesList.add(message1);
+ messagesList.add(message2);
+ Mockito.when(dataAccessService.getList(BroadcastMessage.class,null)).thenReturn(messagesList);
+ Mockito.when(dataAccessService.getDomainObject(BroadcastMessage.class, 5L, null)).thenReturn(broadcastMessage);
+
+ Mockito.when(dataAccessService.getLookupList("fn_lu_message_location", "message_location_id",
+ "message_location_descr", "", "message_location_id",null)).thenReturn(lookupList);
+ System.setProperty(SystemProperties.CLUSTERED,"true");
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+ request.addParameter("task", "toggleActive");
+ Map bcModel = broadcastServiceImpl.getBcModel(request);
+ Assert.assertTrue(bcModel.size() > 0);
+ }
+
+ @Test
+ public void displayMessagesTest(){
+ Lookup lookup = new Lookup();
+ lookup.setValue("123");
+ List<Lookup> lookupList = new ArrayList<>();
+ lookupList.add(lookup);
+
+ List<BroadcastMessage> messagesList = new ArrayList<>();
+ BroadcastMessage message1 = new BroadcastMessage();
+ message1.setLocationId(123);
+ message1.setSortOrder(1);
+ message1.setId(1L);
+ message1.setMessageText("Hello1");
+ BroadcastMessage message2 = new BroadcastMessage();
+ message2.setLocationId(456);
+ message2.setSortOrder(2);
+ message2.setId(2L);
+ message2.setMessageText("Hello2");
+ messagesList.add(message1);
+ messagesList.add(message2);
+
+ ReflectionTestUtils.invokeSetterMethod(new AppUtils(), "dataAccessService", dataAccessService);
+
+ Mockito.when(dataAccessService.executeNamedQuery(Matchers.anyString(), Matchers.anyMap(), Matchers.anyMap())).thenReturn(messagesList);
+ Mockito.when(dataAccessService.getLookupList("fn_lu_message_location", "message_location_id",
+ "message_location_descr", "", "message_location_id",null)).thenReturn(lookupList);
+ broadcastServiceImpl.loadMessages();
+ String message = broadcastServiceImpl.displayMessages("123");
+ Assert.assertTrue(message.contains(message1.getMessageText()));
+ }
+
+ @Test
+ public void hasServerMessagesTest(){
+
+ Lookup lookup = new Lookup();
+ lookup.setValue("123");
+ List<Lookup> lookupList = new ArrayList<>();
+ lookupList.add(lookup);
+
+ List<BroadcastMessage> messagesList = new ArrayList<>();
+ BroadcastMessage message1 = new BroadcastMessage();
+ message1.setLocationId(123);
+ message1.setSortOrder(1);
+ message1.setId(1L);
+ message1.setMessageText("Hello1");
+ BroadcastMessage message2 = new BroadcastMessage();
+ message2.setLocationId(456);
+ message2.setSortOrder(2);
+ message2.setId(2L);
+ message2.setMessageText("Hello2");
+ messagesList.add(message1);
+ messagesList.add(message2);
+
+ ReflectionTestUtils.invokeSetterMethod(new AppUtils(), "dataAccessService", dataAccessService);
+
+ Mockito.when(dataAccessService.executeNamedQuery(Matchers.anyString(), Matchers.anyMap(), Matchers.anyMap())).thenReturn(messagesList);
+ Mockito.when(dataAccessService.getLookupList("fn_lu_message_location", "message_location_id",
+ "message_location_descr", "", "message_location_id",null)).thenReturn(lookupList);
+ broadcastServiceImpl.loadMessages();
+ boolean messageExist = broadcastServiceImpl.hasServerMessages("123","123");
+ Assert.assertTrue(messageExist);
+ }
+
+ @Test
+ public void getBroadcastMessageTest(){
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+ request.addParameter("message_location_id", "123");
+ Mockito.when(dataAccessService.getDomainObject(BroadcastMessage.class, 5L, null)).thenReturn(new BroadcastMessage());
+ broadcastServiceImpl.getBroadcastMessage(request);
+ }
+
+ @Test
+ public void getBroadcastMessageWithoutLocIdTest(){
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+ Mockito.when(dataAccessService.getDomainObject(BroadcastMessage.class, 5L, null)).thenReturn(new BroadcastMessage());
+ broadcastServiceImpl.getBroadcastMessage(request);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/DataAccessServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/DataAccessServiceImplTest.java
new file mode 100644
index 00000000..7f179f66
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/DataAccessServiceImplTest.java
@@ -0,0 +1,350 @@
+/*
+ * ============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.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hibernate.Criteria;
+import org.hibernate.Query;
+import org.hibernate.SQLQuery;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.FusionObject.Parameters;
+import org.onap.portalsdk.core.domain.support.DomainVo;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class })
+public class DataAccessServiceImplTest {
+
+ @Mock
+ private SessionFactory sessionFactory;
+
+ @InjectMocks
+ private DataAccessServiceImpl dataAccessServiceImpl;
+
+ @Test
+ public void getDomainObjectTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Long id = 1L;
+ DomainVo domainVo = new DomainVo();
+ domainVo.setId(id);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.get(DomainVo.class, id)).thenReturn(domainVo);
+ DomainVo returnDomainVo = dataAccessServiceImpl.getDomainObject(DomainVo.class, id, null);
+ Assert.assertEquals(id, returnDomainVo.getId());
+ }
+
+ @Test
+ public void deleteDomainObjectTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ dataAccessServiceImpl.deleteDomainObject(new DomainVo(), new HashMap<>());
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteDomainObjectsTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ String whereClause = "id = 1";
+ dataAccessServiceImpl.deleteDomainObjects(DomainVo.class, whereClause, new HashMap<>());
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void saveDomainObjectWithNewTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Map params = new HashMap();
+ params.put(Parameters.PARAM_USERID, 1);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID)).thenReturn("123");
+ DomainVo domainVo = new DomainVo();
+ domainVo.setId(0L);
+ dataAccessServiceImpl.saveDomainObject(domainVo, params);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void saveDomainObjectWithUpdateTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Map params = new HashMap();
+ params.put(Parameters.PARAM_USERID, 1L);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID)).thenReturn("123");
+ DomainVo domainVo = new DomainVo();
+ domainVo.setId(10L);
+ dataAccessServiceImpl.saveDomainObject(domainVo, params);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getListWithOnlyClassTest() {
+
+ DomainVo domainVo1 = new DomainVo();
+ domainVo1.setId(1L);
+ DomainVo domainVo2 = new DomainVo();
+ domainVo2.setId(1L);
+
+ List<DomainVo> domainVoList = new ArrayList<>();
+ domainVoList.add(domainVo1);
+ domainVoList.add(domainVo2);
+
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Mockito.when(mockQuery.list()).thenReturn(domainVoList);
+ List list = dataAccessServiceImpl.getList(DomainVo.class, new HashMap());
+ Assert.assertEquals(2, list.size());
+
+ }
+
+ @Test
+ public void getListWithOrderAndFilterTest() {
+
+ DomainVo domainVo1 = new DomainVo();
+ domainVo1.setId(1L);
+ DomainVo domainVo2 = new DomainVo();
+ domainVo2.setId(1L);
+
+ List<DomainVo> domainVoList = new ArrayList<>();
+ domainVoList.add(domainVo1);
+ domainVoList.add(domainVo2);
+
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Mockito.when(mockQuery.list()).thenReturn(domainVoList);
+ List list = dataAccessServiceImpl.getList(DomainVo.class, "", "", new HashMap());
+ Assert.assertEquals(2, list.size());
+
+ }
+
+ @Test
+ public void getListTest() {
+ String filterClause = " where id = '1' ";
+
+ DomainVo domainVo1 = new DomainVo();
+ domainVo1.setId(1L);
+ DomainVo domainVo2 = new DomainVo();
+ domainVo2.setId(1L);
+
+ List<DomainVo> domainVoList = new ArrayList<>();
+ domainVoList.add(domainVo1);
+ domainVoList.add(domainVo2);
+
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Mockito.when(mockQuery.list()).thenReturn(domainVoList);
+ List list = dataAccessServiceImpl.getList(DomainVo.class, filterClause, "id", new HashMap());
+ Assert.assertEquals(2, list.size());
+ }
+
+ @Test
+ public void getListGenericTest() {
+
+ List<Criterion> restrictionsList = new ArrayList<>();
+ List<Order> orderList = new ArrayList<>();
+ orderList.add(Order.asc("id"));
+ Criterion criterion1 = Restrictions.like("urlsAccessibleKey.url", "URL%");
+ restrictionsList.add(criterion1);
+ Session mockedSession = Mockito.mock(Session.class);
+ Criteria criteria = Mockito.mock(Criteria.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createCriteria(DomainVo.class)).thenReturn(criteria);
+ List list = dataAccessServiceImpl.getList(DomainVo.class, null, restrictionsList, orderList);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void getLookupListTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ SQLQuery mockSQLQuery = Mockito.mock(SQLQuery.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createSQLQuery(Mockito.anyString())).thenReturn(mockSQLQuery);
+ Mockito.when(mockSQLQuery.list()).thenReturn(new ArrayList());
+ List list = dataAccessServiceImpl.getLookupList("User ", "1", "id", "id", "", null);
+ Assert.assertNull(list);
+ }
+
+ @Test
+ public void executeSQLQueryWithoutRangeTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ SQLQuery mockSQLQuery = Mockito.mock(SQLQuery.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createSQLQuery(Mockito.anyString())).thenReturn(mockSQLQuery);
+ Mockito.when(mockSQLQuery.addEntity("org.onap.portalsdk.core.domain.support.domainvo", DomainVo.class))
+ .thenReturn(mockSQLQuery);
+ List list = dataAccessServiceImpl.executeSQLQuery("select * ", DomainVo.class, null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void executeSQLQueryTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ SQLQuery mockSQLQuery = Mockito.mock(SQLQuery.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createSQLQuery(Mockito.anyString())).thenReturn(mockSQLQuery);
+ Mockito.when(mockSQLQuery.addEntity("org.onap.portalsdk.core.domain.support.domainvo", DomainVo.class))
+ .thenReturn(mockSQLQuery);
+ List list = dataAccessServiceImpl.executeSQLQuery("select * ", DomainVo.class, 1, 3, null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void executeQueryWithoutRangeTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ List list = dataAccessServiceImpl.executeQuery("select * ", null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void executeQueryTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.createQuery(Mockito.anyString())).thenReturn(mockQuery);
+ List list = dataAccessServiceImpl.executeQuery("select * ", 1, 3, null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void executeNamedQueryWithoutRangeTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.getNamedQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Map params = new HashMap();
+ params.put("map", new HashMap());
+ params.put("list", new ArrayList());
+ String[] args = { "abc" };
+ params.put("obj", args);
+
+ List list = dataAccessServiceImpl.executeNamedQuery("select * ", params, null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void executeNamedQueryTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.getNamedQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Map params = new HashMap();
+ params.put("map", new HashMap());
+ params.put("list", new ArrayList());
+ String[] args = { "abc" };
+ params.put("obj", args);
+
+ List list = dataAccessServiceImpl.executeNamedQuery("select * ", params, 1, 3, null);
+ Assert.assertNotNull(list);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void executeNamedQueryWithOrderByTest() {
+ dataAccessServiceImpl.executeNamedQueryWithOrderBy(DomainVo.class, "", null, "", false, 0, 3, null);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void executeNamedCountQueryTest() {
+ dataAccessServiceImpl.executeNamedCountQuery(DomainVo.class, "select * ", " ", null);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void executeNamedQueryExceptionTest() {
+ dataAccessServiceImpl.executeNamedQuery(DomainVo.class, "select * ", "", null, 1, 3, null);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void executeNamedQueryWithOrderByExceptionTest() {
+ dataAccessServiceImpl.executeNamedQueryWithOrderBy(DomainVo.class, "", "", null, "", false, 0, 3, null);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void getListExceptionTest() {
+ dataAccessServiceImpl.getList(DomainVo.class, null, null, null, null);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void executeUpdateQueryTest() {
+ dataAccessServiceImpl.executeUpdateQuery("", null);
+ }
+
+ @Test
+ public void executeNamedUpdateQueryTest() {
+ Session mockedSession = Mockito.mock(Session.class);
+ Query mockQuery = Mockito.mock(Query.class);
+ Mockito.when(sessionFactory.getCurrentSession()).thenReturn(mockedSession);
+ Mockito.when(mockedSession.getNamedQuery(Mockito.anyString())).thenReturn(mockQuery);
+ Mockito.when(mockQuery.executeUpdate()).thenReturn(1);
+ int result = dataAccessServiceImpl.executeNamedUpdateQuery("", null, null);
+ Assert.assertEquals(1, result);
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void synchronizeTest() {
+ dataAccessServiceImpl.synchronize(null);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementLinkServiceTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementLinkServiceTest.java
new file mode 100644
index 00000000..87e668b8
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementLinkServiceTest.java
@@ -0,0 +1,204 @@
+/*
+ * ============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.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.io.FilenameUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.util.YamlUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class, FilenameUtils.class , YamlUtils.class})
+public class ElementLinkServiceTest {
+
+ @Test
+ public void buildElementLinkYamlTest() throws IOException{
+ String stepName = "firstStep";
+ String[] args = {"file", "custom", stepName};
+ String modleYaml = "myYaml.yaml";
+
+
+ Map<String, Object> callFlowBs = new HashMap<>();
+ List<Map<String, Object>> callSteps = new ArrayList<>();
+ Map<String, Object> callStep = new HashMap<>();
+
+ List<Map<String, Object>> subSteps = new ArrayList<>();
+ Map<String, Object> subStep = new HashMap<>();
+ subStep.put("source_tosca_id", "SOURCE");
+ subStep.put("destination_tosca_id", "DESTINATION");
+ subSteps.add(subStep);
+
+ callStep.put("name", stepName);
+ callStep.put("subSteps", subSteps);
+
+ callSteps.add(callStep);
+ callFlowBs.put("callSequenceSteps", callSteps);
+ callFlowBs.put("shortName", "test step");
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ PowerMockito.mockStatic(YamlUtils.class);
+ Mockito.when(SystemProperties.getProperty("customCallFlow_path")).thenReturn("xyzPath");
+ Mockito.when(YamlUtils.readYamlFile(Mockito.anyString(), Mockito.anyString())).thenReturn(callFlowBs);
+ Mockito.when(YamlUtils.returnYaml(Mockito.anyObject())).thenReturn(modleYaml);
+
+ ElementLinkService elementLinkService = new ElementLinkService();
+ String linkYaml = elementLinkService.buildElementLinkYaml(args);
+ Assert.assertEquals(modleYaml, linkYaml);
+ }
+
+ @Test
+ public void addActiveNodesTest(){
+ String step ="STEP1";
+ Map<String, Object> callStep = new HashMap<>();
+ List<String> activeIds = new ArrayList<>();
+ activeIds.add(step);
+ callStep.put("activeIds", activeIds);
+ ElementLinkService elementLinkService = new ElementLinkService();
+ List<String> steps = elementLinkService.addActiveNodes(callStep);
+ Assert.assertTrue(steps.contains(step));
+ }
+
+ @Test
+ public void addDisconnectLinksTest(){
+ Map<String, Object> callStep = new HashMap<>();
+ List<Map<String, Object>> disconnectLinks = new ArrayList<>();
+ Map<String, Object> disconLink = new HashMap<>();
+ disconLink.put("DummyStep", "DummyYaml");
+ disconnectLinks.add(disconLink);
+ callStep.put("disconnectLinks", disconnectLinks);
+
+ ElementLinkService elementLinkService = new ElementLinkService();
+ List<Map<String, Object>> returnDisconnectLinks = elementLinkService.addDisconnectLinks(callStep);
+ Assert.assertTrue(returnDisconnectLinks.size() > 0);
+ }
+
+ @Test
+ public void addLinkVerticesTest(){
+ Map<String, Object> callStep = new HashMap<>();
+ List<Map<String, Object>> vertices = new ArrayList<>();
+ Map<String, Object> vertices1 = new HashMap<>();
+ vertices1.put("x", 10);
+ vertices1.put("y", 20);
+ vertices1.put("D", "D");
+ vertices1.put("L", "L");
+
+ Map<String, Object> vertices2 = new HashMap<>();
+ vertices2.put("x", 30);
+ vertices2.put("y", 40);
+ vertices2.put("D", "D");
+ vertices2.put("L", "L");
+
+ vertices.add(vertices1);
+ vertices.add(vertices2);
+ callStep.put("vertices", vertices);
+ ElementLinkService elementLinkService = new ElementLinkService();
+ List<Map<String, Object>> returnVertices = elementLinkService.addLinkVertices(callStep);
+ Assert.assertTrue(returnVertices.size() > 0);
+ }
+
+ @Test
+ public void mainTest() throws Exception{
+ String[] args = {"file", "custom",};
+ String stepName = "Step_2";
+ Map<String, Object> callFlowBs = new HashMap<>();
+ List<Map<String, Object>> callSteps = new ArrayList<>();
+ Map<String, Object> callStep = new HashMap<>();
+
+ List<Map<String, Object>> subSteps = new ArrayList<>();
+ Map<String, Object> subStep = new HashMap<>();
+ subStep.put("source_tosca_id", "SOURCE");
+ subStep.put("destination_tosca_id", "DESTINATION");
+ subSteps.add(subStep);
+
+ callStep.put("name", stepName);
+ callStep.put("subSteps", subSteps);
+
+ callSteps.add(callStep);
+ callFlowBs.put("callSequenceSteps", callSteps);
+ callFlowBs.put("shortName", "teststep");
+
+ PowerMockito.mockStatic(YamlUtils.class);
+ Mockito.when(YamlUtils.readYamlFile(Mockito.anyString(), Mockito.anyString())).thenReturn(callFlowBs);
+ Mockito.when(YamlUtils.returnYaml(Mockito.anyObject())).thenReturn("modleYaml");
+ ElementLinkService.main(args);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void mainExceptionLogTest() throws Exception{
+ String[] args = {"file", "custom",};
+ String stepName = "Step_2";
+ Map<String, Object> callFlowBs = new HashMap<>();
+ List<Map<String, Object>> callSteps = new ArrayList<>();
+ Map<String, Object> callStep = new HashMap<>();
+
+ List<Map<String, Object>> subSteps = new ArrayList<>();
+ Map<String, Object> subStep = new HashMap<>();
+ subStep.put("source_tosca_id", "SOURCE");
+ subStep.put("destination_tosca_id", "DESTINATION");
+ subSteps.add(subStep);
+
+ callStep.put("name", stepName);
+ callStep.put("subSteps", subSteps);
+
+ callSteps.add(callStep);
+ callFlowBs.put("callSequenceSteps", callSteps);
+ callFlowBs.put("shortName", "teststep");
+ callStep.put("activeIds", "activeIds");
+ callStep.put("disconnectLinks", "disconnectLinks");
+
+ PowerMockito.mockStatic(YamlUtils.class);
+ Mockito.when(YamlUtils.readYamlFile(Mockito.anyString(), Mockito.anyString())).thenReturn(callFlowBs);
+ Mockito.when(YamlUtils.returnYaml(Mockito.anyObject())).thenReturn("modleYaml");
+ ElementLinkService.main(args);
+ Assert.assertTrue(true);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementMapServiceTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementMapServiceTest.java
new file mode 100644
index 00000000..18771c63
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ElementMapServiceTest.java
@@ -0,0 +1,481 @@
+/*
+ * ============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.service;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.io.FilenameUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.support.Container;
+import org.onap.portalsdk.core.domain.support.Domain;
+import org.onap.portalsdk.core.domain.support.Element;
+import org.onap.portalsdk.core.domain.support.ElementDetails;
+import org.onap.portalsdk.core.domain.support.Layout;
+import org.onap.portalsdk.core.domain.support.Position;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.util.YamlUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class, FilenameUtils.class , YamlUtils.class})
+public class ElementMapServiceTest {
+
+ @Test
+ public void buildElementMapYamlTest() throws IOException{
+ String rootDir = "rootDir";
+ String networkToscaYml ="networksca";
+ String networkLayoutYml ="networkLayoutYml";
+ String[] args = {"", "", rootDir, networkToscaYml, networkLayoutYml, "layout"};
+
+ Map<String, Object> toscaYaml = new HashMap<>();
+ Map<String, Object> networkMapLayoutYaml = new HashMap<>();
+
+ List<Object> toscaNetEleList = new ArrayList<>();
+ networkMapLayoutYaml.put("toscaNetworkMapElementStyleList", toscaNetEleList);
+ Map<String, String> elementDetails = new HashMap<>();
+ elementDetails.put("tosca_id", "TO_SCA_ID");
+ elementDetails.put("id", "ID");
+ elementDetails.put("row", "ROW");
+ elementDetails.put("column", "COLUMN");
+ elementDetails.put("icon", "ICON");
+
+ toscaNetEleList.add(elementDetails);
+
+ List<Object> containerStyleList = new ArrayList<>();
+
+ Map<String, String> containerDetails = new HashMap<>();
+ containerDetails.put("logical_group_name", "/TO_SCA_ID");
+ containerDetails.put("id", "ID");
+ containerDetails.put("domain", "DOMAIN");
+ containerDetails.put("row", "ROW");
+ containerDetails.put("column", "COLUMN");
+ containerStyleList.add(containerDetails);
+ networkMapLayoutYaml.put("containerStyleList", containerStyleList);
+
+ List<Object> domainList = new ArrayList<>();
+
+ Map<String, String> domainDetails = new HashMap<>();
+ domainDetails.put("name", "/TO_SCA_ID");
+ domainDetails.put("id", "ID");
+ domainDetails.put("row", "ROW");
+ domainDetails.put("column", "COLUMN");
+ domainList.add(domainDetails);
+ networkMapLayoutYaml.put("domainList", domainList);
+
+
+ PowerMockito.mockStatic(YamlUtils.class);
+
+ Map<String, Object> topologyMap = new HashMap<>();
+ toscaYaml.put("topology_template", topologyMap);
+
+ Map<String, Object> nodeTemplateMap = new HashMap<>();
+ topologyMap.put("node_templates", nodeTemplateMap);
+
+ Mockito.when(YamlUtils.readYamlFile(rootDir, networkToscaYml+".yml")).thenReturn(toscaYaml);
+ Mockito.when(YamlUtils.readYamlFile(rootDir, networkLayoutYml+".yml")).thenReturn(networkMapLayoutYaml);
+
+ ElementMapService elementMapService = new ElementMapService();
+ elementMapService.buildElementMapYaml(args);
+ }
+
+
+ @Test
+ public void convertToYAMLTest() throws Exception {
+ ElementMapService elementMapService = new ElementMapService();
+
+ String contextRealPath = "element_map_icon_path";
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ domain.setP(position);
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+
+ Map<String, Element> elementRowcol = new HashMap<>();
+ Element element = new Element("12", "ue6");
+ element.setP(position);
+ element.setBorderType("V");
+ Element element2 = new Element("22", "ue6");
+ element2.setP(position);
+ element2.setBorderType("U");
+ elementRowcol.put("12", element);
+ elementRowcol.put("22", element2);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setElements(elementRowcol);
+
+ container00.setP(position);
+
+ Map<String, Container> innerContainer = new HashMap<>();
+ Container container01 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Map<String, Element> elementRowcolInner = new HashMap<>();
+ Element elementInner = new Element("12", "dashed");
+ elementInner.setP(position);
+ elementInner.setBorderType("V");
+
+ Element elementInner2 = new Element("22", "test");
+ elementInner2.setP(position);
+ elementInner2.setBorderType("U");
+
+ elementRowcolInner.put("12", elementInner);
+ elementRowcolInner.put("22", elementInner2);
+
+ container01.setP(position);
+ container01.setElements(elementRowcolInner);
+ innerContainer.put("01", container01);
+
+ container00.setInnerContainer(innerContainer);
+ containerRowCol.put("00", container00);
+
+ domain.setContainers(containerRowCol);
+
+ List<Domain> domainList = new ArrayList<>();
+ domainList.add(domain);
+ layout.setCollapsedDomainsNewList(domainList);
+
+ Method method = elementMapService.getClass().getDeclaredMethod("convertToYAML", String.class, Layout.class );
+ method.setAccessible(true);
+ String output = (String) method.invoke(elementMapService, contextRealPath,layout);
+ Assert.assertNotNull(output);
+ }
+
+ @Test
+ public void computeRowsTest() throws Exception {
+ Set<String> rows = new HashSet<>();
+ rows.add("2");
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("computeRows", Set.class);
+ method.setAccessible(true);
+ int returnValue = (int) method.invoke(elementMapService, rows);
+ Assert.assertEquals(3, returnValue);
+ returnValue = (int) method.invoke(elementMapService, new HashSet<String>());
+ Assert.assertEquals(1, returnValue);
+ }
+
+ @Test
+ public void computeColumnsTest() throws Exception {
+ Set<String> columns = new HashSet<>();
+ columns.add("02");
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("computeColumns", Set.class);
+ method.setAccessible(true);
+ int returnValue = (int) method.invoke(elementMapService, columns);
+ Assert.assertEquals(3, returnValue);
+ returnValue = (int) method.invoke(elementMapService, new HashSet<String>());
+ Assert.assertEquals(1, returnValue);
+ }
+
+ @Test
+ public void fetchContainerObjectTest() throws Exception {
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchContainerObject", String.class, String.class, boolean.class, String.class, String.class) ;
+ method.setAccessible(true);
+
+
+ HashMap<String, Element> elementMap = new HashMap<>();
+ String elementId = "234";
+ Element element = new Element(elementId, "test");
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ element.setP(position);
+ element.setBorderType("U");
+ elementMap.put("241", element);
+
+ String logicalName = "Test Logical Name";
+ String domain = "Test Domain";
+ String name = "Test Container";
+
+ ElementDetails elementDetails = new ElementDetails(logicalName,"test","test","test","test","test","test","test","test","test");
+ element.setDetails(elementDetails);
+
+ Field field = elementMapService.getClass().getDeclaredField("elementMap");
+ field.setAccessible(true);
+ field.set(elementMapService, elementMap);
+
+ HashMap<String, Object> toscaElementsMap = new HashMap<>();
+ HashMap<String, Object> innertoscaElementsMap = new HashMap<>();
+
+
+ HashMap<String, String> properties = new HashMap<>();
+ properties.put("domain", domain);
+ innertoscaElementsMap.put("properties", properties);
+ toscaElementsMap.put(elementId, innertoscaElementsMap);
+
+ Field toscalEleMap = elementMapService.getClass().getDeclaredField("toscaElementsMap");
+ toscalEleMap.setAccessible(true);
+ toscalEleMap.set(elementMapService, toscaElementsMap);
+
+ Container container = (Container) method.invoke(elementMapService, elementId, name , true, logicalName, domain);
+ Assert.assertEquals(name, container.getName());
+ }
+
+ @Test
+ public void fetchContainerObjectWithFalseTest() throws Exception{
+
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchContainerObject", String.class, String.class, boolean.class, String.class, String.class) ;
+ method.setAccessible(true);
+
+ HashMap<String, Element> elementMap = new HashMap<>();
+ String elementId = "278";
+ Element element = new Element(elementId, "test");
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ element.setP(position);
+ element.setBorderType("U");
+ elementMap.put("285", element);
+
+ String logicalName = "Test Logical Name";
+ String domain = "Test Domain";
+ String name = "Test Container";
+
+ ElementDetails elementDetails = new ElementDetails(logicalName,"test","test","test","test","test","test","test","test","test");
+ element.setDetails(elementDetails);
+
+ Field field = elementMapService.getClass().getDeclaredField("elementMap");
+ field.setAccessible(true);
+ field.set(elementMapService, elementMap);
+
+ HashMap<String, Object> toscaElementsMap = new HashMap<>();
+ HashMap<String, Object> innertoscaElementsMap = new HashMap<>();
+
+
+ HashMap<String, String> properties = new HashMap<>();
+ properties.put("domain", domain);
+ innertoscaElementsMap.put("properties", properties);
+ toscaElementsMap.put(elementId, innertoscaElementsMap);
+
+ Field toscalEleMap = elementMapService.getClass().getDeclaredField("toscaElementsMap");
+ toscalEleMap.setAccessible(true);
+ toscalEleMap.set(elementMapService, toscaElementsMap);
+
+ HashMap<String, Container> innercontainerMap = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ innercontainerMap.put(domain + ":" + name, container00);
+ Field innercontainers = elementMapService.getClass().getDeclaredField("innercontainers");
+ innercontainers.setAccessible(true);
+ innercontainers.set(elementMapService, innercontainerMap);
+
+ Container container = (Container) method.invoke(elementMapService, elementId, name , false, logicalName, domain);
+ Assert.assertEquals(name, container.getName());
+
+ }
+
+ @Test
+ public void fetchContainerObjectWithFalse2Test() throws Exception{
+
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchContainerObject", String.class, String.class, boolean.class, String.class, String.class) ;
+ method.setAccessible(true);
+
+ HashMap<String, Element> elementMap = new HashMap<>();
+ String elementId = "278";
+
+ String logicalName = "Test Logical Name";
+ String domain = "Test Domain";
+ String name = "Test Container";
+
+ Field field = elementMapService.getClass().getDeclaredField("elementMap");
+ field.setAccessible(true);
+ field.set(elementMapService, elementMap);
+
+ HashMap<String, Object> toscaElementsMap = new HashMap<>();
+ HashMap<String, Object> innertoscaElementsMap = new HashMap<>();
+
+ HashMap<String, String> properties = new HashMap<>();
+ properties.put("domain", domain);
+ innertoscaElementsMap.put("properties", properties);
+ toscaElementsMap.put(elementId, innertoscaElementsMap);
+
+ Field toscalEleMap = elementMapService.getClass().getDeclaredField("toscaElementsMap");
+ toscalEleMap.setAccessible(true);
+ toscalEleMap.set(elementMapService, toscaElementsMap);
+
+ HashMap<String, Container> innercontainerMap = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ innercontainerMap.put(domain + ":" + name, container00);
+ Field innercontainers = elementMapService.getClass().getDeclaredField("innercontainers");
+ innercontainers.setAccessible(true);
+ innercontainers.set(elementMapService, innercontainerMap);
+
+ Container container = (Container) method.invoke(elementMapService, elementId, name , false, logicalName, domain);
+ Assert.assertEquals(name, container.getName());
+
+ }
+
+ @Test
+ public void fetchDomainObjectTest() throws Exception {
+ String id = "Domain Id";
+ String name = "D-Name";
+
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchDomainObject", String.class, String.class) ;
+ method.setAccessible(true);
+
+ Map<String, Element> elementRowCol = new HashMap<>();
+ Element element = new Element("374", "test");
+ Element element2 = new Element("375", "test");
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ element.setP(position);
+ element.setBorderType("U");
+ elementRowCol.put("285", element);
+ elementRowCol.put("382", element2);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container023 = new Container("test","test",1,1,10,10,10,10,10,10);
+ containerRowCol.put("00", container023);
+
+
+ HashMap<String, Container> outercontainerMap = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setInnerContainer(containerRowCol);
+ container00.setElements(elementRowCol);
+ Container container01 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container01.setElements(elementRowCol);
+ outercontainerMap.put(name+":", container00);
+ outercontainerMap.put(name+":/Test", container01);
+
+ Field outercontainers = elementMapService.getClass().getDeclaredField("outercontainers");
+ outercontainers.setAccessible(true);
+ outercontainers.set(elementMapService, outercontainerMap);
+ Domain domain = (Domain)method.invoke(elementMapService, id, name);
+ Assert.assertEquals(domain.getName(), name);
+
+ }
+
+ @Test
+ public void fetchElementObjectTest() throws Exception {
+
+ String domain = "Test Domain";
+
+ String id = "420";
+ String name = "ELEMENT";
+ String imagePath = "src/images/";
+
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchElementObject", String.class, String.class, String.class);
+ method.setAccessible(true);
+
+ HashMap<String, Object> toscaElementsMap = new HashMap<>();
+ HashMap<String, Object> innertoscaElementsMap = new HashMap<>();
+
+
+ HashMap<String, String> properties = new HashMap<>();
+ String network_function = "NETWORK_FUNCTION";
+ properties.put("domain", domain);
+
+ properties.put("logical_group", "logical/group");
+ properties.put("display_longname", "display_longname");
+ properties.put("display_shortname", "display_shortname");
+ properties.put("description", "description");
+ properties.put("primary_function", "primary_function");
+ properties.put("key_interfaces", "key_interfaces");
+ properties.put("location", "location");
+ properties.put("vendor", "vendor");
+ properties.put("vendor_shortname", "vendor_shortname");
+ properties.put("network_function", network_function);
+ properties.put("background_color", "background_color");
+
+
+ innertoscaElementsMap.put("properties", properties);
+ toscaElementsMap.put(name, innertoscaElementsMap);
+
+ Field toscalEleMap = elementMapService.getClass().getDeclaredField("toscaElementsMap");
+ toscalEleMap.setAccessible(true);
+ toscalEleMap.set(elementMapService, toscaElementsMap);
+ Element element= (Element)method.invoke(elementMapService, id, name, imagePath);
+ Assert.assertEquals(element.getImgFileName(), imagePath);
+ }
+
+ @Test
+ public void fetchElementObjectWithEmptyTest() throws Exception {
+
+ String domain = "Test Domain";
+
+ String id = "420";
+ String name = "ELEMENT";
+ String imagePath = "src/images/";
+
+ ElementMapService elementMapService = new ElementMapService();
+ Method method = elementMapService.getClass().getDeclaredMethod("fetchElementObject", String.class, String.class, String.class);
+ method.setAccessible(true);
+
+ HashMap<String, Object> toscaElementsMap = new HashMap<>();
+ HashMap<String, Object> innertoscaElementsMap = new HashMap<>();
+
+
+ HashMap<String, String> properties = new HashMap<>();
+ properties.put("domain", domain);
+
+ properties.put("logical_group", "logical/group");
+
+ innertoscaElementsMap.put("properties", properties);
+ toscaElementsMap.put(name, innertoscaElementsMap);
+
+ Field toscalEleMap = elementMapService.getClass().getDeclaredField("toscaElementsMap");
+ toscalEleMap.setAccessible(true);
+ toscalEleMap.set(elementMapService, toscaElementsMap);
+ Element element= (Element)method.invoke(elementMapService, id, name, imagePath);
+ Assert.assertEquals(element.getImgFileName(), imagePath);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FnMenuServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FnMenuServiceImplTest.java
new file mode 100644
index 00000000..2cf13d3a
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FnMenuServiceImplTest.java
@@ -0,0 +1,181 @@
+/*
+ * ============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.service;
+
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.portalsdk.core.domain.Menu;
+import org.onap.portalsdk.core.domain.MenuData;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class FnMenuServiceImplTest {
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @InjectMocks
+ private FnMenuServiceImpl fnMenuServiceImpl;
+
+ @Test
+ public void getFnMenuItemsTest() {
+ Long menuId = 1L;
+ List<MenuData> menuDataList = new ArrayList<>();
+ MenuData menuData = new MenuData();
+ menuData.setId(menuId);
+ menuDataList.add(menuData);
+ when(dataAccessService.getList(MenuData.class, null, "1", null)).thenReturn(menuDataList);
+ List<MenuData> returnList = fnMenuServiceImpl.getFnMenuItems();
+ Assert.assertTrue(returnList.size() > 0);
+ }
+
+ @Test
+ public void saveFnMenuDataTest() {
+ Long menuId = 1L;
+ MenuData menuData = new MenuData();
+ menuData.setId(menuId);
+ fnMenuServiceImpl.saveFnMenuData(menuData);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getParentIdTest() {
+ String label = "XYZ";
+
+ List<Long> longValues = new ArrayList<>();
+ longValues.add(1L);
+ longValues.add(2L);
+
+ Map<String, String> params = new HashMap<>();
+ params.put("paramLabel", label);
+ when(dataAccessService.executeNamedQuery("IdForLabelList", params, null)).thenReturn(longValues);
+ List<Long> returnList = fnMenuServiceImpl.getParentId(label);
+ Assert.assertTrue(returnList.size() > 0);
+
+ }
+
+ @Test
+ public void getParentListTest() {
+ List<List> parentList = new ArrayList<>();
+ List<Long> longValues = new ArrayList<>();
+ longValues.add(1L);
+ longValues.add(2L);
+ parentList.add(longValues);
+ when(dataAccessService.executeNamedQuery("parentList", null, null)).thenReturn(parentList);
+ List<List> returnParentList = fnMenuServiceImpl.getParentList();
+ Assert.assertTrue(returnParentList.size() > 0);
+ }
+
+ @Test
+ public void removeMenuItemDataTest() {
+ MenuData domainFnMenu = new MenuData();
+ domainFnMenu.setId(1L);
+ fnMenuServiceImpl.removeMenuItem(domainFnMenu);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void removeMenuItemTest() {
+ Menu menu = new Menu();
+ menu.setId(1L);
+ fnMenuServiceImpl.removeMenuItem(menu);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getMenuItemRowTest() {
+ Long id = 1L;
+ MenuData domainFnMenu = new MenuData();
+ domainFnMenu.setId(id);
+ when(dataAccessService.getDomainObject(MenuData.class, id, null)).thenReturn(domainFnMenu);
+ MenuData menuData = fnMenuServiceImpl.getMenuItemRow(id);
+ Assert.assertEquals(id, menuData.getId());
+ }
+
+ @Test
+ public void getMenuItemTest() {
+ Long id = 1L;
+ Menu menu = new Menu();
+ menu.setId(id);
+ when(dataAccessService.getDomainObject(Menu.class, id, null)).thenReturn(menu);
+ Menu returnMenu = fnMenuServiceImpl.getMenuItem(id);
+ Assert.assertEquals(id, returnMenu.getId());
+ }
+
+ @Test
+ public void saveFnMenuTest() {
+ Long id = 1L;
+ Menu menu = new Menu();
+ menu.setId(id);
+ fnMenuServiceImpl.saveFnMenu(menu);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void setMenuDataStructureTest() {
+ Set<MenuData> menuResult = new HashSet<>();
+
+ MenuData parentMenu = new MenuData();
+ parentMenu.setId(1L);
+
+ MenuData childMenu = new MenuData();
+ childMenu.setId(1L);
+
+ Set<MenuData> childSet = new HashSet<>();
+ childSet.add(childMenu);
+ parentMenu.setChildMenus(childSet);
+ menuResult.add(parentMenu);
+
+ List<List<MenuData>> childItemList = new ArrayList<>();
+ List<MenuData> parentList = new ArrayList<>();
+ fnMenuServiceImpl.setMenuDataStructure(childItemList, parentList, menuResult);
+ Assert.assertTrue(childItemList.size() > 0);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java
new file mode 100644
index 00000000..b589c50b
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java
@@ -0,0 +1,77 @@
+/*
+ * ============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.service;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ UserUtils.class })
+public class FunctionalMenuListServiceCentralizedImplTest {
+
+ @Mock
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @InjectMocks
+ private FunctionalMenuListServiceCentralizedImpl fmServiceCentralizedImpl;
+
+ @Test(expected = IOException.class)
+ public void getFunctionCDListTest() throws IOException {
+
+ HttpServletRequest mockedRequest = Mockito.mock(HttpServletRequest.class);
+ User user = new User();
+ user.setOrgId(123L);
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user);
+ Mockito.when(restApiRequestBuilder.getViaREST("/menuFunctions", true, user.getOrgUserId())).thenReturn("");
+
+ fmServiceCentralizedImpl.getFunctionCDList(mockedRequest);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceImplTest.java
new file mode 100644
index 00000000..2cbedf97
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceImplTest.java
@@ -0,0 +1,79 @@
+/*
+ * ============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.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.RoleFunction;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class FunctionalMenuListServiceImplTest {
+
+ @InjectMocks
+ private FunctionalMenuListServiceImpl fmListServiceImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void getFunctionCDListTest() throws IOException {
+
+ HttpServletRequest mockedRequest = Mockito.mock(HttpServletRequest.class);
+ List<RoleFunction> roleFunctionList = new ArrayList<>();
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setId(1L);
+ roleFunction.setName("Test");
+ roleFunctionList.add(roleFunction);
+ Mockito.when(dataAccessService.executeNamedQuery("functionCDlist", null, null)).thenReturn(roleFunctionList);
+ List<RoleFunction> returnData = fmListServiceImpl.getFunctionCDList(mockedRequest);
+ Assert.assertTrue(returnData.size() > 0);
+
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LdapServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LdapServiceImplTest.java
new file mode 100644
index 00000000..87e507cd
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LdapServiceImplTest.java
@@ -0,0 +1,156 @@
+/*
+ * ============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.service;
+
+import java.lang.reflect.Method;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.InitialDirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.service.support.ServiceLocator;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class })
+public class LdapServiceImplTest {
+
+ @InjectMocks
+ private LdapServiceImpl ldapServiceImpl;
+
+ @Mock
+ private ServiceLocator serviceLocator;
+
+ @Test
+ public void searchPostTest() throws Exception {
+ User user = new User();
+ user.setFirstName("First Name");
+ user.setLastName("Last Name");
+ user.setHrid("HRID1");
+ user.setOrgManagerUserId("M123");
+ user.setOrgCode("ORG");
+ user.setEmail("xyz@xyz.com");
+ user.setOrgUserId("U123");
+
+ String sortBy1 = "sortBy1";
+ String sortBy2 = "sortBy2";
+ String sortBy3 = "sortBy3";
+ int pageNo = 10;
+ int dataSize = 20;
+ int userId = 123;
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_INITIAL_CONTEXT_FACTORY)).thenReturn("FACTORY");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL)).thenReturn("URL");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL)).thenReturn("PRINCIPAL");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_MAX_RESULT_SIZE)).thenReturn("1");
+
+ InitialDirContext dirContext = Mockito.mock(InitialDirContext.class);
+ SearchResult mockSearchResult = Mockito.mock(SearchResult.class);
+
+ Mockito.when(serviceLocator.getDirContext(Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(dirContext);
+
+ NamingEnumeration mockSearchResults = Mockito.mock(NamingEnumeration.class);
+ Mockito.when(dirContext.search(Mockito.anyString(), Mockito.anyString(), Mockito.any(SearchControls.class)))
+ .thenReturn(mockSearchResults);
+ Mockito.when(mockSearchResults.hasMore()).thenReturn(true);
+ Mockito.when(mockSearchResults.next()).thenReturn(mockSearchResult);
+ org.onap.portalsdk.core.command.support.SearchResult searchResult = (org.onap.portalsdk.core.command.support.SearchResult) ldapServiceImpl
+ .searchPost(user, sortBy1, sortBy2, sortBy3, pageNo, dataSize, userId);
+ Assert.assertNotNull(searchResult);
+ }
+
+ @Test
+ public void processAttributesTest() throws Exception {
+ BasicAttributes attributes = new BasicAttributes();
+
+ attributes.put("nickname", "FirstName");
+ attributes.put("initials", "Mr");
+
+ attributes.put("sn", "sn");
+ attributes.put("employeeNumber", "employeeNumber");
+ attributes.put("nickname", "FirstName");
+ attributes.put("mail", "mail");
+ attributes.put("telephoneNumber", "telephoneNumber");
+ attributes.put("departmentNumber", "departmentNumber");
+ attributes.put("a1", "a1");
+ attributes.put("street", "street");
+ attributes.put("roomNumber", "roomNumber");
+ attributes.put("l", "l");
+ attributes.put("st", "st");
+ attributes.put("postalCode", "postalCode");
+ attributes.put("zip4", "zip4");
+ attributes.put("physicalDeliveryOfficeName", "physicalDeliveryOfficeName");
+ attributes.put("bc", "bc");
+ attributes.put("friendlyCountryName", "friendlyCountryName");
+ attributes.put("bd", "bd");
+ attributes.put("bdname", "bdname");
+ attributes.put("jtname", "jtname");
+ attributes.put("mgrid", "mgrid");
+ attributes.put("a2", "a2");
+ attributes.put("compcode", "compcode");
+ attributes.put("compdesc", "compdesc");
+ attributes.put("bu", "bu");
+ attributes.put("buname", "buname");
+ attributes.put("silo", "silo");
+ attributes.put("costcenter", "costcenter");
+ attributes.put("b2", "b2");
+ attributes.put("test", "test");
+
+ Method method = ldapServiceImpl.getClass().getDeclaredMethod("processAttributes", Attributes.class);
+ method.setAccessible(true);
+
+ User user = (User)method.invoke(ldapServiceImpl, attributes);
+ Assert.assertNotNull(user);
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LocalAccessConditionTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LocalAccessConditionTest.java
new file mode 100644
index 00000000..c78e46cc
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LocalAccessConditionTest.java
@@ -0,0 +1,78 @@
+/*
+ * ============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.service;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
+import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.context.annotation.ConditionContext;
+import org.springframework.core.type.AnnotatedTypeMetadata;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ PortalApiProperties.class })
+public class LocalAccessConditionTest {
+
+ @InjectMocks
+ private LocalAccessCondition localAccessCondition;
+
+ @Test
+ public void matchesTest(){
+ ConditionContext context = Mockito.mock(ConditionContext.class);
+ AnnotatedTypeMetadata metadata = Mockito.mock(AnnotatedTypeMetadata.class);
+ boolean matches = localAccessCondition.matches(context, metadata);
+ Assert.assertTrue(matches);
+ }
+
+ @Test
+ public void matchesWithAccessTest(){
+ ConditionContext context = Mockito.mock(ConditionContext.class);
+ AnnotatedTypeMetadata metadata = Mockito.mock(AnnotatedTypeMetadata.class);
+ PowerMockito.mockStatic(PortalApiProperties.class);
+ Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED)).thenReturn("LOCAL");
+ boolean matches = localAccessCondition.matches(context, metadata);
+ Assert.assertTrue(matches);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImplTest.java
new file mode 100644
index 00000000..2f827bd9
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImplTest.java
@@ -0,0 +1,200 @@
+/*
+ * ============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.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.command.LoginBean;
+import org.onap.portalsdk.core.domain.App;
+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.domain.UserApp;
+import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.web.support.AppUtils;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ PortalApiProperties.class, AppUtils.class, UserUtils.class, SystemProperties.class })
+public class LoginServiceCentralizedImplTest {
+
+ @InjectMocks
+ private LoginServiceCentralizedImpl loginServiceCentrImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Mock
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @Mock
+ private UserService userService;
+
+ @Test
+ public void findUserTest() throws Exception {
+ String userId = "S1234";
+ LoginBean bean = new LoginBean();
+ bean.setUserid(userId);
+ String menuPropertiesFilename ="";
+ Map additionalParams = new HashMap();
+
+ User mockUser = new User();
+ mockUser.setOrgUserId("G1234");
+ mockUser.setLoginId(userId);
+
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setId(12L);
+ roleFunction.setName("Role Function");
+
+ Set roleFunctions = new TreeSet();
+ roleFunctions.add(roleFunction);
+
+ Role role = new Role();
+ role.setName("Role");
+ role.setActive(true);
+ role.setRoleFunctions(roleFunctions);
+
+ Set userApps = new TreeSet();
+ UserApp userApp = new UserApp();
+
+ App app = new App();
+ app.setId(new Long(1));
+ app.setName("Default");
+ userApp.setUserId(1L);
+ userApp.setApp(app);
+ userApp.setRole(role);
+ userApps.add(userApp);
+ mockUser.setUserApps(userApps);
+
+ mockUser.setActive(true);
+
+ Mockito.when(restApiRequestBuilder.getViaREST("/user/" + bean.getUserid(), true, bean.getUserid())).thenReturn("Dummy Response");
+ Mockito.when(userService.userMapper(Mockito.anyString())).thenReturn(mockUser);
+
+ Map<String, String> params = new HashMap<>();
+ params.put("orgUserId", mockUser.getOrgUserId());
+
+ List idList = new ArrayList();
+ idList.add(1L);
+ Mockito.when(dataAccessService.executeNamedQuery("getUserIdByorgUserId", params, null)).thenReturn(idList);
+
+ LoginBean loginBean = loginServiceCentrImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertEquals(loginBean.getUserid(), userId);
+ }
+
+
+ @Test
+ public void findUserWithErroMsgTest() throws Exception {
+ String userId = "S1234";
+ LoginBean bean = new LoginBean();
+ bean.setUserid(userId);
+ String menuPropertiesFilename ="";
+ Map additionalParams = new HashMap();
+
+ User mockUser = new User();
+ mockUser.setOrgUserId("G1234");
+ mockUser.setLoginId(userId);
+
+ mockUser.setActive(false);
+
+ Mockito.when(restApiRequestBuilder.getViaREST("/user/" + bean.getUserid(), true, bean.getUserid())).thenReturn("Dummy Response");
+ Mockito.when(userService.userMapper(Mockito.anyString())).thenReturn(mockUser);
+
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.isApplicationLocked()).thenReturn(true);
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.SYS_ADMIN_ROLE_ID)).thenReturn("SYSTEMS");
+
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(UserUtils.hasRole(Mockito.any(User.class), Mockito.any(String.class))).thenReturn(false);
+
+ LoginBean loginBean = loginServiceCentrImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertEquals(loginBean.getUserid(), userId);
+ }
+
+ @Test
+ public void findUserWihtoutUserIdTest() throws Exception {
+ LoginBean bean = new LoginBean();
+ String menuPropertiesFilename ="";
+ Map additionalParams = new HashMap();
+
+ User mockUser = new User();
+ mockUser.setOrgUserId("G1234");
+ mockUser.setLoginId("L1234");
+
+ LoginBean loginBean = loginServiceCentrImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertNull(loginBean.getLoginId());
+
+ }
+
+ @Test
+ public void findUserWithoutUserIdTest() throws Exception {
+ LoginBean bean = new LoginBean();
+ String menuPropertiesFilename ="";
+ Map additionalParams = new HashMap();
+ LoginBean loginBean = loginServiceCentrImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertNull(loginBean.getLoginId());
+ }
+
+ @Test
+ public void findUserWithoutUserIdAndPasswordTest() throws Exception {
+ LoginBean bean = new LoginBean();
+ String menuPropertiesFilename ="";
+ Map additionalParams = new HashMap();
+ LoginBean loginBean = loginServiceCentrImpl.findUser(bean, menuPropertiesFilename, additionalParams, false);
+ Assert.assertNull(loginBean.getLoginId());
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceImplTest.java
new file mode 100644
index 00000000..ecaec1cb
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/LoginServiceImplTest.java
@@ -0,0 +1,185 @@
+/*
+ * ============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.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.command.LoginBean;
+import org.onap.portalsdk.core.domain.App;
+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.domain.UserApp;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.web.support.AppUtils;
+import org.onap.portalsdk.core.web.support.UserUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class, AppUtils.class, UserUtils.class })
+public class LoginServiceImplTest {
+
+ @InjectMocks
+ private LoginServiceImpl loginServiceImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void findUserTest() throws Exception {
+ String userId = "S1234";
+ LoginBean bean = new LoginBean();
+ bean.setUserid(userId);
+ String menuPropertiesFilename = "";
+ Map additionalParams = new HashMap();
+
+ RoleFunction roleFunction = new RoleFunction();
+ roleFunction.setId(12L);
+ roleFunction.setName("Role Function");
+
+ Set roleFunctions = new TreeSet();
+ roleFunctions.add(roleFunction);
+
+ Role role = new Role();
+ role.setName("Role");
+ role.setActive(true);
+ role.setRoleFunctions(roleFunctions);
+
+ Set userApps = new TreeSet();
+ UserApp userApp = new UserApp();
+
+ App app = new App();
+ app.setId(new Long(1));
+ app.setName("Default");
+ userApp.setUserId(1L);
+ userApp.setApp(app);
+ userApp.setRole(role);
+ userApps.add(userApp);
+
+ User mockUser = new User();
+ mockUser.setOrgUserId("G1234");
+ mockUser.setLoginId(userId);
+ mockUser.setUserApps(userApps);
+ mockUser.setActive(true);
+
+ List users = new ArrayList();
+ users.add(mockUser);
+
+ Map<String, String> params = new HashMap<>();
+ params.put("org_user_id", bean.getUserid());
+
+ Mockito.when(dataAccessService.executeNamedQuery("getUserByOrgUserId", params, new HashMap()))
+ .thenReturn(users);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME)).thenReturn("Menu");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_SET_NAME)).thenReturn("Menu");
+
+ LoginBean returnBean = loginServiceImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertNotNull(returnBean.getUser());
+ }
+
+ @Test
+ public void findUserWithErrorMsgTest() throws Exception {
+ String userId = "S1234";
+ LoginBean bean = new LoginBean();
+ bean.setUserid(userId);
+ String menuPropertiesFilename = "";
+ Map additionalParams = new HashMap();
+
+ User mockUser = new User();
+ mockUser.setOrgUserId("G1234");
+ mockUser.setLoginId(userId);
+
+ List users = new ArrayList();
+ users.add(mockUser);
+
+ Map<String, String> params = new HashMap<>();
+ params.put("org_user_id", bean.getUserid());
+
+ Mockito.when(dataAccessService.executeNamedQuery("getUserByOrgUserId", params, new HashMap()))
+ .thenReturn(users);
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME)).thenReturn("Menu");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_SET_NAME)).thenReturn("Menu");
+ Mockito.when(SystemProperties.getProperty(SystemProperties.SYS_ADMIN_ROLE_ID)).thenReturn("Role");
+
+ PowerMockito.mockStatic(AppUtils.class);
+ Mockito.when(AppUtils.isApplicationLocked()).thenReturn(true);
+
+ PowerMockito.mockStatic(UserUtils.class);
+ Mockito.when(UserUtils.hasRole(Mockito.any(User.class), Mockito.anyString())).thenReturn(false);
+
+ LoginBean returnBean = loginServiceImpl.findUser(bean, menuPropertiesFilename, additionalParams);
+ Assert.assertNull(returnBean.getUser());
+ }
+
+ @Test
+ public void findUserWithoutUseridAndPassTrueTest() throws Exception {
+ LoginBean bean = new LoginBean();
+ bean.setLoginId("L1234");
+ bean.setLoginPwd("L1234");
+ String menuPropertiesFilename = "";
+ Map additionalParams = new HashMap();
+ LoginBean returnBean = loginServiceImpl.findUser(bean, menuPropertiesFilename, additionalParams, true);
+ Assert.assertNull(returnBean.getUser());
+ }
+
+ @Test
+ public void findUserWithoutUseridAndPassFalseTest() throws Exception {
+ LoginBean bean = new LoginBean();
+ bean.setLoginId("L1234");
+ bean.setLoginPwd("L1234");
+ String menuPropertiesFilename = "";
+ Map additionalParams = new HashMap();
+ LoginBean returnBean = loginServiceImpl.findUser(bean, menuPropertiesFilename, additionalParams, false);
+ Assert.assertNull(returnBean.getUser());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/PostSearchServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/PostSearchServiceImplTest.java
new file mode 100644
index 00000000..7e42c531
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/PostSearchServiceImplTest.java
@@ -0,0 +1,188 @@
+/*
+ * ============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.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.command.PostSearchBean;
+import org.onap.portalsdk.core.domain.Lookup;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({SystemProperties.class})
+public class PostSearchServiceImplTest {
+
+ @InjectMocks
+ private PostSearchServiceImpl postSearchServiceImpl;
+
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void processTest() throws Exception {
+
+ PostSearchBean postSearch = new PostSearchBean();
+
+ String select[] = {"One", "Two"};
+ String[] postOrgUserId = {"One", "Two"};
+ String firstNames[] = {"One", "Two"};
+ String[] lastNames = {"One", "Two"};
+ postSearch.setSelected(select);
+ postSearch.setPostFirstName(firstNames);
+ postSearch.setPostLastName(lastNames);
+
+ postSearch.setPostHrid(lastNames);
+ postSearch.setPostPhone(lastNames);
+ postSearch.setPostEmail(lastNames);
+ postSearch.setPostAddress1(lastNames);
+ postSearch.setPostAddress2(lastNames);
+ postSearch.setPostCity(firstNames);
+ postSearch.setPostState(lastNames);
+ postSearch.setPostZipCode(lastNames);
+ postSearch.setPostLocationClli(lastNames);
+ postSearch.setPostBusinessCountryCode(firstNames);
+ postSearch.setPostBusinessCountryName(lastNames);
+ postSearch.setPostOrgUserId(postOrgUserId);
+ postSearch.setPostDepartment(firstNames);
+ postSearch.setPostDepartmentName(firstNames);
+ postSearch.setPostBusinessUnit(firstNames);
+ postSearch.setPostBusinessUnitName(firstNames);
+ postSearch.setPostJobTitle(lastNames);
+ postSearch.setPostOrgManagerUserId(firstNames);
+ postSearch.setPostCommandChain(lastNames);
+ postSearch.setPostCompanyCode(firstNames);
+ postSearch.setPostCompany(firstNames);
+ postSearch.setPostCostCenter(firstNames);
+ postSearch.setPostSiloStatus(firstNames);
+ postSearch.setPostFinancialLocCode(firstNames);
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+
+ Lookup lookup = new Lookup();
+ lookup.setValue("Dummy Lookup");
+ List list =new ArrayList<>();
+ list.add(lookup);
+
+ Mockito.when(dataAccessService.getLookupList("fn_lu_country", "country_cd", "country","country = 'One'", null, null)).thenReturn(list);
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)).thenReturn("2");
+
+ Role role = new Role();
+ role.setId(2L);
+ Mockito.when(dataAccessService.getDomainObject(Role.class, Long.valueOf(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)),
+ null)).thenReturn(role);
+
+ int importedUser = postSearchServiceImpl.process(request, postSearch);
+ Assert.assertEquals(2, importedUser);
+ }
+
+ @Test(expected = Exception.class)
+ public void processExceptionTest() throws Exception {
+
+ PostSearchBean postSearch = new PostSearchBean();
+
+ String select[] = {"One", "Two"};
+ String[] postOrgUserId = {"One", "Two"};
+ String firstNames[] = {"One", "Two"};
+ String[] lastNames = {"One", "Two"};
+ postSearch.setSelected(select);
+ postSearch.setPostFirstName(firstNames);
+ postSearch.setPostLastName(lastNames);
+
+ postSearch.setPostHrid(lastNames);
+ postSearch.setPostPhone(lastNames);
+ postSearch.setPostEmail(lastNames);
+ postSearch.setPostAddress1(lastNames);
+ postSearch.setPostAddress2(lastNames);
+ postSearch.setPostCity(firstNames);
+ postSearch.setPostState(lastNames);
+ postSearch.setPostZipCode(lastNames);
+ postSearch.setPostLocationClli(lastNames);
+ postSearch.setPostBusinessCountryCode(firstNames);
+ postSearch.setPostBusinessCountryName(lastNames);
+ postSearch.setPostOrgUserId(postOrgUserId);
+ postSearch.setPostDepartment(firstNames);
+ postSearch.setPostDepartmentName(firstNames);
+ postSearch.setPostBusinessUnit(firstNames);
+ postSearch.setPostBusinessUnitName(firstNames);
+ postSearch.setPostJobTitle(lastNames);
+ postSearch.setPostOrgManagerUserId(firstNames);
+ postSearch.setPostCommandChain(lastNames);
+ postSearch.setPostCompanyCode(firstNames);
+ postSearch.setPostCompany(firstNames);
+ postSearch.setPostCostCenter(firstNames);
+ postSearch.setPostSiloStatus(firstNames);
+ postSearch.setPostFinancialLocCode(firstNames);
+
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+
+ Lookup lookup = new Lookup();
+ lookup.setValue("Dummy Lookup");
+ List list =new ArrayList<>();
+ list.add(lookup);
+
+ Mockito.when(dataAccessService.getLookupList("fn_lu_country", "country_cd", "country","country = 'One'", null, null)).thenReturn(list);
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)).thenReturn("2");
+
+ Role role = new Role();
+ Mockito.when(dataAccessService.getDomainObject(Role.class, Long.valueOf(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)),
+ null)).thenReturn(role);
+
+ postSearchServiceImpl.process(request, postSearch);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceCentralizedImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceCentralizedImplTest.java
new file mode 100644
index 00000000..23b3f25f
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceCentralizedImplTest.java
@@ -0,0 +1,89 @@
+/*
+ * ============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.service;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.Profile;
+import org.onap.portalsdk.core.domain.User;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class ProfileServiceCentralizedImplTest {
+
+ @InjectMocks
+ private ProfileServiceCentralizedImpl profileServiceCentrImpl ;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Mock
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @Test
+ public void findAllTest() throws Exception {
+ profileServiceCentrImpl.findAll();
+ }
+
+ @Test
+ public void getProfileTest() throws Exception {
+ String json = "{ \"first_name\" : \"Mercedes\", \"last_name\" : \"Name\" }";
+ Mockito.when(restApiRequestBuilder.getViaREST(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString())).thenReturn(json);
+ Profile profile = profileServiceCentrImpl.getProfile(12);
+ Assert.assertNotNull(profile);
+ }
+
+ @Test
+ public void getUserTest() throws Exception {
+ String json = "{ \"firstName\" : \"Mercedes\"}";
+ Mockito.when(restApiRequestBuilder.getViaREST(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString())).thenReturn(json);
+ User user = profileServiceCentrImpl.getUser("12");
+ Assert.assertNotNull(user);
+ }
+
+ @Test
+ public void saveUserTest() {
+ User user = new User();
+ profileServiceCentrImpl.saveUser(user);
+ Assert.assertTrue(true);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceImplTest.java
new file mode 100644
index 00000000..fae7b75b
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/ProfileServiceImplTest.java
@@ -0,0 +1,99 @@
+/*
+ * ============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.service;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.dao.ProfileDao;
+import org.onap.portalsdk.core.domain.Profile;
+import org.onap.portalsdk.core.domain.User;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class ProfileServiceImplTest {
+
+ @InjectMocks
+ private ProfileServiceImpl profileServiceImpl;
+
+ @Mock
+ private ProfileDao profileDao;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void findAllTest(){
+ profileServiceImpl.findAll();
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getUserTest(){
+ String userId = "123";
+ User user = new User();
+ user.setOrgUserId(userId);
+
+ Mockito.when(dataAccessService.getDomainObject(User.class, Long.parseLong(userId), null)).thenReturn(user);
+
+ User returnuser = profileServiceImpl.getUser(userId);
+ Assert.assertEquals(userId, returnuser.getOrgUserId());
+ }
+
+ @Test
+ public void saveUserTest() {
+ String userId = "123";
+ User user = new User();
+ user.setOrgUserId(userId);
+ profileServiceImpl.saveUser(user);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getProfileTest() {
+ Profile profile = new Profile();
+ Long id = 12L;
+ profile.setId(id);
+ Mockito.when(profileDao.getProfile(12)).thenReturn(profile);
+ Profile value = profileServiceImpl.getProfile(12);
+ Assert.assertEquals(id, value.getId());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RestApiRequestBuilderTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RestApiRequestBuilderTest.java
new file mode 100644
index 00000000..21a0e797
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RestApiRequestBuilderTest.java
@@ -0,0 +1,292 @@
+/*
+ * ============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.service;
+
+import java.io.IOException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.App;
+import org.onap.portalsdk.core.onboarding.rest.RestWebServiceClient;
+import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ SystemProperties.class, CipherUtil.class, RestWebServiceClient.class })
+public class RestApiRequestBuilderTest {
+
+ @InjectMocks
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @Mock
+ private AppService appService;
+
+ @Test
+ public void getViaRESTTest() throws Exception {
+ String restEndPoint = "";
+ boolean isBasicAuth = false;
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ String status = "SUCCESS";
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ PowerMockito.mockStatic(CipherUtil.class);
+ Mockito.when(CipherUtil.decryptPKC(app.getAppPassword(),
+ SystemProperties.getProperty(SystemProperties.Decryption_Key))).thenReturn(app.getAppPassword());
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+
+ Mockito.when(client.getPortalContent(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn(status);
+
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ String response = restApiRequestBuilder.getViaREST(restEndPoint, isBasicAuth, userId);
+ Assert.assertEquals(status, response);
+ }
+
+ @Test(expected=IOException.class)
+ public void getViaRESTTExceptionest() throws Exception {
+ String restEndPoint = "";
+ boolean isBasicAuth = false;
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ restApiRequestBuilder.getViaREST(restEndPoint, isBasicAuth, userId);
+ }
+
+ @Test
+ public void getViaRESTWithoutAppTest() throws Exception {
+
+ String restEndPoint = "";
+ boolean isBasicAuth = false;
+ String userId = "123";
+
+ String status = "FAILURE";
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+
+ Mockito.when(client.getPortalContent(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn(status);
+
+ Mockito.when(appService.getDefaultApp()).thenReturn(null);
+
+ String response = restApiRequestBuilder.getViaREST(restEndPoint, isBasicAuth, userId);
+ Assert.assertEquals(status, response);
+
+ }
+
+ @Test
+ public void postViaRESTTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ String status = "SUCCESS";
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ PowerMockito.mockStatic(CipherUtil.class);
+ Mockito.when(CipherUtil.decryptPKC(app.getAppPassword(),
+ SystemProperties.getProperty(SystemProperties.Decryption_Key))).thenReturn(app.getAppPassword());
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+ Mockito.when(client.postPortalContent(Mockito.anyString(),Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn(status);
+
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ restApiRequestBuilder.postViaREST(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+
+ @Test(expected = IOException.class)
+ public void postViaRESTExceptionTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ restApiRequestBuilder.postViaREST(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void postViaRESTWithoutAppTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+ Mockito.when(appService.getDefaultApp()).thenReturn(null);
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+ Mockito.when(client.postPortalContent(Mockito.anyString(),Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn("SUCCESS");
+
+ restApiRequestBuilder.postViaREST(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteViaRestTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ String status = "SUCCESS";
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ PowerMockito.mockStatic(CipherUtil.class);
+ Mockito.when(CipherUtil.decryptPKC(app.getAppPassword(),
+ SystemProperties.getProperty(SystemProperties.Decryption_Key))).thenReturn(app.getAppPassword());
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+ Mockito.when(client.postPortalContent(Mockito.anyString(),Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn(status);
+
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ restApiRequestBuilder.deleteViaRest(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+
+ @Test(expected = IOException.class)
+ public void deleteViaRestExceptionTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+
+ App app = new App();
+ app.setName("Test");
+ app.setUsername("TestUser");
+ app.setAppPassword("Password");
+
+ PowerMockito.mockStatic(SystemProperties.class);
+ Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword());
+ Mockito.when(appService.getDefaultApp()).thenReturn(app);
+
+ restApiRequestBuilder.deleteViaRest(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteViaRestWithoutAppTest() throws Exception {
+ String restEndPoint ="";
+ boolean isBasicAuth = false;
+ String content = "Data";
+ String userId = "123";
+ Mockito.when(appService.getDefaultApp()).thenReturn(null);
+
+ PowerMockito.mockStatic(RestWebServiceClient.class);
+ RestWebServiceClient client = Mockito.mock(RestWebServiceClient.class);
+ Mockito.when(RestWebServiceClient.getInstance()).thenReturn(client);
+ Mockito.when(client.postPortalContent(Mockito.anyString(),Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),Mockito.anyString(), Mockito.anyBoolean()))
+ .thenReturn("SUCCESS");
+
+ restApiRequestBuilder.deleteViaRest(restEndPoint, isBasicAuth,content, userId);
+
+ Assert.assertTrue(true);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java
new file mode 100644
index 00000000..0b61af8d
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java
@@ -0,0 +1,165 @@
+/*
+ * ============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.service;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.domain.RoleFunction;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class RoleServiceCentralizedAccessTest {
+
+ @InjectMocks
+ private RoleServiceCentralizedAccess roleServiceCntrlAccess;
+
+ @Mock
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @Test
+ public void getRoleFunctionsTest() throws Exception {
+ String loginId ="1234";
+ String response ="[ { \"code\" : \"abc\", \"name\" : \"xyz\" }, { \"code\" : \"pqr\", \"name\" : \"str\" } ]";
+ Mockito.when(restApiRequestBuilder.getViaREST("/functions", true, loginId)).thenReturn(response);
+ List<RoleFunction> roleFunctions = roleServiceCntrlAccess.getRoleFunctions(loginId);
+ Assert.assertTrue(roleFunctions.size() > 0);
+ }
+
+ @Test
+ public void getAvailableChildRolesWithEmptyRoleIdTest() throws Exception {
+ String loginId = "123";
+ Long roleId = null;
+ String response ="[ { \"active\" : true, \"name\" : \"xyz\" } ]";
+ Mockito.when(restApiRequestBuilder.getViaREST("/roles", true, loginId)).thenReturn(response);
+ List<Role> roles = roleServiceCntrlAccess.getAvailableChildRoles(loginId, roleId);
+ Assert.assertNotNull(roles);
+ }
+
+ @Test
+ public void getAvailableChildRolesWithZeroRoleIdTest() throws Exception {
+ String loginId = "123";
+ Long roleId = 0L;
+ String response ="[ { \"active\" : true, \"name\" : \"xyz\" } ]";
+ Mockito.when(restApiRequestBuilder.getViaREST("/roles", true, loginId)).thenReturn(response);
+ List<Role> roles = roleServiceCntrlAccess.getAvailableChildRoles(loginId, roleId);
+ Assert.assertNotNull(roles);
+ }
+
+ @Test
+ public void getAvailableChildRolesTest() throws Exception {
+ String loginId = "123";
+ Long roleId = 123L;
+ String response ="[ { \"active\" : false, \"name\" : \"xyz\" } ]";
+ Mockito.when(restApiRequestBuilder.getViaREST("/roles", true, loginId)).thenReturn(response);
+ String roleResponse =" { \"active\" : true, \"name\" : \"xyz\", \"roleFunctions\" : [ { \"code\" : \"abc\", \"name\" : \"RF1\" }, { \"code\" : \"pqr\", \"name\" : \"RF2\" } ] , \"parentRoles\": [ {\"active\" : false, \"name\" : \"XYZ-ABC\"}, {\"active\" : true, \"name\" : \"ABC\"} ] } ";
+ Mockito.when(restApiRequestBuilder.getViaREST("/role/" + roleId, true, loginId)).thenReturn(roleResponse);
+ roleServiceCntrlAccess.getAvailableChildRoles(loginId, roleId);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void saveRoleTest() throws Exception {
+ Role role = new Role();
+ role.setName("Role");
+ roleServiceCntrlAccess.saveRole("123", role);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteRoleTest() throws Exception {
+ Role role = new Role();
+ role.setName("Role");
+ role.setId(123l);
+ roleServiceCntrlAccess.deleteRole("123", role);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getActiveRolesTest() throws Exception {
+ String requestedLoginId ="1234";
+ String response ="[ { \"active\" : true, \"name\" : \"role1\" }, { \"active\" : false, \"name\" : \"role2\" } ]";
+ Mockito.when(restApiRequestBuilder.getViaREST("/activeRoles", true, requestedLoginId)).thenReturn(response);
+ List<Role> roles = roleServiceCntrlAccess.getActiveRoles(requestedLoginId);
+ Assert.assertNotNull(roles);
+ }
+
+ @Test
+ public void getRoleFunctionTest() throws IOException {
+ String requestedLoginId = "xyz";
+ String code ="abc";
+
+ String responseString = " { \"code\" : \"abc\", \"name\" : \"xyz\" }";
+ Mockito.when(restApiRequestBuilder.getViaREST("/function/" + code, true, requestedLoginId)).thenReturn(responseString);
+ RoleFunction roleFunction = roleServiceCntrlAccess.getRoleFunction(requestedLoginId, code);
+ Assert.assertNotNull(roleFunction);
+ }
+
+ @Test
+ public void saveRoleFunctionTest() throws IOException {
+ String requestedLoginId ="123";
+ RoleFunction domainRoleFunction = new RoleFunction();
+ domainRoleFunction.setId(1234L);
+ roleServiceCntrlAccess.saveRoleFunction(requestedLoginId, domainRoleFunction);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteRoleFunctionTest() throws IOException {
+ String requestedLoginId ="123";
+ RoleFunction domainRoleFunction = new RoleFunction();
+ domainRoleFunction.setId(1234L);
+ roleServiceCntrlAccess.deleteRoleFunction(requestedLoginId, domainRoleFunction);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteDependcyRoleRecord() throws IOException {
+ String requestedLoginId = "123";
+ Long id = 123L;
+ roleServiceCntrlAccess.deleteDependcyRoleRecord(requestedLoginId, id);
+ Assert.assertTrue(true);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceImplTest.java
new file mode 100644
index 00000000..3186b464
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceImplTest.java
@@ -0,0 +1,256 @@
+/*
+ * ============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.service;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.sql.DataSource;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.Role;
+import org.onap.portalsdk.core.domain.RoleFunction;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class RoleServiceImplTest {
+
+ @InjectMocks
+ private RoleServiceImpl roleServiceImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Mock
+ private DataSource dataSource;
+
+ @Test
+ public void getRoleFunctions() throws Exception {
+ String loginId = "123";
+ roleServiceImpl.getRoleFunctions(loginId);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getAvailableChildRolesWithEmptyIdTest() throws Exception {
+ String loginId = "123";
+ Long roleId = null;
+ Role child1 = new Role();
+ child1.setName("Child1");
+
+ Role child2 = new Role();
+ child1.setName("Child2");
+ List<Role> childRoles = new ArrayList<>();
+ childRoles.add(child1);
+ childRoles.add(child2);
+ Mockito.when(dataAccessService.getList(Role.class, null)).thenReturn(childRoles);
+ List<Role> list = roleServiceImpl.getAvailableChildRoles(loginId, roleId);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void getAvailableChildRolesWithZeroIdTest() throws Exception {
+ String loginId = "123";
+ Long roleId = 0L;
+ Role child1 = new Role();
+ child1.setName("Child1");
+
+ Role child2 = new Role();
+ child1.setName("Child2");
+ List<Role> childRoles = new ArrayList<>();
+ childRoles.add(child1);
+ childRoles.add(child2);
+ Mockito.when(dataAccessService.getList(Role.class, null)).thenReturn(childRoles);
+ List<Role> list = roleServiceImpl.getAvailableChildRoles(loginId, roleId);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void getAvailableChildRolesTest() throws Exception {
+ String loginId = "123";
+ Long roleId = 123L;
+ Role child1 = new Role();
+ child1.setName("Child1");
+
+ Role child2 = new Role();
+ child2.setName("Child2");
+
+ List<Role> childRoles = new ArrayList<>();
+ childRoles.add(child1);
+ childRoles.add(child2);
+ Mockito.when(dataAccessService.getList(Role.class, null)).thenReturn(childRoles);
+
+ Role parentRole = new Role();
+ parentRole.setName("Parent");
+ Set parentRoles = new TreeSet();
+ parentRoles.add(parentRole);
+
+ Role currentRole = new Role();
+ currentRole.setName("Present Role");
+ currentRole.setParentRoles(parentRoles);
+ Mockito.when(dataAccessService.getDomainObject(Role.class, roleId, null)).thenReturn(currentRole);
+ roleServiceImpl.getAvailableChildRoles(loginId, roleId);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getRoleFunctionTest() {
+ String code = "abc";
+ String loginId ="123";
+ Mockito.when(dataAccessService.getDomainObject(RoleFunction.class, code, null)).thenReturn(new RoleFunction());
+ RoleFunction roleFunction = roleServiceImpl.getRoleFunction(loginId, code);
+ Assert.assertNotNull(roleFunction);
+ }
+
+ @Test
+ public void saveRoleFunctionTest() {
+ String loginId = "123";
+ RoleFunction domainRoleFunction = new RoleFunction();
+ roleServiceImpl.saveRoleFunction(loginId, domainRoleFunction);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteRoleFunctionTest() {
+ String loginId = "123";
+ RoleFunction domainRoleFunction = new RoleFunction();
+ roleServiceImpl.deleteRoleFunction(loginId, domainRoleFunction);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void getRoleTest() {
+ String loginId = "123";
+ Long id = 123L;
+ Mockito.when(dataAccessService.getDomainObject(Role.class, id, null)).thenReturn(new Role());
+ Role role = roleServiceImpl.getRole(loginId, id);
+ Assert.assertNotNull(role);
+ }
+
+ @Test
+ public void saveRoleTest() {
+ String loginId = "123";
+ Role domainRole = new Role();
+ domainRole.setName("Test Role");
+ roleServiceImpl.saveRole(loginId, domainRole);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteRoleTest() {
+ String loginId = "123";
+ Role domainRole = new Role();
+ domainRole.setName("Test Role");
+ roleServiceImpl.deleteRole(loginId, domainRole);
+ Assert.assertTrue(true);
+ }
+
+
+ @Test
+ public void getAvailableRolesTest() {
+
+ String loginId = "123";
+ Role child1 = new Role();
+ child1.setName("Child1");
+
+ Role child2 = new Role();
+ child2.setName("Child2");
+
+ List<Role> childRoles = new ArrayList<>();
+ childRoles.add(child1);
+ childRoles.add(child2);
+ Mockito.when(dataAccessService.getList(Role.class, null)).thenReturn(childRoles);
+ List<Role> list = roleServiceImpl.getAvailableRoles(loginId);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void getActiveRolesTest() {
+
+ String loginId = "123";
+ Long roleId = 123L;
+ Role child1 = new Role();
+ child1.setName("Child1");
+
+ Role child2 = new Role();
+ child2.setName("Child2");
+
+ List<Role> childRoles = new ArrayList<>();
+ childRoles.add(child1);
+ childRoles.add(child2);
+
+ String filter = " where active_yn = 'Y' ";
+ Mockito.when(dataAccessService.getList(Role.class, filter, null, null)).thenReturn(childRoles);
+ List<Role> list = roleServiceImpl.getActiveRoles(loginId);
+ Assert.assertNotNull(list);
+ }
+
+ @Test
+ public void deleteDependcyRoleRecordTest() throws Exception {
+ Connection conn = Mockito.mock(Connection.class);
+ Statement stmt = Mockito.mock(Statement.class);
+ String loginId= "123";
+ Long id = 123L;
+
+ Mockito.when(dataSource.getConnection()).thenReturn(conn);
+ Mockito.when(conn.createStatement()).thenReturn(stmt);
+ roleServiceImpl.deleteDependcyRoleRecord(loginId, id);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void deleteDependcyRoleRecordExcepTest() throws Exception {
+ Connection conn = Mockito.mock(Connection.class);
+ String loginId= "123";
+ Long id = 123L;
+
+ Mockito.when(dataSource.getConnection()).thenReturn(conn);
+ roleServiceImpl.deleteDependcyRoleRecord(loginId, id);
+ Assert.assertTrue(true);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UrlAccessImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UrlAccessImplTest.java
new file mode 100644
index 00000000..f3cd7bbe
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UrlAccessImplTest.java
@@ -0,0 +1,97 @@
+/*
+ * ============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.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Restrictions;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.UrlsAccessible;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+@RunWith(PowerMockRunner.class)
+public class UrlAccessImplTest {
+
+ @InjectMocks
+ private UrlAccessImpl urlAccessImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void isUrlAccessibleWithF1eTest() {
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ String currentUrl ="TestURL/content";
+ boolean isAccessible = urlAccessImpl.isUrlAccessible(request, currentUrl);
+ Assert.assertTrue(isAccessible);
+ }
+
+ @Test
+ public void isUrlAccessibleWithF2Test() {
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.addParameter("message_id", "5");
+ request.addParameter("message_location_id", "123");
+ String currentUrl ="TestURL*/content*";
+
+ UrlsAccessible url1= new UrlsAccessible();
+ url1.setFunctionCd("F1");
+ url1.setUrl("*/contentData");
+
+ UrlsAccessible url2= new UrlsAccessible();
+ url2.setFunctionCd("F2");
+ url2.setUrl("*/contentValue");
+
+ List list = new ArrayList<>();
+ list.add(url1);
+ list.add(url2);
+
+ Mockito.when(dataAccessService.getList(Mockito.any(), Mockito.any(), Mockito.anyList(), Mockito.any())).thenReturn(list);
+
+ boolean isAccessible = urlAccessImpl.isUrlAccessible(request, currentUrl);
+ Assert.assertFalse(isAccessible);
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserProfileServiceImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserProfileServiceImplTest.java
new file mode 100644
index 00000000..f7bb3108
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserProfileServiceImplTest.java
@@ -0,0 +1,91 @@
+/*
+ * ============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.service;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.domain.support.CollaborateList;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+
+@RunWith(PowerMockRunner.class)
+public class UserProfileServiceImplTest {
+
+ @InjectMocks
+ private UserProfileServiceImpl userProfileServiceImpl;
+
+ @Mock
+ private DataAccessService dataAccessService;
+
+ @Test
+ public void findAllTest() {
+ userProfileServiceImpl.findAll();
+ Assert.assertTrue(true);
+ }
+
+
+
+ @Test
+ public void saveUserTest(){
+ userProfileServiceImpl.saveUser(new User());
+ Assert.assertTrue(true);
+ }
+
+ /*@Test
+ public void findAllUserWithOnOfflineTest() throws Exception {
+ String originOrgUserId = "123";
+
+ Set<String> onlineUsers = new HashSet<>();
+ onlineUsers.add("123");
+
+ CollaborateList mockClass = Mockito.mock(CollaborateList.class);
+ Mockito.when(CollaborateList.getInstance()).thenReturn(mockClass);
+ Mockito.when(mockClass.getAllUserName()).thenReturn(onlineUsers);
+ userProfileServiceImpl.findAllUserWithOnOffline(originOrgUserId);
+ }*/
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java
new file mode 100644
index 00000000..16a8a597
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/AttributeTest.java
@@ -0,0 +1,79 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Attribute;
+
+public class AttributeTest {
+
+ private static final double DELTA = 1e-15;
+
+ public Attribute mockAttribute(){
+ Attribute attribute = new Attribute();
+
+ attribute.setName("test");
+ attribute.setHeight(10);
+ attribute.setLeft(10);
+ attribute.setTop(10);
+ attribute.setWidth(10);
+
+ return attribute;
+ }
+
+ @Test
+ public void attributeTest(){
+ Attribute attribute = mockAttribute();
+
+ Attribute attribute1 = new Attribute();
+ attribute1.setName("test");
+ attribute1.setHeight(10);
+ attribute1.setLeft(10);
+ attribute1.setTop(10);
+ attribute1.setWidth(10);
+
+ assertEquals(attribute.getHeight(), attribute1.getHeight(), DELTA);
+ assertEquals(attribute.getName(), attribute1.getName());
+ assertEquals(attribute.getLeft(), attribute1.getLeft(), DELTA);
+ assertEquals(attribute.getTop(), attribute1.getTop(), DELTA);
+ assertEquals(attribute.getWidth(), attribute1.getWidth(), DELTA);
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java
new file mode 100644
index 00000000..4bc9f3b6
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/CollaborateListTest.java
@@ -0,0 +1,60 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.CollaborateList;
+
+public class CollaborateListTest {
+
+ @SuppressWarnings("static-access")
+ @Test
+ public void addAndRemoveUserListTest(){
+ String user1 = "Test User1";
+ String user2 = "Test User2";
+ CollaborateList collaborateList = CollaborateList.getInstance();
+ collaborateList.addUserName(user1);
+ collaborateList.addUserName(user2);
+ collaborateList.delUserName(user2);
+
+ assertEquals(true, collaborateList.getAllUserName().contains(user1));
+ assertEquals(false, collaborateList.getAllUserName().contains(user2));
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java
new file mode 100644
index 00000000..145ee58f
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ContainerTest.java
@@ -0,0 +1,193 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.domain.support.Container;
+import org.onap.portalsdk.core.domain.support.Element;
+import org.onap.portalsdk.core.domain.support.Position;
+import org.onap.portalsdk.core.domain.support.Size;
+import org.onap.portalsdk.core.restful.client.SharedContextRestClient;
+import org.onap.portalsdk.core.web.support.UserUtils;
+
+public class ContainerTest {
+
+ @InjectMocks
+ Container container = new Container();
+
+ @Mock
+ private SharedContextRestClient sharedContextRestClient;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ //MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
+
+ NullPointerException nullPointerException = new NullPointerException();
+
+ User user = new User();
+
+ @Mock
+ UserUtils userUtils = new UserUtils();
+
+ private static final double DELTA = 1e-15;
+
+ public Container mockContainer(){
+ Container container = new Container("test","test",1,1,10,10,10,10,10,10);
+
+ Size size = new Size();
+ size.setHeight(10);
+ size.setWidth(10);
+
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+
+ Map<String, Container> containerRowCol = new HashMap<String, Container>();
+ Map<String, Element> elementRowCol = new HashMap<String, Element>();
+
+ List<Container> innerCList = new ArrayList<Container>();
+ List<Element> elementList = new ArrayList<Element>();
+
+ container.setName("test");
+ container.setVisibilityType("test");
+ container.setHeight(10);
+ container.setLeft(10);
+ container.setWidth(10);
+ container.setInnerContainer(null);
+ container.setElements(null);
+ container.setInnerCList(null);
+ container.setElementList(null);
+ container.setP(null);
+ return container;
+ }
+
+ @Test
+ public void containerTest(){
+ Container container = mockContainer();
+
+ Container container1 = new Container("test","test",1,1,10,10,10,10,10,10);
+
+ Size size1 = new Size();
+ size1.setHeight(10);
+ size1.setWidth(10);
+
+ Position position1 = new Position();
+ position1.setX(10);
+ position1.setY(10);
+ container1.setP(null);
+
+
+ container1.setName("test");
+ container.setVisibilityType("test");
+ container.setHeight(10);
+ container.setLeft(10);
+ container.setWidth(10);
+ container.setInnerContainer(null);
+ container.setElements(null);
+ container.setInnerCList(null);
+ container.setElementList(null);
+
+ assertEquals(container.getContainerRowCol(), container1.getContainerRowCol());
+ assertEquals(container.getElementRowCol(), container1.getElementRowCol());
+ assertEquals(container.getName(), container1.getName());
+ assertEquals(container.getP(), container1.getP());
+ }
+
+ @Test
+ public void computeSizeTest(){
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container = new Container("test","test",1,1,10,10,10,10,10,10);
+ containerRowCol.put("00", container);
+
+ Map<String, Element> elementRowCol = new HashMap<>();
+ Element element = new Element("1", "test");
+ elementRowCol.put("00", element);
+
+ Container containerTest = new Container("test","Broadworks complex",1,1,10,10,10,10,10,10);
+ containerTest.setElements(elementRowCol);
+ containerTest.setInnerContainer(containerRowCol);
+ Size size = containerTest.computeSize();
+ assertEquals(40.0,size.getWidth(), DELTA);
+ assertEquals(40.1, size.getHeight(), DELTA);
+ }
+
+ @Test
+ public void computeElementPositionsTest(){
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Container container01 = new Container("test","test",1,1,10,10,10,10,10,10);
+ containerRowCol.put("00", container00);
+ containerRowCol.put("10", container01);
+ containerRowCol.put("11", container01);
+
+ Map<String, Element> elementRowCol = new HashMap<>();
+ Element element = new Element("1", "test");
+ elementRowCol.put("01", element);
+ elementRowCol.put("02", element);
+
+ Container containerTest = new Container("test","Broadworks complex",2,3,10,10,10,10,10,10);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ containerTest.setP(position);
+ containerTest.setElements(elementRowCol);
+ containerTest.setInnerContainer(containerRowCol);
+ containerTest.computeElementPositions();
+ assertEquals(20.0,containerTest.getContainerRowCol().get("00").getP().getX(), DELTA);
+ assertEquals(20.0,containerTest.getContainerRowCol().get("00").getP().getY(), DELTA);
+ assertEquals(50.0,containerTest.getContainerRowCol().get("11").getP().getX(), DELTA);
+ assertEquals(31.5,containerTest.getContainerRowCol().get("11").getP().getY(), DELTA);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java
new file mode 100644
index 00000000..ff9522df
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainTest.java
@@ -0,0 +1,143 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Container;
+import org.onap.portalsdk.core.domain.support.Domain;
+import org.onap.portalsdk.core.domain.support.Size;
+
+public class DomainTest {
+
+ private static final double DELTA = 1e-15;
+
+ public Domain mockDomain(){
+
+ Domain domain = new Domain(null, null, 0, 0, 0, 0, 0, 0, 0);
+
+ domain.setP(null);
+ domain.setNewXafterColl(0);
+ domain.setYafterColl(0);
+ domain.setDomainToLayoutWd(0);
+ domain.setTop(0);
+ domain.setLeft(0);
+ domain.setHeight(0);
+ domain.setWidth(0);
+ domain.setName("test");
+ domain.setIndexChanged(false);
+ domain.setContainers(null);
+
+ return domain;
+ }
+
+ @Test
+ public void domainTest(){
+ Domain domain = mockDomain();
+
+ Domain domain1 = new Domain(null, null, 0, 0, 0, 0, 0, 0, 0);
+
+ domain1.setP(null);
+ domain1.setNewXafterColl(0);
+ domain1.setYafterColl(0);
+ domain1.setDomainToLayoutWd(0);
+ domain1.setTop(0);
+ domain1.setLeft(0);
+ domain1.setHeight(0);
+ domain1.setWidth(0);
+ domain1.setName("test");
+ domain1.setIndexChanged(false);
+ domain1.setContainers(null);
+
+ assertEquals(domain.getP(), domain1.getP());
+ assertEquals(domain.getNewXafterColl(), domain1.getNewXafterColl(), DELTA);
+ assertEquals(domain.getYafterColl(), domain1.getYafterColl(), DELTA);
+ assertEquals(domain.getDomainToLayoutWd(), domain1.getDomainToLayoutWd(), DELTA);
+ assertEquals(domain.getTop(), domain1.getTop(), DELTA);
+ assertEquals(domain.getLeft(), domain1.getLeft(), DELTA);
+ assertEquals(domain.getHeight(), domain1.getHeight(), DELTA);
+ assertEquals(domain.getWidth(), domain1.getWidth(), DELTA);
+ assertEquals(domain.getName(), domain1.getName());
+ assertEquals(domain.isIndexChanged(), domain1.isIndexChanged());
+ assertEquals(domain.getContainerRowCol(), domain1.getContainerRowCol());
+ }
+
+ @Test
+ public void computeSizeTest(){
+ Domain domain = new Domain("test", "VNI", 0, 0, 0, 0, 0, 2, 2);
+ Container container = new Container("test","test",1,1,10,10,10,10,10,10);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ containerRowCol.put("00", container);
+ containerRowCol.put("10", container);
+ containerRowCol.put("11", container);
+ domain.setContainers(containerRowCol);
+ Size size = domain.computeSize();
+ assertEquals(5.0, size.getHeight(), DELTA);
+ }
+ @Test
+ public void computeSizeWithoutNameTest(){
+ Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Container container = new Container("test","test",1,1,10,10,10,10,10,10);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ containerRowCol.put("00", container);
+ containerRowCol.put("10", container);
+ containerRowCol.put("11", container);
+ domain.setContainers(containerRowCol);
+ Size size = domain.computeSize();
+ assertEquals(5.0, size.getHeight(), DELTA);
+ }
+
+ @Test
+ public void computeConatinerPositionsTest(){
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Container container01 = new Container("test","test",1,1,10,10,10,10,10,10);
+ containerRowCol.put("00", container00);
+ containerRowCol.put("10", container01);
+ containerRowCol.put("11", container01);
+
+ Domain domain = new Domain("test", "XYZ", 0, 1, 1, 4, 4, 2, 2);
+ domain.setContainers(containerRowCol);
+ domain.computeConatinerPositions();
+ assertEquals(21.0, domain.getContainerRowCol().get("10").getP().getX(), DELTA);
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java
new file mode 100644
index 00000000..d000803e
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/DomainVOTest.java
@@ -0,0 +1,107 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Date;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.DomainVo;
+
+public class DomainVOTest {
+
+ public DomainVo mockDomainVO(){
+ DomainVo domainVo = new DomainVo();
+
+ domainVo.setId((long) 1);
+ domainVo.setCreated(new Date());
+ domainVo.setModified(new Date());
+ domainVo.setCreatedId((long) 1);
+ domainVo.setModifiedId((long) 1);
+ domainVo.setRowNum((long) 1);
+ domainVo.setAuditUserId(null);
+ domainVo.setAuditTrail(null);
+
+ return domainVo;
+ }
+
+ @Test
+ public void domainVoTest(){
+ DomainVo domainVo = mockDomainVO();
+
+ DomainVo domainVo1 = new DomainVo();
+ domainVo1.setId((long) 1);
+ domainVo1.setCreated(new Date());
+ domainVo1.setModified(new Date());
+ domainVo1.setCreatedId((long) 1);
+ domainVo1.setModifiedId((long) 1);
+ domainVo1.setRowNum((long) 1);
+ domainVo1.setAuditUserId(null);
+ domainVo1.setAuditTrail(null);
+
+ assertEquals(domainVo.getId(), domainVo1.getId());
+ assertEquals(domainVo.getCreated(), domainVo1.getCreated());
+ assertEquals(domainVo.getModified(), domainVo1.getModified());
+ assertEquals(domainVo.getCreatedId(), domainVo1.getCreatedId());
+ assertEquals(domainVo.getModifiedId(), domainVo1.getModifiedId());
+ assertEquals(domainVo.getRowNum(), domainVo1.getRowNum());
+ assertEquals(domainVo.getAuditUserId(), domainVo1.getAuditUserId());
+ assertEquals(domainVo.getAuditTrail(), domainVo1.getAuditTrail());
+ }
+
+ @Test
+ public void copyTest(){
+ DomainVo domainVo = mockDomainVO();
+ domainVo.copy(true);
+ }
+
+ @Test
+ public void equalTest(){
+ DomainVo domainVo1 = mockDomainVO();
+ DomainVo domainVo2 = mockDomainVO();
+ assertEquals(true, domainVo1.equals(domainVo2));
+ }
+
+ @Test
+ public void compareTest(){
+ DomainVo domainVo1 = mockDomainVO();
+ DomainVo domainVo2 = mockDomainVO();
+ assertEquals(0, domainVo1.compareTo(domainVo2));
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java
new file mode 100644
index 00000000..1f657e8d
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementDetailsTest.java
@@ -0,0 +1,64 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.ElementDetails;
+
+public class ElementDetailsTest {
+
+ public ElementDetails mockElementDetails(){
+ ElementDetails elementDetails = new ElementDetails("test","test","test","test","test","test","test","test","test","test");
+
+ elementDetails.setLogical_group("test");
+
+ return elementDetails;
+ }
+
+ @Test
+ public void elementDetailsTest(){
+ ElementDetails elementDetails = mockElementDetails();
+
+ ElementDetails elementDetails1 = new ElementDetails("test","test","test","test","test","test","test","test","test","test");
+ elementDetails1.setLogical_group("test");
+
+ assertEquals(elementDetails.getLogical_group(), elementDetails1.getLogical_group());
+ }
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java
new file mode 100644
index 00000000..d4dbed3e
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/ElementTest.java
@@ -0,0 +1,77 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Element;
+
+public class ElementTest {
+
+ public Element mockElement(){
+ Element element = new Element("test","test","test","test","test",null);
+
+ element.setId("test");
+ element.setName("test");
+ element.setTop(10);
+ element.setLeft(10);
+ element.setHeight(10);
+ element.setWidth(10);
+ element.setImgFileName("test");
+ element.setBorderType("test");
+ element.setBgColor("test");
+ element.setP(null);
+
+ return element;
+ }
+
+ @Test
+ public void elementTest(){
+ Element element = mockElement();
+
+ Element element1 = new Element("test","test","test","test","test",null);
+
+ assertEquals(element.getId(), element1.getId());
+ assertEquals(element.getName(), element1.getName());
+ assertEquals(element.getImgFileName(), element1.getImgFileName());
+ assertEquals(element.getBorderType(), element1.getBorderType());
+ assertEquals(element.getP(), element1.getP());
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java
new file mode 100644
index 00000000..ecaf9e54
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/FusionCommandTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.FusionCommand;
+
+public class FusionCommandTest {
+
+ public FusionCommand mockFusionCommand(){
+ FusionCommand fusionCommand = new FusionCommand();
+
+ fusionCommand.setTask("test");
+
+ return fusionCommand;
+ }
+
+ @Test
+ public void fusionCommandTest(){
+ FusionCommand fusionCommand = mockFusionCommand();
+
+ FusionCommand fusionCommand1 = new FusionCommand();
+ fusionCommand1.setTask("test");
+
+ assertEquals(fusionCommand.getTask(), fusionCommand1.getTask());
+ }
+
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java
new file mode 100644
index 00000000..d231703e
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/LayoutTest.java
@@ -0,0 +1,336 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Container;
+import org.onap.portalsdk.core.domain.support.Domain;
+import org.onap.portalsdk.core.domain.support.Layout;
+import org.onap.portalsdk.core.domain.support.Position;
+
+public class LayoutTest {
+
+ private static final double DELTA = 1e-15;
+
+ public Layout mockLayout(){
+ Layout layout = new Layout(null, 0, 0, 0, 0);
+
+ layout.setCollapsedDomainsNewList(null);
+ layout.setCollapsedDomains(null);
+ layout.setNumberofColsofDomains(0);
+ layout.setDomainRowCol(null);
+
+ return layout;
+ }
+
+ @Test
+ public void layoutTest(){
+ Layout layout = mockLayout();
+
+ Layout layout1 = new Layout(null, 0, 0, 0, 0);
+ layout1.setCollapsedDomainsNewList(null);
+ layout1.setCollapsedDomains(null);
+ layout1.setNumberofColsofDomains(0);
+ layout1.setDomainRowCol(null);
+
+ assertEquals(layout.getCollapsedDomains(), layout1.getCollapsedDomains());
+ assertEquals(layout.getCollapsedDomainsNewList(), layout1.getCollapsedDomainsNewList());
+ assertEquals(layout.getNumberofColsofDomains(), layout1.getNumberofColsofDomains());
+ assertEquals(layout.getDomainRowCol(), layout1.getDomainRowCol());
+ }
+
+ @Test
+ public void computeDomainPositionsTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+ Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ List<Domain> domainList = new ArrayList<>();
+ domainList.add(domain);
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.setCollapsedDomainsNewList(domainList);
+ layout.computeDomainPositions();
+ assertEquals(5.0, layout.getDomainRowCol().get("00").getP().getY(), DELTA);
+ }
+
+ @Test
+ public void computeDomainPositionsModifiedTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+ Domain domain = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ container00.setP(position);
+ containerRowCol.put("00", container00);
+ domain.setContainers(containerRowCol);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ List<Domain> domainList = new ArrayList<>();
+ domainList.add(domain);
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.setCollapsedDomainsNewList(domainList);
+ layout.computeDomainPositionsModified();
+ assertEquals(5.0, layout.getDomainRowCol().get("00").getP().getY(), DELTA);
+ }
+
+ @Test
+ public void collapseDomainModifiedTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ container00.setP(position);
+ containerRowCol.put("00", container00);
+ containerRowCol.put("01", container00);
+ domain.setContainers(containerRowCol);
+ domain2.setContainers(containerRowCol);
+ domain.setIndexChanged(true);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain2);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.collapseDomainModified("XYZ");
+ assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA);
+ }
+
+ @Test
+ public void collapseDomainNewTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ container00.setP(position);
+ containerRowCol.put("00", container00);
+ containerRowCol.put("01", container00);
+ domain.setContainers(containerRowCol);
+ domain2.setContainers(containerRowCol);
+ domain.setIndexChanged(true);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain2);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.collapseDomainNew("XYZ");
+ assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA);
+ }
+
+ @Test
+ public void collapseDomainTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Domain domain2 = new Domain("test", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ container00.setP(position);
+ containerRowCol.put("00", container00);
+ containerRowCol.put("01", container00);
+ domain.setContainers(containerRowCol);
+ domain.setP(position);
+ domain2.setP(position);
+ domain2.setContainers(containerRowCol);
+ domain.setIndexChanged(true);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+ domainRowCol.put("01", domain2);
+ domainRowCol.put("10", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.collapseDomain("XYZ");
+ assertEquals(5.0, layout.getDomainRowCol().get("10").getP().getY(), DELTA);
+ }
+
+
+ @Test
+ public void uncollapseDomainModifiedTest(){
+
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ domain.setP(position);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+
+ Map<String, Container> innerContainerRowCol = new HashMap<>();
+ Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10);
+ innerContainerRowCol.put("00", innerContainer);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setInnerContainer(innerContainerRowCol);
+ containerRowCol.put("00", container00);
+
+ domain.setContainers(containerRowCol);
+
+ Map<String, Domain> originalDomainRowCol = new HashMap<>();
+ originalDomainRowCol.put("00", domain);
+
+ layout.setDomainRowCol(domainRowCol);
+ layout.setCollapsedDomains(originalDomainRowCol);
+
+ layout.uncollapseDomainModified("XYZ");
+ assertEquals(3, layout.getNumberofColsofDomains(), DELTA);
+
+ }
+
+
+ @Test
+ public void uncollapseDomainTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ domain.setP(position);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+
+ Map<String, Container> innerContainerRowCol = new HashMap<>();
+ Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10);
+ innerContainerRowCol.put("00", innerContainer);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setInnerContainer(innerContainerRowCol);
+ containerRowCol.put("00", container00);
+
+ domain.setContainers(containerRowCol);
+
+ Map<String, Domain> originalDomainRowCol = new HashMap<>();
+ originalDomainRowCol.put("00", domain);
+
+ layout.setDomainRowCol(domainRowCol);
+ layout.setCollapsedDomains(originalDomainRowCol);
+
+ layout.uncollapseDomain("XYZ");
+ assertEquals(10.6, layout.getDomainRowCol().get("00").getP().getX(), DELTA);
+ }
+
+ @Test
+ public void uncollapseDomainNewTest(){
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ domain.setP(position);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+
+ Map<String, Container> innerContainerRowCol = new HashMap<>();
+ Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10);
+ innerContainerRowCol.put("00", innerContainer);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setInnerContainer(innerContainerRowCol);
+ containerRowCol.put("00", container00);
+
+ domain.setContainers(containerRowCol);
+
+ Map<String, Domain> originalDomainRowCol = new HashMap<>();
+ originalDomainRowCol.put("00", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.collapseDomain("XYZ");
+ layout.uncollapseDomainNew("XYZ");
+ assertEquals(11.0, layout.getDomainRowCol().get("00").getP().getX(), DELTA);
+ }
+
+ @Test
+ public void uncollapseDomainNew1Test(){
+
+ Layout layout = new Layout(null, 0, 0, 2, 2);
+
+ Domain domain = new Domain("test1", "XYZ", 0, 0, 0, 0, 0, 2, 2);
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+ domain.setP(position);
+ Map<String, Domain> domainRowCol = new HashMap<>();
+ domainRowCol.put("00", domain);
+
+ Map<String, Container> innerContainerRowCol = new HashMap<>();
+ Container innerContainer = new Container("test","test",1,1,10,10,10,10,10,10);
+ innerContainerRowCol.put("00", innerContainer);
+
+ Map<String, Container> containerRowCol = new HashMap<>();
+ Container container00 = new Container("test","test",1,1,10,10,10,10,10,10);
+ container00.setInnerContainer(innerContainerRowCol);
+ containerRowCol.put("00", container00);
+
+ domain.setContainers(containerRowCol);
+
+ Map<String, Domain> originalDomainRowCol = new HashMap<>();
+ originalDomainRowCol.put("00", domain);
+ layout.setDomainRowCol(domainRowCol);
+ layout.collapseDomain("XYZ");
+ layout.uncollapseDomainNew1("XYZ");
+ assertEquals(11.0, layout.getDomainRowCol().get("00").getP().getX(), DELTA);
+
+ }
+
+}
+
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java
new file mode 100644
index 00000000..84720021
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/NameValueIdTest.java
@@ -0,0 +1,82 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.DomainVo;
+import org.onap.portalsdk.core.domain.support.NameValueId;
+
+public class NameValueIdTest {
+
+ public NameValueId mockNameValueId(){
+ NameValueId nameValueId = new NameValueId("test","test");
+
+ nameValueId.setLab("test");
+ nameValueId.setVal("test");
+
+ return nameValueId;
+ }
+
+ @Test
+ public void nameValueIdTest(){
+ NameValueId nameValueId = mockNameValueId();
+
+ NameValueId nameValueId1 = new NameValueId("test","test");
+ nameValueId1.setLab("test");
+ nameValueId1.setVal("test");
+
+ assertEquals(nameValueId.getLab(), nameValueId1.getLab());
+ assertEquals(nameValueId.getVal(), nameValueId1.getVal());
+ }
+
+ @Test
+ public void equalsTest(){
+ NameValueId nameValueId1 = mockNameValueId();
+ NameValueId nameValueId2 = mockNameValueId();
+ assertEquals(true, nameValueId1.equals(nameValueId2));
+ }
+
+ @Test
+ public void hashCodeTest(){
+ NameValueId nameValueId1 = mockNameValueId();
+ assertNotNull(nameValueId1.hashCode());
+ }
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java
new file mode 100644
index 00000000..e75f1d10
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/PositionTest.java
@@ -0,0 +1,68 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Position;
+
+public class PositionTest {
+
+ private static final double DELTA = 1e-15;
+
+ public Position mockPosition(){
+ Position position = new Position();
+ position.setX(10);
+ position.setY(10);
+
+ return position;
+ }
+
+ @Test
+ public void positionTest(){
+ Position position = mockPosition();
+
+ Position position1 = new Position();
+ position1.setX(10);
+ position1.setY(10);
+
+ assertEquals(position.getX(), position1.getX(), DELTA);
+ assertEquals(position.getY(), position1.getY(), DELTA);
+ }
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java
new file mode 100644
index 00000000..3ae57e39
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/domain/support/SizeTest.java
@@ -0,0 +1,69 @@
+/*
+ * ============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.domain.support;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.domain.support.Size;
+
+public class SizeTest {
+
+ private static final double DELTA = 1e-15;
+
+ public Size mockSize(){
+ Size size = new Size();
+ size.setHeight(10);
+ size.setWidth(10);
+
+ return size;
+ }
+
+ @Test
+ public void sizeTest(){
+ Size size = mockSize();
+
+ Size size1 = new Size();
+ size1.setHeight(10);
+ size1.setWidth(10);
+
+ assertEquals(size.getHeight(), size1.getHeight(), DELTA);
+ assertEquals(size.getWidth(), size1.getWidth(), DELTA);
+ }
+
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/sdkapp/core/onboarding/client/AppContextManagerTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/sdkapp/core/onboarding/client/AppContextManagerTest.java
new file mode 100644
index 00000000..ca8222e5
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/sdkapp/core/onboarding/client/AppContextManagerTest.java
@@ -0,0 +1,64 @@
+/*
+ * ============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.sdkapp.core.onboarding.client;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.onap.portalsdk.core.onboarding.client.AppContextManager;
+
+public class AppContextManagerTest {
+
+ public AppContextManager mockAppContextManager(){
+
+ AppContextManager appContextManager = new AppContextManager();
+ appContextManager.setApplicationContext(null);
+
+ return appContextManager;
+ }
+
+ @Test
+ public void appContextManagerTest(){
+ AppContextManager appContextManager = mockAppContextManager();
+
+ AppContextManager appContextManager1 = new AppContextManager();
+
+ assertEquals(appContextManager.getAppContext(), appContextManager1.getAppContext());
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-fw/pom.xml b/ecomp-sdk/epsdk-fw/pom.xml
index 2eb62648..15424eee 100644
--- a/ecomp-sdk/epsdk-fw/pom.xml
+++ b/ecomp-sdk/epsdk-fw/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
</parent>
<!-- GroupId is inherited from parent -->
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/IPortalRestCentralService.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/IPortalRestCentralService.java
new file mode 100644
index 00000000..3438e787
--- /dev/null
+++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/IPortalRestCentralService.java
@@ -0,0 +1,103 @@
+/*
+ * ============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.onboarding.crossapi;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
+import org.onap.portalsdk.core.restful.domain.EcompUser;
+
+public interface IPortalRestCentralService {
+
+ /**
+ * Gets and returns the Map with username, password and appName of application .If any error
+ * occurs, the method should throw PortalApiException with an appropriate
+ * message. The FW library will catch the exception and send an appropriate
+ * response to Portal.
+ *
+ * @return a map with keys username, password and appName
+ */
+ public Map<String, String> getAppCredentials() throws PortalAPIException;
+
+ /**
+ * Creates a user with the specified details. If any error occurs, for example
+ * the user exists, the method should throw PortalApiException with an
+ * appropriate message. The FW library will catch the exception and send an
+ * appropriate response to Portal.
+ *
+ * @param user
+ * Model object with attributes of user to be created.
+ * @throws PortalAPIException
+ * If any error occurs while processing the request; for example,
+ * user exists.
+ */
+ public void pushUser(EcompUser user) throws PortalAPIException;
+
+ /**
+ * Updates details about the user with the specified loginId. For example, mark
+ * user as inactive. If any error occurs, the method should throw
+ * PortalApiException with an appropriate message. The FW library will catch the
+ * exception and send an appropriate response to Portal.
+ *
+ * @param loginId
+ * EcompUser ID to be updated.
+ * @param user
+ * Model object with attributes of user to be updated.
+ * @throws PortalAPIException
+ * If any error occurs while processing the request; for example,
+ * unknown user.
+ */
+ public void editUser(String loginId, EcompUser user) throws PortalAPIException;
+
+ /**
+ * Gets and returns the userId for the logged-in user based on the request. If
+ * any error occurs, the method should throw PortalApiException with an
+ * appropriate message. The FW library will catch the exception and send an
+ * appropriate response to Portal.
+ *
+ * @param request
+ * HttpServletRequest
+ * @return true if the request contains appropriate credentials, else false.
+ * @throws PortalAPIException
+ * If an unexpected error occurs while processing the request.
+ */
+ public String getUserId(HttpServletRequest request) throws PortalAPIException;
+
+}
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java
new file mode 100644
index 00000000..732383b0
--- /dev/null
+++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java
@@ -0,0 +1,200 @@
+/*
+ * ============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.onboarding.crossapi;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+
+import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
+import org.onap.portalsdk.core.onboarding.rest.RestWebServiceClient;
+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.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
+public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService {
+
+ private static final Log logger = LogFactory.getLog(PortalRestAPICentralServiceImpl.class);
+ private String username;
+ private String password;
+ private String appName;
+ IPortalRestCentralService portalRestCentralService;
+
+ public PortalRestAPICentralServiceImpl() throws ServletException {
+ String centralClassName = PortalApiProperties.getProperty(PortalApiConstants.PORTAL_API_IMPL_CLASS);
+ if (centralClassName == null)
+ throw new ServletException(
+ "init: Failed to find class name property " + PortalApiConstants.PORTAL_API_IMPL_CLASS);
+ try {
+ Class<?> centralImplClass = Class.forName(centralClassName);
+ portalRestCentralService = (IPortalRestCentralService) (centralImplClass.getConstructor().newInstance());
+ username = portalRestCentralService.getAppCredentials().get("username");
+ password = portalRestCentralService.getAppCredentials().get("password");
+ appName = portalRestCentralService.getAppCredentials().get("appName");
+ } catch (Exception e) {
+ throw new ClassCastException("Failed to find or instantiate class ");
+ }
+ }
+
+ private final ObjectMapper mapper = new ObjectMapper();
+
+ @Override
+ public void pushUser(EcompUser user) throws PortalAPIException {
+ portalRestCentralService.pushUser(user);
+ }
+
+ @Override
+ public void editUser(String loginId, EcompUser user) throws PortalAPIException {
+ portalRestCentralService.editUser(loginId, user);
+ }
+
+ @Override
+ public EcompUser getUser(String loginId) throws PortalAPIException {
+ EcompUser user = new EcompUser();
+ String responseString = null;
+ try {
+ responseString = RestWebServiceClient.getInstance().getPortalContent("/ecompUser/" + loginId, null,
+ appName, null, username, password, true);
+ logger.debug("responseString is: " + responseString);
+ user = mapper.readValue(responseString, EcompUser.class);
+
+ } catch (IOException e) {
+ String response = "PortalRestAPICentralServiceImpl.getUser failed";
+ logger.error(response, e);
+ throw new PortalAPIException(response, e);
+ }
+ return user;
+ }
+
+ @Override
+ public List<EcompUser> getUsers() throws PortalAPIException {
+ List<EcompUser> usersList = new ArrayList<>();
+ String responseString = null;
+ try {
+ responseString = RestWebServiceClient.getInstance().getPortalContent("/users", null, appName, null,
+ username, password, true);
+ logger.debug("responseString is: " + responseString);
+ usersList = mapper.readValue(responseString,
+ TypeFactory.defaultInstance().constructCollectionType(List.class, EcompUser.class));
+
+ } catch (IOException e) {
+ String response = "PortalRestAPICentralServiceImpl.getUsers failed";
+ logger.error(response, e);
+ throw new PortalAPIException(response, e);
+ }
+ return usersList;
+ }
+
+ @Override
+ public List<EcompRole> getAvailableRoles(String requestedLoginId) throws PortalAPIException {
+ List<EcompRole> rolesList = new ArrayList<>();
+ String responseString = null;
+ try {
+ responseString = RestWebServiceClient.getInstance().getPortalContent("/ecompRoles", requestedLoginId,
+ appName, null, username, password, true);
+ logger.debug("responseString is: " + responseString);
+ rolesList = mapper.readValue(responseString,
+ TypeFactory.defaultInstance().constructCollectionType(List.class, EcompRole.class));
+
+ } catch (IOException e) {
+ String response = "PortalRestAPICentralServiceImpl.getUsers failed";
+ logger.error(response, e);
+ throw new PortalAPIException(response, e);
+ }
+ return rolesList;
+ }
+
+ @Override
+ public void pushUserRole(String loginId, List<EcompRole> roles) throws PortalAPIException {
+ throw new PortalAPIException("Please use Portal for Role Management");
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<EcompRole> getUserRoles(String loginId) throws PortalAPIException {
+ List<EcompRole> userRoles = new ArrayList<>();
+ EcompUser user = new EcompUser();
+ String responseString = null;
+ try {
+ responseString = RestWebServiceClient.getInstance().getPortalContent("/ecompUser/" + loginId, null,
+ appName, null, username, password, true);
+ logger.debug("responseString is: " + responseString);
+ user = mapper.readValue(responseString, EcompUser.class);
+ Set roles = user.getRoles();
+ userRoles = (List<EcompRole>) roles.stream().collect(Collectors.toList());
+
+ } catch (IOException e) {
+ String response = "PortalRestAPICentralServiceImpl.getUserRoles failed";
+ logger.error(response, e);
+ throw new PortalAPIException(response, e);
+ }
+ return userRoles;
+ }
+
+ @Override
+ public boolean isAppAuthenticated(HttpServletRequest request) throws PortalAPIException {
+ boolean response = false;
+ try {
+ String restUser = request.getHeader("username");
+ String restPw = request.getHeader("password");
+ response = restUser != null && restPw != null && restUser.equals(username) && restPw.equals(password);
+ logger.debug("isAppAuthenticated: " + response);
+ } catch (Exception ex) {
+ throw new PortalAPIException("isAppAuthenticated failed", ex);
+ }
+ return response;
+ }
+
+ @Override
+ public String getUserId(HttpServletRequest request) throws PortalAPIException {
+ return portalRestCentralService.getUserId(request);
+ }
+
+}
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 2ceb8e7c..810771bd 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
@@ -126,7 +126,11 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
try {
logger.debug("init: creating instance of class " + className);
Class<?> implClass = Class.forName(className);
- portalRestApiServiceImpl = (IPortalRestAPIService) (implClass.getConstructor().newInstance());
+ if (!isCentralized.equals(isAccessCentralized))
+ portalRestApiServiceImpl = (IPortalRestAPIService) (implClass.getConstructor().newInstance());
+ else {
+ portalRestApiServiceImpl = new PortalRestAPICentralServiceImpl();
+ }
} catch (Exception ex) {
throw new ServletException("init: Failed to find or instantiate class " + className, ex);
}
@@ -243,17 +247,12 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
// Example: /user <-- create user
if (requestUri.endsWith(PortalApiConstants.API_PREFIX + "/user")) {
try {
- 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);
- }
+ 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);
@@ -264,17 +263,12 @@ 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 {
- 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);
- }
+ 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);
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/PortalApiConstants.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/PortalApiConstants.java
index eb931f5c..e27cbbff 100644
--- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/PortalApiConstants.java
+++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/PortalApiConstants.java
@@ -80,4 +80,6 @@ public interface PortalApiConstants {
public static final String EXT_REQUEST_CONNECTION_TIMEOUT = "ext_req_connection_timeout";
public static final String EXT_REQUEST_READ_TIMEOUT = "ext_req_read_timeout";
+ public static final String ROLE_ACCESS_CENTRALIZED_FLAG = "role_access_centralized";
+
}
diff --git a/ecomp-sdk/epsdk-workflow/pom.xml b/ecomp-sdk/epsdk-workflow/pom.xml
index c187fe1a..9b6eb630 100644
--- a/ecomp-sdk/epsdk-workflow/pom.xml
+++ b/ecomp-sdk/epsdk-workflow/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
</parent>
<!-- GroupId is inherited from parent -->
diff --git a/ecomp-sdk/pom.xml b/ecomp-sdk/pom.xml
index 9046f458..a06b22db 100644
--- a/ecomp-sdk/pom.xml
+++ b/ecomp-sdk/pom.xml
@@ -14,7 +14,7 @@
<!-- Portal SDK Maven parent project -->
<groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-project</artifactId>
- <version>2.1.0</version>
+ <version>2.2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>portal-sdk</name>
<url>https://wiki.onap.org/display/DW/Portal</url>