diff options
author | Christopher Lott (cl778h) <clott@research.att.com> | 2017-09-28 11:18:14 -0400 |
---|---|---|
committer | Christopher Lott (cl778h) <clott@research.att.com> | 2017-09-28 11:27:51 -0400 |
commit | 51d83152697da4f2ef2242471ee43f36e6b64300 (patch) | |
tree | 0e4bae37088950b1ab724d6f237cd5437c7f8fee | |
parent | 1b29c0944a7eba1c88cfd25c94e4dd7ed0f82dc7 (diff) |
Update license; improve coverage; add docs dir
Update licenses to match approved text; add where missing.
Improve code coverage with additional tests.
Use OParent.
Drop ecomp-portal-BE-common-test entirely; tests merged to ecomp-portal-BE-common.
All code from LF repo branch master_dev_amsterdam_1_3_0
Issue: PORTAL-42, PORTAL-50, PORTAL-90, PORTAL-96
Change-Id: I09d98bbf072411d2efed6fb34f378f7cc8d049ad
Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
675 files changed, 20833 insertions, 20164 deletions
@@ -3,3 +3,4 @@ /.settings /dmaapbc /sdk +/target diff --git a/deliveries/.env b/deliveries/.env index eb7f33ca..180ea1f1 100644 --- a/deliveries/.env +++ b/deliveries/.env @@ -13,6 +13,6 @@ DB_IMG_NAME=portal-db WMS_IMG_NAME=portal-wms # Tag all images with this -PORTAL_TAG=1.1.0 +PORTAL_TAG=1.3.0 NEXUS_REPO=nexus3.onap.org:10003 diff --git a/deliveries/docker-compose.yml b/deliveries/docker-compose.yml index 2b33c8ee..d32a4050 100644 --- a/deliveries/docker-compose.yml +++ b/deliveries/docker-compose.yml @@ -1,15 +1,14 @@ # docker-compose for ONAP portal containers: database, microservice, portal apps. -# Only exposes the portal apps on host network, not the database or WMS. -# Works in multiple environments; does not pull from a Nexus repository. # Relies on .env file in current directory. +# Works in multiple environments; does not pull from a Nexus registry. +# Exposes the portal apps docker (but not DB nor WMS dockers) on the host network. +# Images must be pulled from ONAP Nexus registry after logging in like this: +# docker login -u USER -p PASS nexus3.onap.org:10001 version: '2.0' services: - # Available from ONAP Nexus repository: - # docker login -u USER -p PASS nexus3.onap.org:10001 - # docker pull nexus3.onap.org:10001/onap/cli:1.1-STAGING-latest cli: image: onap/cli:${PORTAL_TAG} environment: diff --git a/deliveries/os_docker_push.sh b/deliveries/os_docker_push.sh index eb663b83..30bd3dc7 100755 --- a/deliveries/os_docker_push.sh +++ b/deliveries/os_docker_push.sh @@ -5,7 +5,7 @@ set -x TIMESTAMP=$(date +%C%y%m%dT%H%M%S) -export VERSION="1.1.0-SNAPSHOT-${TIMESTAMP}" +export VERSION="1.3.0-SNAPSHOT-${TIMESTAMP}" export LATEST="latest" exec ./os_docker_base.sh diff --git a/deliveries/os_docker_release.sh b/deliveries/os_docker_release.sh index 42825534..45a14507 100755 --- a/deliveries/os_docker_release.sh +++ b/deliveries/os_docker_release.sh @@ -5,7 +5,7 @@ set -x TIMESTAMP=$(date +%C%y%m%dT%H%M%S) -export VERSION="1.1.0-STAGING-${TIMESTAMP}" -export LATEST="1.1-STAGING-latest" +export VERSION="1.3.0-STAGING-${TIMESTAMP}" +export LATEST="1.3-STAGING-latest" exec ./os_docker_base.sh diff --git a/doc/dummy.txt b/docs/index.rst index 9d13cbbf..9d13cbbf 100644 --- a/doc/dummy.txt +++ b/docs/index.rst diff --git a/ecomp-portal-BE-common-test/.gitignore b/ecomp-portal-BE-common-test/.gitignore deleted file mode 100644 index 6b3b3ef1..00000000 --- a/ecomp-portal-BE-common-test/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -/.classpath -/.project -/.settings/ -/bin/ -/java/ -/debug/ -/debug/logs/ -/target/ diff --git a/ecomp-portal-BE-common-test/README.md b/ecomp-portal-BE-common-test/README.md deleted file mode 100644 index 5a1021ed..00000000 --- a/ecomp-portal-BE-common-test/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# ECOMP Portal Web Application Tests - -## Overview - -This is a Maven project with the ECOMP Portal web application back-end test files -containing test cases for controllers, interceptors and other Java classes. -Use Apache Maven to build. - -## Release Notes - -Version 1.1.0, November 2017 -- Initial release diff --git a/ecomp-portal-BE-common-test/license/licenses.properties b/ecomp-portal-BE-common-test/license/licenses.properties deleted file mode 100644 index 4b0e28e7..00000000 --- a/ecomp-portal-BE-common-test/license/licenses.properties +++ /dev/null @@ -1 +0,0 @@ -my_license=My license diff --git a/ecomp-portal-BE-common-test/license/my_license/header.txt b/ecomp-portal-BE-common-test/license/my_license/header.txt deleted file mode 100644 index c026b6b7..00000000 --- a/ecomp-portal-BE-common-test/license/my_license/header.txt +++ /dev/null @@ -1,11 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/ecomp-portal-BE-common-test/license/my_license/license.txt b/ecomp-portal-BE-common-test/license/my_license/license.txt deleted file mode 100644 index bf326153..00000000 --- a/ecomp-portal-BE-common-test/license/my_license/license.txt +++ /dev/null @@ -1,4 +0,0 @@ -name=my_license -description=<null> -licenseURL=<null> -headerURL=<null>
\ No newline at end of file diff --git a/ecomp-portal-BE-common-test/pom.xml b/ecomp-portal-BE-common-test/pom.xml deleted file mode 100644 index afdf35ac..00000000 --- a/ecomp-portal-BE-common-test/pom.xml +++ /dev/null @@ -1,116 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.onap.portal</groupId> - <artifactId>ecomp-portal-BE-common-test</artifactId> - <version>1.3.0-SNAPSHOT</version> - <packaging>jar</packaging> - <name>ecompportal-be-common-test</name> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <!-- <skipTests>true</skipTests> --> - <sonar.exclusions>**.js</sonar.exclusions> - </properties> - - <build> - <sourceDirectory>src/main/java</sourceDirectory> - <!-- The war file name carries no version number --> - <finalName>${project.artifactId}</finalName> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <artifactId>maven-war-plugin</artifactId> - <version>2.6</version> - <configuration> - <skipTests>true</skipTests> - <failOnMissingWebXml>false</failOnMissingWebXml> - <archive> - <manifest> - <addDefaultImplementationEntries>true</addDefaultImplementationEntries> - </manifest> - <manifestEntries> - <Build-Number>${project.version}.${build.number}</Build-Number> - <Build-Time>${maven.build.timestamp}</Build-Time> - </manifestEntries> - </archive> - <overlays> - <!-- specify the order in which these should be applied --> - <overlay> - <groupId>org.openecomp.portal</groupId> - <artifactId>ecompportal-be-common</artifactId> - </overlay> - </overlays> - </configuration> - </plugin> - <!-- No deployment step for this project --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-deploy-plugin</artifactId> - <version>2.8</version> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - </plugins> - - <resources> - <resource> - <directory>src/test/java</directory> - <includes> - <include>**/*Test*.*</include> - </includes> - </resource> - <resource> - <directory>src/main/resources</directory> - <includes> - <include>**/**</include> - </includes> - </resource> - </resources> - </build> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.11</version> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito</artifactId> - <version>1.6.1</version> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-core</artifactId> - <version>1.6.1</version> - </dependency> - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-module-junit4</artifactId> - <version>1.6.1</version> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>1.8.5</version> - </dependency> - <dependency> - <groupId>org.onap.portal</groupId> - <artifactId>ecompportal-be-common</artifactId> - <version>${project.version}</version> - <type>jar</type> - <classifier>classes</classifier> - </dependency> - </dependencies> - -</project> diff --git a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCatalogItemTest.java b/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCatalogItemTest.java deleted file mode 100644 index 6fb89146..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCatalogItemTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.openecomp.portalapp.portal.ecomp.test.model; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem; - -public class AppCatalogItemTest { - - public AppCatalogItem mockAppCatalogItem(){ - AppCatalogItem appCatalogItem = new AppCatalogItem(); - - appCatalogItem.setAlternateUrl("test"); - appCatalogItem.setMlAppName("test"); - - return appCatalogItem; - } - - @Test - public void appCatalogItemTest(){ - AppCatalogItem appCatalogItem = mockAppCatalogItem(); - - AppCatalogItem appCatalogItem1 = new AppCatalogItem(); - appCatalogItem1.setAlternateUrl("test"); - appCatalogItem1.setMlAppName("test"); - - assertEquals(appCatalogItem.getAlternateUrl(), appCatalogItem1.getAlternateUrl()); - assertEquals(appCatalogItem.getMlAppName(), appCatalogItem1.getMlAppName()); - - assertEquals(appCatalogItem.toString(), "AppCatalogItem [id=null, name=null, access=null, select=null, pending=null]"); - assertEquals(appCatalogItem.hashCode(), appCatalogItem1.hashCode()); - assertTrue(appCatalogItem.equals(appCatalogItem1)); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCategoryFunctionsItemTest.java b/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCategoryFunctionsItemTest.java deleted file mode 100644 index 74e74b37..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppCategoryFunctionsItemTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.openecomp.portalapp.portal.ecomp.test.model; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; - -public class AppCategoryFunctionsItemTest { - - public AppCategoryFunctionsItem mockAppCategoryFunctionsItem(){ - AppCategoryFunctionsItem appCategoryFunctionsItem = new AppCategoryFunctionsItem(); - - appCategoryFunctionsItem.setRowId("test"); - appCategoryFunctionsItem.setAppId("test"); - appCategoryFunctionsItem.setApplication("test"); - appCategoryFunctionsItem.setFunctions("test"); - - return appCategoryFunctionsItem; - } - - @Test - public void appCategoryFunctionsItemTest(){ - AppCategoryFunctionsItem appCategoryFunctionsItem = mockAppCategoryFunctionsItem(); - - AppCategoryFunctionsItem appCategoryFunctionsItem1 = new AppCategoryFunctionsItem(); - - appCategoryFunctionsItem1.setRowId("test"); - appCategoryFunctionsItem1.setAppId("test"); - appCategoryFunctionsItem1.setApplication("test"); - appCategoryFunctionsItem1.setFunctions("test"); - - assertEquals(appCategoryFunctionsItem.getRowId(), appCategoryFunctionsItem1.getRowId()); - assertEquals(appCategoryFunctionsItem.getAppId(), appCategoryFunctionsItem1.getAppId()); - assertEquals(appCategoryFunctionsItem.getApplication(), appCategoryFunctionsItem1.getApplication()); - assertEquals(appCategoryFunctionsItem.getFunctions(), appCategoryFunctionsItem1.getFunctions()); - assertEquals(appCategoryFunctionsItem.toString(), "AppCategoryFunctionsItem [rowId=test, appId=test, application=test, category=null, functions=test]"); - assertEquals(appCategoryFunctionsItem.hashCode(), appCategoryFunctionsItem1.hashCode()); - assertTrue(appCategoryFunctionsItem.equals(appCategoryFunctionsItem1)); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppContactUsItemTest.java b/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppContactUsItemTest.java deleted file mode 100644 index 41539282..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/AppContactUsItemTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.openecomp.portalapp.portal.ecomp.test.model; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem; - -public class AppContactUsItemTest { - - public AppContactUsItem mockAppContactUsItem(){ - AppContactUsItem appContactUsItem = new AppContactUsItem(); - - appContactUsItem.setAppId((long)1); - appContactUsItem.setAppName("test"); - appContactUsItem.setDescription("test"); - appContactUsItem.setContactName("test"); - appContactUsItem.setContactEmail("test"); - appContactUsItem.setUrl("test"); - appContactUsItem.setActiveYN("test"); - - return appContactUsItem; - } - - @Test - public void appContactUsItemTest(){ - AppContactUsItem appContactUsItem = mockAppContactUsItem(); - - AppContactUsItem appContactUsItem1 = new AppContactUsItem(); - appContactUsItem1.setAppId((long)1); - appContactUsItem1.setAppName("test"); - appContactUsItem1.setDescription("test"); - appContactUsItem1.setContactName("test"); - appContactUsItem1.setContactEmail("test"); - appContactUsItem1.setUrl("test"); - appContactUsItem1.setActiveYN("test"); - - assertEquals(appContactUsItem.getAppId(), appContactUsItem1.getAppId()); - assertEquals(appContactUsItem.getAppName(), appContactUsItem1.getAppName()); - assertEquals(appContactUsItem.getDescription(), appContactUsItem1.getDescription()); - assertEquals(appContactUsItem.getContactName(), appContactUsItem1.getContactName()); - assertEquals(appContactUsItem.getContactEmail(), appContactUsItem1.getContactEmail()); - assertEquals(appContactUsItem.getUrl(), appContactUsItem1.getUrl()); - assertEquals(appContactUsItem.getActiveYN(), appContactUsItem1.getActiveYN()); - assertEquals(appContactUsItem.toString(), "AppContactUsItem [appId=1, appName=test, description=test, contactName=test, contactEmail=test, url=test, activeYN=test]"); - assertEquals(appContactUsItem.hashCode(), appContactUsItem1.hashCode()); - assertTrue(appContactUsItem.equals(appContactUsItem1)); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/SearchResultItemTest.java b/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/SearchResultItemTest.java deleted file mode 100644 index 97e3be6c..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/com/openecomp/portalapp/portal/ecomp/test/model/SearchResultItemTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.openecomp.portalapp.portal.ecomp.test.model; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem; - -public class SearchResultItemTest { - - public SearchResultItem mockSearchResultItem(){ - SearchResultItem searchResultItem = new SearchResultItem(); - - searchResultItem.setRowId("test"); - searchResultItem.setCategory("test"); - searchResultItem.setName("test"); - searchResultItem.setTarget("test"); - searchResultItem.setUuid("test"); - - return searchResultItem; - } - - @Test - public void searchResultItemTest(){ - SearchResultItem searchResultItem = mockSearchResultItem(); - - SearchResultItem searchResultItem1 = new SearchResultItem(); - searchResultItem1.setRowId("test"); - searchResultItem1.setCategory("test"); - searchResultItem1.setName("test"); - searchResultItem1.setTarget("test"); - searchResultItem1.setUuid("test"); - - assertEquals(searchResultItem.getRowId(), searchResultItem.getRowId()); - assertEquals(searchResultItem.getCategory(), searchResultItem.getCategory()); - assertEquals(searchResultItem.getName(), searchResultItem.getName()); - assertEquals(searchResultItem.getTarget(), searchResultItem.getTarget()); - assertEquals(searchResultItem.getUuid(), searchResultItem.getUuid()); - assertEquals(searchResultItem.toString(), searchResultItem.toString()); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImplTest.java deleted file mode 100644 index 23e4c28e..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImplTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.openecomp.portalapp.lm; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.Test; - -public class FusionLicenseManagerImplTest { - - - @Test - public void FusionLicenseManagerImplTest(){ - FusionLicenseManagerImpl fusionLicenseManagerImpl = new FusionLicenseManagerImpl(); - - String nvlReturn = null; - - int installLicenseInt = fusionLicenseManagerImpl.installLicense(); - nvlReturn = fusionLicenseManagerImpl.nvl("test"); - Date expiredDateReturn = fusionLicenseManagerImpl.getExpiredDate(); - - assertEquals(installLicenseInt, 0); - assertEquals(nvlReturn, null); - assertEquals(expiredDateReturn, null); - - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImplTest.java deleted file mode 100644 index 1d9f4a64..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImplTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.openecomp.portalapp.lm; - -import static org.junit.Assert.assertEquals; - -import java.io.FileNotFoundException; - -import org.junit.Test; - -public class LicenseableClassImplTest { - - @Test - public void licenseableClassImplTest() throws FileNotFoundException{ - LicenseableClassImpl licenseableClassImpl = new LicenseableClassImpl(); - - String appNameReturn = licenseableClassImpl.getApplicationName(); - java.io.InputStream inputStream = licenseableClassImpl.getPublicKeystoreAsInputStream(); - String aliasReturn = licenseableClassImpl.getAlias(); - String pswdReturn = licenseableClassImpl.getKeyPasswd(); - String pkPswd = licenseableClassImpl.getPublicKeystorePassword(); - String cpPswd = licenseableClassImpl.getCipherParamPassword(); - - assertEquals(appNameReturn, ""); - assertEquals(inputStream, null); - assertEquals(aliasReturn, ""); - assertEquals(pswdReturn, ""); - assertEquals(pkPswd, ""); - assertEquals(cpPswd, ""); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppCatalogControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppCatalogControllerTest.java deleted file mode 100644 index 23cb7a45..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppCatalogControllerTest.java +++ /dev/null @@ -1,263 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -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.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.controller.AppCatalogController; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.AppCatalogItem; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.EPAppCommonServiceImpl; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.service.PersUserAppService; -import org.openecomp.portalapp.portal.service.PersUserAppServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.AppCatalogPersonalization; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FieldsValidator.FieldName; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.util.SystemProperties; - -public class AppCatalogControllerTest extends MockitoTestSuite { - - @Mock - AdminRolesService adminRolesService = new AdminRolesServiceImpl(); - - @Mock - EPAppService appService = new EPAppCommonServiceImpl(); - - @InjectMocks - AppCatalogController appCatalogController = new AppCatalogController(); - - PersUserAppService persUserAppService = Mockito.spy(new PersUserAppServiceImpl()); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - - @Mock - EPUser epuser; - - NullPointerException nullPointerException = new NullPointerException(); - - MockEPUser mockUser = new MockEPUser(); - - public AppCatalogItem mockAppCatalogItem() { - AppCatalogItem appCatalogItem = new AppCatalogItem(); - appCatalogItem.setId((long) 1); - appCatalogItem.setName("Ecomp Portal"); - appCatalogItem.setImageUrl("Test_URL"); - appCatalogItem.setDescription("Testing"); - appCatalogItem.setNotes("Test"); - appCatalogItem.setUrl("test"); - appCatalogItem.setAlternateUrl("test"); - appCatalogItem.setRestricted(false); - appCatalogItem.setOpen(false); - appCatalogItem.setAccess(true); - appCatalogItem.setSelect(true); - appCatalogItem.setPending(false); - - return appCatalogItem; - } - - @Test - public void getAppCatalogTestIfUserNotAdmin() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<AppCatalogItem> actualAppCatalogList = null; - - List<AppCatalogItem> expectedAppCatalog = new ArrayList<>(); - - AppCatalogItem appCatalogItem = mockAppCatalogItem(); - expectedAppCatalog.add(appCatalogItem); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(appService.getUserAppCatalog(user)).thenReturn(expectedAppCatalog); - actualAppCatalogList = appCatalogController.getAppCatalog(mockedRequest, mockedResponse); - - assertTrue(actualAppCatalogList.contains(appCatalogItem)); - - } - - @Test - public void getAppCatalogTestIfUserIsAdmin() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<AppCatalogItem> actualAppCatalogList = null; - - List<AppCatalogItem> expectedAppCatalog = new ArrayList<>(); - - AppCatalogItem appCatalogItem = mockAppCatalogItem(); - - expectedAppCatalog.add(appCatalogItem); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getAdminAppCatalog(user)).thenReturn(expectedAppCatalog); - actualAppCatalogList = appCatalogController.getAppCatalog(mockedRequest, mockedResponse); - - assertTrue(actualAppCatalogList.contains(appCatalogItem)); - - } - - @Test - public void getAppCatalogTestIfUserisNull() throws IOException { - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(null); - List<AppCatalogItem> actualAppCatalogList = new ArrayList<>(); - ; - actualAppCatalogList = appCatalogController.getAppCatalog(mockedRequest, mockedResponse); - assertNull(actualAppCatalogList); - - } - - @Test - public void getAppCatalogTestIfUserThrowsExceptionTest() throws IOException { - EPUser user = new EPUser(); - user.setFirstName("test"); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<AppCatalogItem> actualAppCatalogList = new ArrayList<>(); - ; - - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - - Mockito.when(appCatalogController.getAppCatalog(mockedRequest, mockedResponse)).thenThrow(nullPointerException); - - actualAppCatalogList = appCatalogController.getAppCatalog(mockedRequest, mockedResponse); - assertNull(actualAppCatalogList); - - } - - @Test - public void putAppCatalogSelectionTestWhenAppIsNull() throws IOException { - - AppCatalogPersonalization persRequest = new AppCatalogPersonalization(); - persRequest.setAppId((long) 1); - persRequest.setPending(false); - persRequest.setSelect(false); - - EPUser user = mockUser.mockEPUser(); - - FieldsValidator expectedFieldValidator = new FieldsValidator(); - - FieldsValidator actualFieldValidator = new FieldsValidator(); - List<FieldName> fields = new ArrayList<>(); - ; - - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(fields); - expectedFieldValidator.setErrorCode(null); - - EPApp app = null; - - Mockito.when(appService.getApp(persRequest.getAppId())).thenReturn(app); - - HttpSession session = mockedRequest.getSession(); - session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - actualFieldValidator = appCatalogController.putAppCatalogSelection(mockedRequest, persRequest, mockedResponse); - assertEquals(expectedFieldValidator, actualFieldValidator); - - } - - @Test - public void putAppCatalogSelectionTest() throws IOException { - - AppCatalogPersonalization persRequest = new AppCatalogPersonalization(); - persRequest.setAppId((long) 1); - persRequest.setPending(false); - persRequest.setSelect(false); - - EPUser user = mockUser.mockEPUser(); - - FieldsValidator expectedFieldValidator = new FieldsValidator(); - - FieldsValidator actualFieldValidator = new FieldsValidator(); - List<FieldName> fields = new ArrayList<>(); - ; - - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(fields); - expectedFieldValidator.setErrorCode(null); - - EPApp app = new EPApp(); - - app.setName("Test"); - app.setImageUrl("test"); - app.setDescription("test"); - app.setNotes("test"); - app.setUrl("test"); - app.setId((long) 1); - app.setAppRestEndpoint("test"); - app.setAlternateUrl("test"); - app.setName("test"); - app.setMlAppName("test"); - app.setMlAppAdminId("test"); - app.setUsername("test"); - app.setAppPassword("test"); - app.setOpen(false); - app.setEnabled(false); - app.setUebKey("test"); - app.setUebSecret("test"); - app.setUebTopicName("test"); - app.setAppType(1); - - Mockito.when(appService.getApp(persRequest.getAppId())).thenReturn(app); - - HttpSession session = mockedRequest.getSession(); - session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.doNothing().when(persUserAppService).setPersUserAppValue(user, app, persRequest.getSelect(), - persRequest.getPending()); - - actualFieldValidator = appCatalogController.putAppCatalogSelection(mockedRequest, persRequest, mockedResponse); - - assertEquals(expectedFieldValidator, actualFieldValidator); - - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppContactUsControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppContactUsControllerTest.java deleted file mode 100644 index 12334d87..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppContactUsControllerTest.java +++ /dev/null @@ -1,274 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; - -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.openecomp.portalapp.portal.controller.AppContactUsController; -import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; -import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.AppContactUsService; -import org.openecomp.portalapp.portal.service.AppContactUsServiceImpl; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; - -public class AppContactUsControllerTest extends MockitoTestSuite{ - - @Mock - AppContactUsService contactUsService = new AppContactUsServiceImpl(); - - @InjectMocks - AppContactUsController appContactUsController = new AppContactUsController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - - public List<AppContactUsItem> mockResponse() { - List<AppContactUsItem> appContactUsItemList = new ArrayList<AppContactUsItem>(); - AppContactUsItem appContactUsItem = new AppContactUsItem(); - appContactUsItem.setAppId((long) 1); - appContactUsItem.setAppName("ECOMP Portal"); - appContactUsItem.setDescription("Test"); - appContactUsItem.setContactName("Test"); - appContactUsItem.setContactEmail("person@onap.org"); - appContactUsItem.setUrl("Test_URL"); - appContactUsItem.setActiveYN("Y"); - appContactUsItemList.add(appContactUsItem); - - return appContactUsItemList; - - } - - public PortalRestResponse<List<AppContactUsItem>> successPortalRestResponse() { - PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = new PortalRestResponse<List<AppContactUsItem>>(); - List<AppContactUsItem> appContactUsItemList = mockResponse(); - expectedportalRestResponse.setMessage("success"); - expectedportalRestResponse.setResponse(appContactUsItemList); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - return expectedportalRestResponse; - - } - - public PortalRestResponse<List<AppContactUsItem>> exceptionPortalRestResponse() { - PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = new PortalRestResponse<List<AppContactUsItem>>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - return expectedportalRestResponse; - - } - - @Test - public void getAppContactUsList() throws Exception { - PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = successPortalRestResponse(); - List<AppContactUsItem> appContactUsItemList = mockResponse(); - PortalRestResponse<List<AppContactUsItem>> actualPortalRestResponse = new PortalRestResponse<List<AppContactUsItem>>(); - Mockito.when(contactUsService.getAppContactUs()).thenReturn(appContactUsItemList); - actualPortalRestResponse = appContactUsController.getAppContactUsList(mockedRequest); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } - - @Test - public void getAppContactUsListCatchesExeptionTest() throws Exception { - - PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = exceptionPortalRestResponse(); - PortalRestResponse<List<AppContactUsItem>> actualPortalRestResponse = new PortalRestResponse<List<AppContactUsItem>>(); - Mockito.when(contactUsService.getAppContactUs()).thenThrow(nullPointerException); - actualPortalRestResponse = appContactUsController.getAppContactUsList(mockedRequest); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } - - @Test - public void getAppsAndContactsTest() throws Exception { - PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = successPortalRestResponse(); - List<AppContactUsItem> appContactUsItemList = mockResponse(); - PortalRestResponse<List<AppContactUsItem>> actualPortalRestResponse = new PortalRestResponse<List<AppContactUsItem>>(); - Mockito.when(contactUsService.getAppsAndContacts()).thenReturn(appContactUsItemList); - actualPortalRestResponse = appContactUsController.getAppsAndContacts(mockedRequest); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - - } - - @Test - public void getAppsAndContactsCatchesExceptionTest() throws Exception { - PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = exceptionPortalRestResponse(); - PortalRestResponse<List<AppContactUsItem>> actualPortalRestResponse = new PortalRestResponse<List<AppContactUsItem>>(); - Mockito.when(contactUsService.getAppsAndContacts()).thenThrow(nullPointerException); - actualPortalRestResponse = appContactUsController.getAppsAndContacts(mockedRequest); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - - } - - @Test - public void getAppCategoryFunctionsTest() throws Exception { - PortalRestResponse<List<AppCategoryFunctionsItem>> actualportalRestResponse = null; - - List<AppCategoryFunctionsItem> contents = new ArrayList<AppCategoryFunctionsItem>(); - - AppCategoryFunctionsItem appCategoryFunctionsItem = new AppCategoryFunctionsItem(); - AppCategoryFunctionsItem appCategoryFunctionsItem1 = new AppCategoryFunctionsItem(); - - appCategoryFunctionsItem.setRowId("1"); - appCategoryFunctionsItem.setAppId("1"); - appCategoryFunctionsItem.setApplication("Ecomp-portal"); - appCategoryFunctionsItem.setCategory("test"); - appCategoryFunctionsItem.setFunctions("test"); - - appCategoryFunctionsItem1.setRowId("2"); - appCategoryFunctionsItem1.setAppId("2"); - appCategoryFunctionsItem1.setApplication("Ecomp-portal-test"); - appCategoryFunctionsItem1.setCategory("test"); - appCategoryFunctionsItem1.setFunctions("test"); - contents.add(appCategoryFunctionsItem); - contents.add(appCategoryFunctionsItem1); - - PortalRestResponse<List<AppCategoryFunctionsItem>> expectedportalRestResponse = new PortalRestResponse<List<AppCategoryFunctionsItem>>(); - expectedportalRestResponse.setMessage("success"); - expectedportalRestResponse.setResponse(contents); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - - Mockito.when(contactUsService.getAppCategoryFunctions()).thenReturn(contents); - actualportalRestResponse = appContactUsController.getAppCategoryFunctions(mockedRequest); - assertEquals(actualportalRestResponse, expectedportalRestResponse); - - } - - @Test - public void getAppCategoryFunctionsCatchesExceptionTest() throws Exception { - PortalRestResponse<List<AppCategoryFunctionsItem>> actualportalRestResponse = null; - PortalRestResponse<List<AppContactUsItem>> expectedportalRestResponse = exceptionPortalRestResponse(); - Mockito.when(contactUsService.getAppCategoryFunctions()).thenThrow(nullPointerException); - actualportalRestResponse = appContactUsController.getAppCategoryFunctions(mockedRequest); - assertEquals(actualportalRestResponse, expectedportalRestResponse); - - } - - @Test - public void saveTest() throws Exception { - PortalRestResponse<String> actualSaveAppContactUS = null; - - AppContactUsItem contactUs = new AppContactUsItem(); - contactUs.setAppId((long) 1); - contactUs.setAppName("Ecomp Portal"); - contactUs.setDescription("Test"); - contactUs.setContactName("Test"); - contactUs.setContactEmail("person@onap.org"); - contactUs.setUrl("Test_URL"); - contactUs.setActiveYN("Y"); - - Mockito.when(contactUsService.saveAppContactUs(contactUs)).thenReturn("SUCCESS"); - actualSaveAppContactUS = appContactUsController.save(contactUs); - assertEquals(actualSaveAppContactUS.getMessage(), "SUCCESS"); - } - - @Test - public void saveExceptionTest() throws Exception { - PortalRestResponse<String> actualSaveAppContactUS = null; - - AppContactUsItem contactUs = new AppContactUsItem(); - contactUs.setAppId((long) 1); - contactUs.setAppName("Ecomp Portal"); - contactUs.setDescription("Test"); - contactUs.setContactName("Test"); - contactUs.setContactEmail("person@onap.org"); - contactUs.setUrl("Test_URL"); - contactUs.setActiveYN("Y"); - - Mockito.when(contactUsService.saveAppContactUs(contactUs)).thenThrow(new Exception()); - actualSaveAppContactUS = appContactUsController.save(contactUs); - assertEquals(actualSaveAppContactUS.getMessage(), "failure"); - } - - @Test - public void saveWhenAppContactUsItemNullTest() throws Exception { - PortalRestResponse<String> actualSaveAppContactUS = null; - AppContactUsItem contactUs = null; - actualSaveAppContactUS = appContactUsController.save(contactUs); - assertEquals(actualSaveAppContactUS.getMessage(), "failure"); - - } - - @Test - public void saveAllTest() throws Exception { - - List<AppContactUsItem> contactUs = mockResponse(); - PortalRestResponse<String> actualSaveAppContactUS = null; - Mockito.when(contactUsService.saveAppContactUs(contactUs)).thenReturn("SUCCESS"); - actualSaveAppContactUS = appContactUsController.save(contactUs); - assertEquals(actualSaveAppContactUS.getMessage(), "SUCCESS"); - } - - @Test - public void saveAllExceptionTest() throws Exception { - - List<AppContactUsItem> contactUs = mockResponse(); - PortalRestResponse<String> actualSaveAppContactUS = null; - Mockito.when(contactUsService.saveAppContactUs(contactUs)).thenThrow(new Exception()); - actualSaveAppContactUS = appContactUsController.save(contactUs); - assertEquals(actualSaveAppContactUS.getMessage(), "failure"); - } - - @Test - public void deleteTest() throws Exception { - - PortalRestResponse<String> actualSaveAppContactUS = null; - Long id = (long) 1; - String saveAppContactUs = "SUCCESS"; - Mockito.when(contactUsService.deleteContactUs(id)).thenReturn(saveAppContactUs); - actualSaveAppContactUS = appContactUsController.delete(id); - assertEquals(actualSaveAppContactUS.getMessage(), "SUCCESS"); - } - - @Test - public void deleteExceptionTest() throws Exception { - - PortalRestResponse<String> actualSaveAppContactUS = null; - Long id = (long) 1; - Mockito.when(contactUsService.deleteContactUs(id)).thenThrow(new Exception()); - actualSaveAppContactUS = appContactUsController.delete(id); - assertEquals(actualSaveAppContactUS.getMessage(), "failure"); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerExternalRequestTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerExternalRequestTest.java deleted file mode 100644 index 1db55526..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerExternalRequestTest.java +++ /dev/null @@ -1,263 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; - -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.openecomp.portalapp.portal.controller.AppsControllerExternalRequest; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.service.PortalAdminService; -import org.openecomp.portalapp.portal.service.UserService; -import org.openecomp.portalapp.portal.service.UserServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; - -public class AppsControllerExternalRequestTest extends MockitoTestSuite { - - @Mock - AdminRolesService adminRolesService; - - @Mock - EPAppService appService; - - @Mock - PortalAdminService portalAdminService; - - @Mock - UserService userService = new UserServiceImpl(); - - @InjectMocks - AppsControllerExternalRequest appsControllerExternalRequest = new AppsControllerExternalRequest(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - MockEPUser mockUser = new MockEPUser(); - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - - @Test - public void postPortalAdminIfUSerNullTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Missing required field: email, loginId, or loginPwd"); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - EPUser user = mockUser.mockEPUser(); - user.setEmail("guestT@test.portal.onap.org"); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .postPortalAdmin(mockedRequest, mockedResponse, user); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } - - @Test - public void postPortalAdminTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("java.lang.NullPointerException"); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - EPUser user = mockUser.mockEPUser(); - user.setEmail("guestT@test.portal.onap.org"); - user.setLoginPwd("pwd"); - user.setLoginId("Test"); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(userService.getUserByUserId(user.getOrgUserId())).thenThrow(nullPointerException); - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .postPortalAdmin(mockedRequest, mockedResponse, user); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } - - @Test - public void postPortalAdminCreateUserIfNotFoundTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - EPUser user = mockUser.mockEPUser(); - user.setEmail("guestT@test.portal.onap.org"); - user.setLoginPwd("pwd"); - user.setLoginId("Test"); - List<EPUser> expectedList = null; - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(userService.getUserByUserId(user.getOrgUserId())).thenReturn(expectedList); - Mockito.when(userService.saveNewUser(user, "Yes")).thenReturn(null); - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .postPortalAdmin(mockedRequest, mockedResponse, user); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } - - @Test - public void postPortalAdminCreateUserIfFoundTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - EPUser user = mockUser.mockEPUser(); - user.setEmail("guestT@test.portal.onap.org"); - user.setLoginPwd("pwd"); - user.setLoginId("Test"); - List<EPUser> expectedList = new ArrayList<EPUser>(); - expectedList.add(user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(userService.getUserByUserId(user.getOrgUserId())).thenReturn(expectedList); - Mockito.when(userService.saveNewUser(user, "Yes")).thenReturn(null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .postPortalAdmin(mockedRequest, mockedResponse, user); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } - - @Test - public void postPortalAdminCreateUserIfNotSuperAdminTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - EPUser user = mockUser.mockEPUser(); - user.setEmail("guestT@test.portal.onap.org"); - user.setLoginPwd("pwd"); - user.setLoginId("Test"); - List<EPUser> expectedList = new ArrayList<EPUser>(); - expectedList.add(user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(userService.getUserByUserId(user.getOrgUserId())).thenReturn(expectedList); - Mockito.when(userService.saveNewUser(user, "Yes")).thenReturn(null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - Mockito.when(portalAdminService.createPortalAdmin(user.getOrgUserId())).thenReturn(expectedFieldValidator); - - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .postPortalAdmin(mockedRequest, mockedResponse, user); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } - - @Test - public void postPortalAdminCreateUserIfFieldValidatorErrorTest() throws Exception { - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 500); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("FieldsValidator [httpStatusCode=500, errorCode=null, fields=null]"); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - EPUser user = mockUser.mockEPUser(); - user.setEmail("guestT@test.portal.onap.org"); - user.setLoginPwd("pwd"); - user.setLoginId("Test"); - List<EPUser> expectedList = new ArrayList<EPUser>(); - expectedList.add(user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(userService.getUserByUserId(user.getOrgUserId())).thenReturn(expectedList); - Mockito.when(userService.saveNewUser(user, "Yes")).thenReturn(null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(portalAdminService.createPortalAdmin(user.getOrgUserId())).thenReturn(expectedFieldValidator); - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .postPortalAdmin(mockedRequest, mockedResponse, user); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } - - @Test - public void getOnboardAppExternalTest() { - EPApp epApp = new EPApp(); - Long appId = (long) 1; - Mockito.when(appService.getApp(appId)).thenReturn(epApp); - OnboardingApp expectedApp = new OnboardingApp(); - Mockito.doNothing().when(appService).createOnboardingFromApp(epApp, expectedApp); - OnboardingApp actualApp = appsControllerExternalRequest.getOnboardAppExternal(mockedRequest, mockedResponse, - appId); - assertEquals(expectedApp.getClass(), actualApp.getClass()); - } - - @Test - public void postOnboardAppExternalExceptionTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Unexpected field: id"); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - - OnboardingApp expectedOnboardingApp = new OnboardingApp(); - expectedOnboardingApp.id = (long) 1; - - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .postOnboardAppExternal(mockedRequest, mockedResponse, expectedOnboardingApp); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } - - @Test - public void postOnboardAppExternalTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage( - "Missing required field: name, url, restUrl, restrictedApp, isOpen, isEnabled, myLoginsAppOwner"); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - - OnboardingApp expectedOnboardingApp = new OnboardingApp(); - expectedOnboardingApp.id = null; - - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .postOnboardAppExternal(mockedRequest, mockedResponse, expectedOnboardingApp); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - - } - - @Test - public void putOnboardAppExternalifAppNullTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Unexpected value for field: id"); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - Long appId = null; - OnboardingApp expectedOnboardingApp = new OnboardingApp(); - expectedOnboardingApp.id = null; - - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .putOnboardAppExternal(mockedRequest, mockedResponse, appId, expectedOnboardingApp); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } - - @Test - public void putOnboardAppExternalIfOnboardingAppDetailsNullTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage( - "Missing required field: name, url, restUrl, restrictedApp, isOpen, isEnabled, myLoginsAppOwner"); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - Long appId = (long) 1; - OnboardingApp expectedOnboardingApp = new OnboardingApp(); - expectedOnboardingApp.id = (long) 1; - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .putOnboardAppExternal(mockedRequest, mockedResponse, appId, expectedOnboardingApp); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerTest.java deleted file mode 100644 index 4b6849a6..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AppsControllerTest.java +++ /dev/null @@ -1,914 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.*; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -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.openecomp.portalapp.portal.controller.AppsController; -import org.openecomp.portalapp.portal.domain.AdminUserApplications; -import org.openecomp.portalapp.portal.domain.AppIdAndNameTransportModel; -import org.openecomp.portalapp.portal.domain.AppsResponse; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompApp; -import org.openecomp.portalapp.portal.domain.UserRole; -import org.openecomp.portalapp.portal.domain.UserRoles; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.EPAppCommonServiceImpl; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.service.EPLeftMenuService; -import org.openecomp.portalapp.portal.service.EPLeftMenuServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.EPAppsManualPreference; -import org.openecomp.portalapp.portal.transport.EPAppsSortPreference; -import org.openecomp.portalapp.portal.transport.EPDeleteAppsManualSortPref; -import org.openecomp.portalapp.portal.transport.EPWidgetsSortPreference; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.LocalRole; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.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.http.HttpEntity; -import org.springframework.http.MediaType; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({SystemProperties.class,AppUtils.class, EPUserUtils.class, MediaType.class}) -public class AppsControllerTest extends MockitoTestSuite{ - - @InjectMocks - AppsController appsController = new AppsController(); - - @Mock - AdminRolesService adminRolesService = new AdminRolesServiceImpl(); - - @Mock - EPAppService appService = new EPAppCommonServiceImpl(); - - @Mock - EPLeftMenuService leftMenuService = new EPLeftMenuServiceImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - - @Mock - AppUtils appUtils = new AppUtils(); - - MockEPUser mockUser = new MockEPUser(); - - @Test - public void getUserAppsTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EcompApp> expectedEcompApps = new ArrayList<EcompApp>(); - - EcompApp ecompApp = new EcompApp(); - ecompApp.setId((long) 1); - ecompApp.setName("Test_app"); - ecompApp.setUrl("Test_URL"); - ecompApp.setUebKey("Test_key"); - ecompApp.setAlternateUrl("Test_alt_URL"); - expectedEcompApps.add(ecompApp); - List<EcompApp> actualEcompApps = new ArrayList<EcompApp>(); - Mockito.when(appService.transformAppsToEcompApps(appService.getUserApps(user))).thenReturn(expectedEcompApps); - actualEcompApps = appsController.getUserApps(mockedRequest, mockedResponse); - assertEquals(expectedEcompApps, actualEcompApps); - } - - @Test - public void getUserAppsNoUserTest() { - EPUser user = null; - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(appService.transformAppsToEcompApps(appService.getUserApps(user))).thenReturn(null); - assertNull(appsController.getUserApps(mockedRequest, mockedResponse)); - - } - - @Test - public void getUserAppsExceptionTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(appService.transformAppsToEcompApps(appService.getUserApps(user))).thenThrow(nullPointerException); - assertNull(appsController.getUserApps(mockedRequest, mockedResponse)); - - } - - @Test - public void getPersUserAppsIfUserIsAdminTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EcompApp> expectedEcompApps = new ArrayList<EcompApp>(); - - EcompApp ecompApp = new EcompApp(); - ecompApp.setId((long) 1); - ecompApp.setName("Test_app"); - ecompApp.setUrl("Test_URL"); - ecompApp.setUebKey("Test_key"); - ecompApp.setAlternateUrl("Test_alt_URL"); - expectedEcompApps.add(ecompApp); - List<EcompApp> actualEcompApps = new ArrayList<EcompApp>(); - - List<EPApp> expectedApps = new ArrayList<EPApp>(); - - EPApp app = new EPApp(); - - app.setName("Test"); - app.setImageUrl("test"); - app.setDescription("test"); - app.setNotes("test"); - app.setUrl("test"); - app.setId((long) 1); - app.setAppRestEndpoint("test"); - app.setAlternateUrl("test"); - app.setName("test"); - app.setMlAppName("test"); - app.setMlAppAdminId("test"); - app.setUsername("test"); - app.setAppPassword("test"); - app.setOpen(false); - app.setEnabled(false); - app.setUebKey("test"); - app.setUebSecret("test"); - app.setUebTopicName("test"); - app.setAppType(1); - - expectedApps.add(app); - - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getPersAdminApps(user)).thenReturn(expectedApps); - - Mockito.when(appService.transformAppsToEcompApps(expectedApps)).thenReturn(expectedEcompApps); - actualEcompApps = appsController.getPersUserApps(mockedRequest, mockedResponse); - assertEquals(expectedEcompApps, actualEcompApps); - } - - @Test - public void getPersUserAppsIfUserNotAdminTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EcompApp> expectedEcompApps = new ArrayList<EcompApp>(); - - EcompApp ecompApp = new EcompApp(); - ecompApp.setId((long) 1); - ecompApp.setName("Test_app"); - ecompApp.setUrl("Test_URL"); - ecompApp.setUebKey("Test_key"); - ecompApp.setAlternateUrl("Test_alt_URL"); - expectedEcompApps.add(ecompApp); - List<EcompApp> actualEcompApps = new ArrayList<EcompApp>(); - - List<EPApp> expectedApps = new ArrayList<EPApp>(); - - EPApp app = new EPApp(); - - app.setName("Test"); - app.setImageUrl("test"); - app.setDescription("test"); - app.setNotes("test"); - app.setUrl("test"); - app.setId((long) 1); - app.setAppRestEndpoint("test"); - app.setAlternateUrl("test"); - app.setName("test"); - app.setMlAppName("test"); - app.setMlAppAdminId("test"); - app.setUsername("test"); - app.setAppPassword("test"); - app.setOpen(false); - app.setEnabled(false); - app.setUebKey("test"); - app.setUebSecret("test"); - app.setUebTopicName("test"); - app.setAppType(1); - - expectedApps.add(app); - - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(appService.getPersUserApps(user)).thenReturn(expectedApps); - Mockito.when(appService.transformAppsToEcompApps(expectedApps)).thenReturn(expectedEcompApps); - actualEcompApps = appsController.getPersUserApps(mockedRequest, mockedResponse); - assertEquals(expectedEcompApps, actualEcompApps); - } - - @Test - public void getPersUserAppsIfUserNullTest() throws IOException { - EPUser user = null; - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - assertNull(appsController.getPersUserApps(mockedRequest, mockedResponse)); - } - - @Test - public void getPersUserAppsExceptionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getPersAdminApps(user)).thenThrow(nullPointerException); - assertNull(appsController.getPersUserApps(mockedRequest, mockedResponse)); - } - - @Test - public void getAdminAppsIfNotAdminTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false); - assertNull(appsController.getAdminApps(mockedRequest, mockedResponse)); - } - - @Test - public void getAdminAppsTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<AppIdAndNameTransportModel> expectedAdminApps = new ArrayList<AppIdAndNameTransportModel>(); - AppIdAndNameTransportModel appIdAndNameTransportModel = new AppIdAndNameTransportModel(); - appIdAndNameTransportModel.setId((long) 1); - appIdAndNameTransportModel.setName("Test_app"); - expectedAdminApps.add(appIdAndNameTransportModel); - List<AppIdAndNameTransportModel> actualAdminApps = new ArrayList<AppIdAndNameTransportModel>(); - Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(true); - Mockito.when(appService.getAdminApps(user)).thenReturn(expectedAdminApps); - actualAdminApps = appsController.getAdminApps(mockedRequest, mockedResponse); - assertEquals(actualAdminApps, expectedAdminApps); - - } - - @Test - public void getAdminAppsExceptionTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(true); - Mockito.when(appService.getAdminApps(user)).thenThrow(nullPointerException); - assertNull(appsController.getAdminApps(mockedRequest, mockedResponse)); - } - - @Test - public void getAppsForSuperAdminAndAccountAdminifOnlyAccountAdminTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false); - assertNull(appsController.getAppsForSuperAdminAndAccountAdmin(mockedRequest, mockedResponse)); - } - - @Test - public void getAppsForSuperAdminAndAccountAdminTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<AppIdAndNameTransportModel> expectedAdminApps = new ArrayList<AppIdAndNameTransportModel>(); - AppIdAndNameTransportModel appIdAndNameTransportModel = new AppIdAndNameTransportModel(); - appIdAndNameTransportModel.setId((long) 1); - appIdAndNameTransportModel.setName("Test_app"); - expectedAdminApps.add(appIdAndNameTransportModel); - List<AppIdAndNameTransportModel> actualAdminApps = new ArrayList<AppIdAndNameTransportModel>(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(true); - Mockito.when(appService.getAppsForSuperAdminAndAccountAdmin(user)).thenReturn(expectedAdminApps); - actualAdminApps = appsController.getAppsForSuperAdminAndAccountAdmin(mockedRequest, mockedResponse); - assertEquals(actualAdminApps, expectedAdminApps); - - } - - @Test - public void getAppsForSuperAdminExceptionTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false); - Mockito.when(appService.getAppsForSuperAdminAndAccountAdmin(user)).thenThrow(nullPointerException); - assertNull(appsController.getAppsForSuperAdminAndAccountAdmin(mockedRequest, mockedResponse)); - } - - @Test - public void putUserAppsSortingManualTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EPAppsManualPreference> ePAppsManualPreference = new ArrayList<EPAppsManualPreference>(); - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - FieldsValidator actualFieldValidator = new FieldsValidator(); - Mockito.when(appService.saveAppsSortManual(ePAppsManualPreference, user)).thenReturn(expectedFieldValidator); - actualFieldValidator = appsController.putUserAppsSortingManual(mockedRequest, ePAppsManualPreference, - mockedResponse); - assertEquals(actualFieldValidator, expectedFieldValidator); - } - - @Test - public void putUserAppsSortingManualExceptionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EPAppsManualPreference> ePAppsManualPreference = new ArrayList<EPAppsManualPreference>(); - Mockito.when(appService.saveAppsSortManual(ePAppsManualPreference, user)).thenThrow(nullPointerException); - assertNull(appsController.putUserAppsSortingManual(mockedRequest, ePAppsManualPreference, mockedResponse)); - } - - @Test - public void putUserWidgetsSortManualTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EPWidgetsSortPreference> ePWidgetsSortPreference = new ArrayList<EPWidgetsSortPreference>(); - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - FieldsValidator actualFieldValidator = new FieldsValidator(); - Mockito.when(appService.saveWidgetsSortManual(ePWidgetsSortPreference, user)) - .thenReturn(expectedFieldValidator); - actualFieldValidator = appsController.putUserWidgetsSortManual(mockedRequest, ePWidgetsSortPreference, - mockedResponse); - assertEquals(actualFieldValidator, expectedFieldValidator); - } - - @Test - public void putUserWidgetsSortManualExceptionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EPAppsManualPreference> ePAppsManualPreference = new ArrayList<EPAppsManualPreference>(); - Mockito.when(appService.saveAppsSortManual(ePAppsManualPreference, user)).thenThrow(nullPointerException); - assertNull(appsController.putUserAppsSortingManual(mockedRequest, ePAppsManualPreference, mockedResponse)); - } - - @Test - public void putUserWidgetsSortPrefTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EPWidgetsSortPreference> ePWidgetsSortPreference = new ArrayList<EPWidgetsSortPreference>(); - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - FieldsValidator actualFieldValidator = new FieldsValidator(); - Mockito.when(appService.deleteUserWidgetSortPref(ePWidgetsSortPreference, user)) - .thenReturn(expectedFieldValidator); - actualFieldValidator = appsController.putUserWidgetsSortPref(mockedRequest, ePWidgetsSortPreference, - mockedResponse); - assertEquals(actualFieldValidator, expectedFieldValidator); - } - - @Test - public void putUserWidgetsSortPrefExceptionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EPWidgetsSortPreference> ePWidgetsSortPreference = new ArrayList<EPWidgetsSortPreference>(); - Mockito.when(appService.deleteUserWidgetSortPref(ePWidgetsSortPreference, user)) - .thenThrow(nullPointerException); - assertNull(appsController.putUserWidgetsSortPref(mockedRequest, ePWidgetsSortPreference, mockedResponse)); - } - - @Test - public void deleteUserAppSortManualTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - EPDeleteAppsManualSortPref epDeleteAppsManualSortPref = new EPDeleteAppsManualSortPref(); - - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - FieldsValidator actualFieldValidator = new FieldsValidator(); - Mockito.when(appService.deleteUserAppSortManual(epDeleteAppsManualSortPref, user)) - .thenReturn(expectedFieldValidator); - actualFieldValidator = appsController.deleteUserAppSortManual(mockedRequest, epDeleteAppsManualSortPref, - mockedResponse); - assertEquals(actualFieldValidator, expectedFieldValidator); - } - - @Test - public void deleteUserAppSortManualExceptionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - EPDeleteAppsManualSortPref epDeleteAppsManualSortPref = new EPDeleteAppsManualSortPref(); - Mockito.when(appService.deleteUserAppSortManual(epDeleteAppsManualSortPref, user)) - .thenThrow(nullPointerException); - assertNull(appsController.deleteUserAppSortManual(mockedRequest, epDeleteAppsManualSortPref, mockedResponse)); - } - - @Test - public void putUserAppsSortingPreferenceTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - EPAppsSortPreference userAppsValue = new EPAppsSortPreference(); - - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - FieldsValidator actualFieldValidator = new FieldsValidator(); - Mockito.when(appService.saveAppsSortPreference(userAppsValue, user)).thenReturn(expectedFieldValidator); - actualFieldValidator = appsController.putUserAppsSortingPreference(mockedRequest, userAppsValue, - mockedResponse); - assertEquals(actualFieldValidator, expectedFieldValidator); - } - - @Test - public void putUserAppsSortingPreferenceExceptionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - EPAppsSortPreference userAppsValue = new EPAppsSortPreference(); - Mockito.when(appService.saveAppsSortPreference(userAppsValue, user)).thenThrow(nullPointerException); - assertNull(appsController.putUserAppsSortingPreference(mockedRequest, userAppsValue, mockedResponse)); - } - - @Test - public void getUserAppsSortTypePreferenceTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - String expectedUserSortPreference = "TEST_DECE"; - String actualUserSortPreference = new String(); - Mockito.when(appService.getUserAppsSortTypePreference(user)).thenReturn(expectedUserSortPreference); - actualUserSortPreference = appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse); - assertEquals(actualUserSortPreference, expectedUserSortPreference); - } - - @Test - public void getUserAppsSortTypePreferenceExceptionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(appService.getUserAppsSortTypePreference(user)).thenThrow(nullPointerException); - assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse)); - } - - @Test - public void getUserAppsSortTypePreferenceIfUserNullTest() throws IOException { - EPUser user = null; - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(appService.getUserAppsSortTypePreference(user)).thenThrow(nullPointerException); - assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse)); - } - - @Test - public void getAppsAdministratorsTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<AdminUserApplications> expecteAdminUserApplications = new ArrayList<AdminUserApplications>(); - List<AdminUserApplications> actualAdminUserApplications = new ArrayList<AdminUserApplications>(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getAppsAdmins()).thenReturn(expecteAdminUserApplications); - actualAdminUserApplications = appsController.getAppsAdministrators(mockedRequest, mockedResponse); - assertEquals(expecteAdminUserApplications, actualAdminUserApplications); - } - - @Test - public void getAppsAdministratorsIfUserNotSuperAdminTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse)); - } - - @Test - public void getAppsAdministratorsExceptionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getAppsAdmins()).thenThrow(nullPointerException); - assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse)); - } - - @Test - public void getAppsTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<AppsResponse> expectedApps = new ArrayList<AppsResponse>(); - AppsResponse apps = new AppsResponse((long) 1, "test", true, true); - expectedApps.add(apps); - - List<AppsResponse> atualApps = new ArrayList<AppsResponse>(); - - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getAllApps(false)).thenReturn(expectedApps); - atualApps = appsController.getApps(mockedRequest, mockedResponse); - assertEquals(expectedApps, atualApps); - } - - @Test - public void getAppsExceptionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - assertNull(appsController.getApps(mockedRequest, mockedResponse)); - } - - @Test - public void getAppsIfUserNotSuperAdminTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getAllApps(false)).thenThrow(nullPointerException); - assertNull(appsController.getApps(mockedRequest, mockedResponse)); - } - - @Test - public void getAllAppsTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<AppsResponse> expectedApps = new ArrayList<AppsResponse>(); - AppsResponse apps = new AppsResponse((long) 1, "test", true, true); - expectedApps.add(apps); - List<AppsResponse> atualApps = new ArrayList<AppsResponse>(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getAllApps(true)).thenReturn(expectedApps); - atualApps = appsController.getAllApps(mockedRequest, mockedResponse); - assertEquals(expectedApps, atualApps); - } - - @Test - public void getAllAppsExceptionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - assertNull(appsController.getAllApps(mockedRequest, mockedResponse)); - } - - @Test - public void getAllAppsIfUserNotSuperAdminTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getAllApps(true)).thenThrow(nullPointerException); - assertNull(appsController.getAllApps(mockedRequest, mockedResponse)); - } - - @Test - public void getAppsFullListTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EcompApp> expectedEcompApps = new ArrayList<EcompApp>(); - - EcompApp ecompApp = new EcompApp(); - ecompApp.setId((long) 1); - ecompApp.setName("Test_app"); - ecompApp.setUrl("Test_URL"); - ecompApp.setUebKey("Test_key"); - ecompApp.setAlternateUrl("Test_alt_URL"); - expectedEcompApps.add(ecompApp); - List<EcompApp> actualEcompApps = new ArrayList<EcompApp>(); - Mockito.when(appService.getEcompAppAppsFullList()).thenReturn(expectedEcompApps); - actualEcompApps = appsController.getAppsFullList(mockedRequest, mockedResponse); - assertEquals(expectedEcompApps, actualEcompApps); - } - -// @Test -// public void getAppsFullListNoUserTest() { -// EPUser user = null; -// Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); -// Mockito.when(appService.getEcompAppAppsFullList()).thenReturn(null); -// assertNull(appsController.getAppsFullList(mockedRequest, mockedResponse)); -// -// } - - @Test - public void getUserProfileTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - - UserRole userRole = new UserRole(); - userRole.setUser_Id((long) 1); - userRole.setOrgUserId("guest"); - userRole.setFirstName("Test_User_FirstName"); - userRole.setLastName("Test_User_LastName"); - userRole.setRoleId((long) 1); - userRole.setRoleName("test"); - - UserRoles unexpectedserAndRoles = new UserRoles(userRole); - unexpectedserAndRoles.setFirstName("Test_User_FirstName"); - unexpectedserAndRoles.setLastName("Test_User_LastName"); - unexpectedserAndRoles.setGuestSession(false); - unexpectedserAndRoles.setOrgUserId("guest"); - List<String> roles = new ArrayList<String>(); - roles.add("Test"); - unexpectedserAndRoles.setRoles(roles); - Mockito.when(appService.getUserProfileNormalized(user)).thenReturn(unexpectedserAndRoles); - UserRoles actualUserAndRoles = appsController.getUserProfile(mockedRequest, mockedResponse); - assertEquals(unexpectedserAndRoles, actualUserAndRoles); - } - - @Test - public void getUserProfileIfUserNullTest() throws IOException { - EPUser user = null; - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(appService.getUserProfileNormalized(user)).thenReturn(null); - assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse)); - } - - @Test - public void getUserProfileExcpetionTest() throws IOException { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(appService.getUserProfileNormalized(user)).thenThrow(nullPointerException); - assertNull(appsController.getUserAppsSortTypePreference(mockedRequest, mockedResponse)); - } - - @Test - public void getAppRolesTest() { - List<LocalRole> expectedRoleList = new ArrayList<LocalRole>(); - LocalRole localRole = new LocalRole(); - localRole.setRoleId(1); - localRole.setRolename("test"); - expectedRoleList.add(localRole); - long appId = 1; - Mockito.when(appService.getAppRoles(appId)).thenReturn(expectedRoleList); - List<LocalRole> actualRoleList = appsController.getAppRoles(mockedRequest, appId); - assertEquals(actualRoleList, expectedRoleList); - } - - @Test - public void getAppRolesExceptionTest() { - long appId = 1; - Mockito.when(appService.getAppRoles(appId)).thenThrow(nullPointerException); - assertNull(appsController.getAppRoles(mockedRequest, appId)); - } - - @Test - public void getOnboardingAppsTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<OnboardingApp> expectedOnboardingApps = new ArrayList<OnboardingApp>(); - OnboardingApp onboardingApp = new OnboardingApp(); - onboardingApp.setUebKey("test"); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getOnboardingApps()).thenReturn(expectedOnboardingApps); - List<OnboardingApp> actualOnboardingApps = appsController.getOnboardingApps(mockedRequest, mockedResponse); - assertEquals(expectedOnboardingApps, actualOnboardingApps); - } - - @Test - public void getOnboardingAppsifSuperAdiminTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - assertNull(appsController.getOnboardingApps(mockedRequest, mockedResponse)); - } - - @Test - public void getOnboardingAppsExceptionTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(!adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.getOnboardingApps()).thenThrow(nullPointerException); - assertNull(appsController.getOnboardingApps(mockedRequest, mockedResponse)); - } - - @Test - public void putOnboardingAppTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - OnboardingApp OnboardingApp = new OnboardingApp(); - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.modifyOnboardingApp(OnboardingApp, user)).thenReturn(expectedFieldValidator); - FieldsValidator actualFieldValidator = appsController.putOnboardingApp(mockedRequest, OnboardingApp, - mockedResponse); - assertEquals(expectedFieldValidator, actualFieldValidator); - } - - @Test - public void putOnboardingAppIfSuperAdminTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - FieldsValidator expectedFieldValidator = null; - OnboardingApp OnboardingApp = new OnboardingApp(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(appService.modifyOnboardingApp(OnboardingApp, user)).thenReturn(expectedFieldValidator); - assertNull(appsController.putOnboardingApp(mockedRequest, OnboardingApp, mockedResponse)); - } - - @Test - public void putOnboardingAppExceptionTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - OnboardingApp OnboardingApp = new OnboardingApp(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.modifyOnboardingApp(OnboardingApp, user)).thenThrow(nullPointerException); - assertNull(appsController.putOnboardingApp(mockedRequest, OnboardingApp, mockedResponse)); - } - - @Test - public void postOnboardingAppTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - OnboardingApp OnboardingApp = new OnboardingApp(); - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.addOnboardingApp(OnboardingApp, user)).thenReturn(expectedFieldValidator); - FieldsValidator actualFieldValidator = appsController.postOnboardingApp(mockedRequest, OnboardingApp, - mockedResponse); - assertEquals(expectedFieldValidator, actualFieldValidator); - } - - @Test - public void postOnboardingAppIfSuperAdminTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - FieldsValidator expectedFieldValidator = null; - OnboardingApp OnboardingApp = new OnboardingApp(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(appService.addOnboardingApp(OnboardingApp, user)).thenReturn(expectedFieldValidator); - assertNull(appsController.postOnboardingApp(mockedRequest, OnboardingApp, mockedResponse)); - } - - @Test - public void postOnboardingAppExceptionTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - OnboardingApp OnboardingApp = new OnboardingApp(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.addOnboardingApp(OnboardingApp, user)).thenThrow(nullPointerException); - assertNull(appsController.postOnboardingApp(mockedRequest, OnboardingApp, mockedResponse)); - } - - @Test - public void deleteOnboardingAppTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - long appId = 1; - Mockito.when(appService.deleteOnboardingApp(user,appId )).thenReturn(expectedFieldValidator); - FieldsValidator actualFieldValidator = appsController.deleteOnboardingApp(mockedRequest,appId, - mockedResponse); - assertEquals(expectedFieldValidator, actualFieldValidator); - } - - @Test - public void deleteOnboardingAppIfSuperAdminTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - FieldsValidator expectedFieldValidator = null; - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - long appId = 1; - Mockito.when(appService.deleteOnboardingApp(user,appId)).thenReturn(expectedFieldValidator); - assertNull(appsController.deleteOnboardingApp(mockedRequest,appId,mockedResponse)); - } - - @Test - public void deleteOnboardingAppExceptionTest() { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - long appId = 1; - Mockito.when(appService.deleteOnboardingApp(user,appId)).thenThrow(nullPointerException); - assertNull(appsController.deleteOnboardingApp(mockedRequest,appId,mockedResponse)); - } - - @Test - public void getLeftMenuItemsTest() - { - EPUser user = mockUser.mockEPUser(); - String menuList = "Test"; - PowerMockito.mockStatic(EPUserUtils.class); - PowerMockito.mockStatic(SystemProperties.class); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Set menuSet = new HashSet<>(); - menuSet.add(1); - Mockito.when(AppUtils.getSession(mockedRequest) - .getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME))).thenReturn(menuSet); - Mockito.when(AppUtils.getSession(mockedRequest) - .getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME))).thenReturn(menuSet); - Mockito.when(leftMenuService.getLeftMenuItems(user, menuSet, menuSet)).thenReturn(menuList); - String response = appsController.getLeftMenuItems(mockedRequest, mockedResponse); - assertTrue(response.equals("Test")); - } - - @Test - public void getLeftMenuItemsExceptionTest() - { - EPUser user = mockUser.mockEPUser(); - String menuList = "Test"; - PowerMockito.mockStatic(EPUserUtils.class); - PowerMockito.mockStatic(SystemProperties.class); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Set menuSet = new HashSet<>(); - menuSet.add(1); - Mockito.when(AppUtils.getSession(mockedRequest) - .getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME))).thenReturn(menuSet); - Mockito.when(AppUtils.getSession(mockedRequest) - .getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME))).thenReturn(menuSet); - Mockito.when(leftMenuService.getLeftMenuItems(user, menuSet, menuSet)).thenThrow(nullPointerException); - assertNull(appsController.getLeftMenuItems(mockedRequest, mockedResponse)); - } - - @Test - public void getAppThumbnailExceptionTest() - { - EPApp app = null; - assertNull(appsController.getAppThumbnail(mockedRequest, (long) 1, mockedResponse)); - } - - @Test - public void getAppThumbnailTest() - { - EPApp app = new EPApp(); - app.setName("Test"); - app.setImageUrl("test"); - app.setDescription("test"); - app.setNotes("test"); - app.setUrl("test"); - app.setId((long) 1); - app.setAppType(1); - app.setImageUrl("www.ecomp.com"); - app.setThumbnail(new byte[] {1, 6, 3}); - Mockito.when(appService.getApp((long) 1)).thenReturn(app); - HttpEntity<byte[]> response = appsController.getAppThumbnail(mockedRequest, (long) 1, mockedResponse); - assertEquals(response.getHeaders().getContentLength(), 3); - } - - @Test - public void getAppThumbnailForMediaTypePngTest() - { - - EPApp app = new EPApp(); - app.setName("Test"); - app.setImageUrl("test"); - app.setDescription("test"); - app.setNotes("test"); - app.setUrl("test"); - app.setId((long) 1); - app.setAppType(1); - app.setImageUrl("www.ecomp.png"); - app.setThumbnail(new byte[] {1, 6, 3}); - Mockito.when(appService.getApp((long) 1)).thenReturn(app); - PowerMockito.mockStatic(MediaType.class); - HttpEntity<byte[]> response = appsController.getAppThumbnail(mockedRequest, (long) 1, mockedResponse); - assertEquals(response.getHeaders().getContentLength(), 3); - } - - @Test - public void getUserAppsOrderBySortPrefIfUSerNullTest(){ - List<EcompApp> listOfApps = new ArrayList<EcompApp>(); - - EcompApp app = new EcompApp(); - listOfApps.add(app); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(null); - assertNull(appsController.getUserAppsOrderBySortPref(mockedRequest, mockedResponse)); - } - - @Test - public void getUserAppsOrderBySortPrefTest(){ - List<EcompApp> listOfApps = new ArrayList<EcompApp>(); - - EcompApp app = new EcompApp(); - listOfApps.add(app); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(mockedRequest.getParameter("mparams")).thenReturn(""); - Mockito.when(appService.transformAppsToEcompApps(appService.getAppsOrderByName(user))).thenReturn(listOfApps); - List<EcompApp> listOfActualApps = appsController.getUserAppsOrderBySortPref(mockedRequest, mockedResponse); - assertEquals(listOfActualApps.size(), 1); - } - - @Test - public void getUserAppsOrderBySortPrefIfusrSortPrefIsMTest(){ - List<EcompApp> listOfApps = new ArrayList<EcompApp>(); - - EcompApp app = new EcompApp(); - listOfApps.add(app); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(mockedRequest.getParameter("mparams")).thenReturn("M"); - Mockito.when(appService.transformAppsToEcompApps(appService.getAppsOrderByName(user))).thenReturn(listOfApps); - List<EcompApp> listOfActualApps = appsController.getUserAppsOrderBySortPref(mockedRequest, mockedResponse); - assertEquals(listOfActualApps.size(), 1); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AuditLogControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AuditLogControllerTest.java deleted file mode 100644 index 33079b0c..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/AuditLogControllerTest.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -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.openecomp.portalapp.portal.controller.AuditLogController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.service.AuditService; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(EPUserUtils.class) -public class AuditLogControllerTest { - - - @Mock - AuditService auditService; - - @InjectMocks - AuditLogController auditLogController = new AuditLogController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - MockEPUser mockUser = new MockEPUser(); - @Test - public void auditLogTest() - { - PowerMockito.mockStatic(EPUserUtils.class); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(EPUserUtils.getUserId(mockedRequest)).thenReturn((int)1); - auditLogController.auditLog(mockedRequest, "1", "app", "test"); - } - - @Test - public void auditLogTabTest() - { - PowerMockito.mockStatic(EPUserUtils.class); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(EPUserUtils.getUserId(mockedRequest)).thenReturn((int)1); - auditLogController.auditLog(mockedRequest, "1", "tab", "test"); - } - - @Test - public void auditLogfunctionalTest() - { - PowerMockito.mockStatic(EPUserUtils.class); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(EPUserUtils.getUserId(mockedRequest)).thenReturn((int)1); - auditLogController.auditLog(mockedRequest, "1", "functional", "test"); - } - - @Test - public void auditLogleftMenuTest() - { - PowerMockito.mockStatic(EPUserUtils.class); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(EPUserUtils.getUserId(mockedRequest)).thenReturn((int)1); - auditLogController.auditLog(mockedRequest, "1", "leftMenu", "test"); - } - - @Test(expected = NumberFormatException.class) - public void auditLogExceptionTest() - { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(EPUserUtils.getUserId(mockedRequest)).thenReturn((int)1); - auditLogController.auditLog(mockedRequest, "1", "app", "test"); - } - - @Test - public void auditLogerrorTest() - { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenThrow(nullPointerException); - auditLogController.auditLog(mockedRequest, "1", "app", "test"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BEPropertyReaderControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BEPropertyReaderControllerTest.java deleted file mode 100644 index e4d34ceb..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BEPropertyReaderControllerTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertTrue; - -import javax.servlet.http.HttpServletRequest; - -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.openecomp.portalapp.portal.controller.BEPropertyReaderController; -import org.openecomp.portalapp.portal.domain.BEProperty; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.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 BEPropertyReaderControllerTest extends MockitoTestSuite { - - @InjectMocks - BEPropertyReaderController bEPropertyReaderController = new BEPropertyReaderController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - - NullPointerException nullPointerException = new NullPointerException(); - - @Test - public void readPropertyTest() { - String key = "DOMAIN_CLASS_LOCATION"; - BEProperty beProperty = new BEProperty("DOMAIN_CLASS_LOCATION", "domain_class_location"); - PortalRestResponse<BEProperty> ecpectedPortalRestResponse = new PortalRestResponse<BEProperty>(); - ecpectedPortalRestResponse.setMessage("success"); - ecpectedPortalRestResponse.setResponse(beProperty); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); - PortalRestResponse<BEProperty> actualPortalRestResponse = null; - PowerMockito.mockStatic(SystemProperties.class); - Mockito.when(SystemProperties.getProperty("DOMAIN_CLASS_LOCATION")).thenReturn("domain_class_location"); - actualPortalRestResponse = bEPropertyReaderController.readProperty(mockedRequest, key); - assertTrue(actualPortalRestResponse.equals(ecpectedPortalRestResponse)); - - } - - @Test - public void readPropertyExceptionTest() { - String key =null; - //BEProperty beProperty = new BEProperty("DOMAIN_CLASS_LOCATION", "domain_class_location"); - PortalRestResponse<BEProperty> ecpectedPortalRestResponse = new PortalRestResponse<BEProperty>(); - ecpectedPortalRestResponse.setMessage("java.lang.NullPointerException"); - ecpectedPortalRestResponse.setResponse(null); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - PortalRestResponse<BEProperty> actualPortalRestResponse = null; - PowerMockito.mockStatic(SystemProperties.class); - Mockito.when(new BEProperty(key, SystemProperties.getProperty(key))).thenThrow(nullPointerException); - actualPortalRestResponse = bEPropertyReaderController.readProperty(mockedRequest, key); - assertTrue(actualPortalRestResponse.equals(ecpectedPortalRestResponse)); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BasicAuthAccountControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BasicAuthAccountControllerTest.java deleted file mode 100644 index 8f9549ce..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/BasicAuthAccountControllerTest.java +++ /dev/null @@ -1,254 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; - -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.openecomp.portalapp.portal.controller.BasicAuthAccountController; -import org.openecomp.portalapp.portal.domain.BasicAuthCredentials; -import org.openecomp.portalapp.portal.domain.EPEndpoint; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.BasicAuthAccountService; -import org.openecomp.portalapp.portal.service.BasicAuthAccountServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; - -public class BasicAuthAccountControllerTest extends MockitoTestSuite { - - @Mock - BasicAuthAccountService basicAuthAccountService = new BasicAuthAccountServiceImpl(); - - @Mock - AdminRolesService adminRolesService = new AdminRolesServiceImpl(); - - @InjectMocks - BasicAuthAccountController basicAuthAccountController = new BasicAuthAccountController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - - MockEPUser mockUser = new MockEPUser(); - - public BasicAuthCredentials basicAuthCredentials() { - BasicAuthCredentials basicAuthCredentials = new BasicAuthCredentials(); - - basicAuthCredentials.setId((long) 1); - basicAuthCredentials.setApplicationName("test"); - basicAuthCredentials.setUsername("Test"); - basicAuthCredentials.setPassword("Password"); - basicAuthCredentials.setIsActive("YES"); - - List<EPEndpoint> endpoints = new ArrayList<EPEndpoint>(); - - EPEndpoint ePEndpoint = new EPEndpoint(); - ePEndpoint.setId((long) 1); - ePEndpoint.setName("Test"); - endpoints.add(ePEndpoint); - basicAuthCredentials.setEndpoints(endpoints); - - return basicAuthCredentials; - - } - - @Test - public void createBasicAuthAccountTest() throws Exception { - BasicAuthCredentials basicAuthCredentials = basicAuthCredentials(); - - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage("SUCCESS"); - expectedResponse.setResponse(""); - expectedResponse.setStatus(PortalRestStatusEnum.OK); - long accountd = 1; - - Mockito.when(basicAuthAccountService.saveBasicAuthAccount(basicAuthCredentials)).thenReturn(accountd); - - PortalRestResponse<String> actualResponse = basicAuthAccountController.createBasicAuthAccount(mockedRequest, - mockedResponse, basicAuthCredentials); - assertEquals(actualResponse, expectedResponse); - } - - @Test - public void createBasicAuthAccountAdminTest() throws Exception { - BasicAuthCredentials basicAuthCredentials = basicAuthCredentials(); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage("Authorization Required"); - expectedResponse.setResponse("Admin Only Operation! "); - expectedResponse.setStatus(PortalRestStatusEnum.ERROR); - - PortalRestResponse<String> actualResponse = basicAuthAccountController.createBasicAuthAccount(mockedRequest, - mockedResponse, basicAuthCredentials); - assertEquals(actualResponse, expectedResponse); - } - - @Test - public void createBasicAuthAccountIfInputNullTest() throws Exception { - BasicAuthCredentials basicAuthCredentials = null; - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage("FAILURE"); - expectedResponse.setResponse("newBasicAuthAccount cannot be null or empty"); - expectedResponse.setStatus(PortalRestStatusEnum.ERROR); - PortalRestResponse<String> actualResponse = basicAuthAccountController.createBasicAuthAccount(mockedRequest, - mockedResponse, basicAuthCredentials); - assertEquals(actualResponse, expectedResponse); - } - - @Test - public void getBasicAuthAccountTest() throws Exception { - PortalRestResponse<List<BasicAuthCredentials>> expectedPortalResponse = new PortalRestResponse<List<BasicAuthCredentials>>(); - List<BasicAuthCredentials> basicAuthCredentialsList = new ArrayList<BasicAuthCredentials>(); - BasicAuthCredentials basicAuthCredentials = basicAuthCredentials(); - basicAuthCredentialsList.add(basicAuthCredentials); - - expectedPortalResponse.setMessage("Success"); - expectedPortalResponse.setResponse(null); - expectedPortalResponse.setStatus(PortalRestStatusEnum.OK); - - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(basicAuthAccountService.getAccountData()).thenReturn(null); - PortalRestResponse<List<BasicAuthCredentials>> actualResponse = basicAuthAccountController - .getBasicAuthAccount(mockedRequest, mockedResponse); - assertEquals(expectedPortalResponse, actualResponse); - } - - @Test - public void getBasicAuthAccountIfSuperAdminTest() throws Exception { - PortalRestResponse<List<BasicAuthCredentials>> expectedPortalResponse = new PortalRestResponse<List<BasicAuthCredentials>>(); - List<BasicAuthCredentials> basicAuthCredentialsList = new ArrayList<BasicAuthCredentials>(); - BasicAuthCredentials basicAuthCredentials = basicAuthCredentials(); - basicAuthCredentialsList.add(basicAuthCredentials); - - expectedPortalResponse.setMessage("UnAuthorized! Admin Only Operation"); - expectedPortalResponse.setResponse(new ArrayList<>()); - expectedPortalResponse.setStatus(PortalRestStatusEnum.ERROR); - - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(basicAuthAccountService.getAccountData()).thenReturn(null); - PortalRestResponse<List<BasicAuthCredentials>> actualResponse = basicAuthAccountController - .getBasicAuthAccount(mockedRequest, mockedResponse); - assertEquals(expectedPortalResponse, actualResponse); - } - - @Test - public void updateAccountTest() throws Exception { - BasicAuthCredentials basicAuthCredentials = basicAuthCredentials(); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage("SUCCESS"); - expectedResponse.setResponse(""); - expectedResponse.setStatus(PortalRestStatusEnum.OK); - long accountd = 1; - PortalRestResponse<String> actualResponse = basicAuthAccountController.updateAccount(mockedRequest, - mockedResponse, accountd, basicAuthCredentials); - assertEquals(actualResponse, expectedResponse); - } - - @Test - public void updateAccountIfSuperAdminTest() throws Exception { - BasicAuthCredentials basicAuthCredentials = basicAuthCredentials(); - - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage("Authorization Required"); - expectedResponse.setResponse("Admin Only Operation! "); - expectedResponse.setStatus(PortalRestStatusEnum.ERROR); - long accountd = 1; - PortalRestResponse<String> actualResponse = basicAuthAccountController.updateAccount(mockedRequest, - mockedResponse, accountd, basicAuthCredentials); - assertEquals(actualResponse, expectedResponse); - } - - @Test - public void updateAccountIfInputNullTest() throws Exception { - BasicAuthCredentials basicAuthCredentials = null; - - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage("FAILURE"); - expectedResponse.setResponse("BasicAuthCredentials cannot be null or empty"); - expectedResponse.setStatus(PortalRestStatusEnum.ERROR); - long accountd = 1; - PortalRestResponse<String> actualResponse = basicAuthAccountController.updateAccount(mockedRequest, - mockedResponse, accountd, basicAuthCredentials); - assertEquals(actualResponse, expectedResponse); - } - - @Test - public void deleteAccountTest() throws Exception { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage("SUCCESS"); - expectedResponse.setResponse(""); - expectedResponse.setStatus(PortalRestStatusEnum.OK); - long accountd = 1; - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - PortalRestResponse<String> actualResponse = basicAuthAccountController.deleteAccount(mockedRequest, - mockedResponse, accountd); - assertEquals(actualResponse, expectedResponse); - } - - @Test - public void deleteAccountIfNotSuperAdminTest() throws Exception { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage("Authorization Required"); - expectedResponse.setResponse("Admin Only Operation! "); - expectedResponse.setStatus(PortalRestStatusEnum.ERROR); - long accountd = 1; - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - PortalRestResponse<String> actualResponse = basicAuthAccountController.deleteAccount(mockedRequest, - mockedResponse, accountd); - System.out.println(actualResponse); - assertEquals(actualResponse, expectedResponse); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/CommonWidgetControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/CommonWidgetControllerTest.java deleted file mode 100644 index eae8ec07..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/CommonWidgetControllerTest.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertTrue; - -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.MockitoAnnotations; -import org.openecomp.portalapp.portal.controller.CommonWidgetController; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; - -public class CommonWidgetControllerTest { - - @Mock - DashboardSearchService dashboardSearchService = new DashboardSearchServiceImpl(); - - @InjectMocks - CommonWidgetController commonWidgetController = new CommonWidgetController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - @SuppressWarnings("unchecked") - @Test - public void getWidgetDataTest() { - String resourceType = "Test"; - PortalRestResponse<CommonWidgetMeta> acutualPoratlRestResponse = null; - @SuppressWarnings("rawtypes") - PortalRestResponse ecpectedPortalRestResponse = new PortalRestResponse(); - ecpectedPortalRestResponse.setMessage("Unexpected resource type Test"); - ecpectedPortalRestResponse.setResponse(null); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - acutualPoratlRestResponse = commonWidgetController.getWidgetData(mockedRequest, resourceType); - assertTrue(acutualPoratlRestResponse.equals(ecpectedPortalRestResponse)); - - } - - @SuppressWarnings("unchecked") - @Test - public void getWidgetDataTestNew() { - String resourceType = "EVENTS"; - PortalRestResponse<CommonWidgetMeta> acutualPoratlRestResponse = null; - @SuppressWarnings("rawtypes") - PortalRestResponse ecpectedPortalRestResponse = new PortalRestResponse(); - ecpectedPortalRestResponse.setMessage("success"); - ecpectedPortalRestResponse.setResponse(null); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); - acutualPoratlRestResponse = commonWidgetController.getWidgetData(mockedRequest, resourceType); - assertTrue(acutualPoratlRestResponse.equals(ecpectedPortalRestResponse)); - - } - - @SuppressWarnings("unchecked") - @Test - public void getWidgetDataExceptionTest() { - String resourceType = "null"; - PortalRestResponse<CommonWidgetMeta> acutualPoratlRestResponse = null; - @SuppressWarnings("rawtypes") - PortalRestResponse ecpectedPortalRestResponse = new PortalRestResponse(); - ecpectedPortalRestResponse.setMessage("Unexpected resource type null"); - ecpectedPortalRestResponse.setResponse(null); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - acutualPoratlRestResponse = commonWidgetController.getWidgetData(mockedRequest, resourceType); - assertTrue(acutualPoratlRestResponse.equals(ecpectedPortalRestResponse)); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ConsulClientControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ConsulClientControllerTest.java deleted file mode 100644 index eda17409..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ConsulClientControllerTest.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertTrue; - -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.openecomp.portalapp.portal.controller.ConsulClientController; -import org.openecomp.portalapp.portal.domain.BEProperty; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; - -import com.orbitz.consul.ConsulException; -import com.orbitz.consul.model.health.ServiceHealth; - -import io.searchbox.client.config.exception.NoServerConfiguredException; - -public class ConsulClientControllerTest { - - @Mock - ConsulHealthService consulHealthService = new ConsulHealthServiceImpl(); - - @InjectMocks - ConsulClientController consulClientController = new ConsulClientController(); - - NoServerConfiguredException noServerConfiguredException = new NoServerConfiguredException(null); - - String service = "Test"; - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - ConsulException consulException = new ConsulException(nullPointerException); - - @Test - public void getServiceLocationTest() { - PortalRestResponse<BEProperty> ecpectedPortalRestResponse = new PortalRestResponse<BEProperty>(); - ecpectedPortalRestResponse.setMessage("Success!"); - ecpectedPortalRestResponse.setResponse(null); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); - PortalRestResponse<String> actualPortalRestRespone = new PortalRestResponse<String>(); - actualPortalRestRespone = consulClientController.getServiceLocation(mockedRequest, mockedResponse, service); - assertTrue(actualPortalRestRespone.equals(ecpectedPortalRestResponse)); - } - - @Test - public void getServiceLocationExceptionTest() { - PortalRestResponse<BEProperty> ecpectedPortalRestResponse = new PortalRestResponse<BEProperty>(); - ecpectedPortalRestResponse.setMessage("Warning!"); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.WARN); - PortalRestResponse<String> actualPortalRestRespone = new PortalRestResponse<String>(); - Mockito.when(consulHealthService.getServiceLocation(service, null)).thenThrow(noServerConfiguredException); - actualPortalRestRespone = consulClientController.getServiceLocation(mockedRequest, mockedResponse, service); - assertTrue(actualPortalRestRespone.getMessage().equals(ecpectedPortalRestResponse.getMessage())); - assertTrue(actualPortalRestRespone.getStatus().equals(ecpectedPortalRestResponse.getStatus())); - - } - - @Test - public void getServiceLocationExceptionConsulExceptionTest() { - PortalRestResponse<BEProperty> ecpectedPortalRestResponse = new PortalRestResponse<BEProperty>(); - ecpectedPortalRestResponse.setMessage("Error!"); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - PortalRestResponse<String> actualPortalRestRespone = new PortalRestResponse<String>(); - Mockito.when(consulHealthService.getServiceLocation(service, null)).thenThrow(consulException); - actualPortalRestRespone = consulClientController.getServiceLocation(mockedRequest, mockedResponse, service); - assertTrue(actualPortalRestRespone.getMessage().equals(ecpectedPortalRestResponse.getMessage())); - assertTrue(actualPortalRestRespone.getStatus().equals(ecpectedPortalRestResponse.getStatus())); - } - - public PortalRestResponse<List<ServiceHealth>> successResponse() { - PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = new PortalRestResponse<List<ServiceHealth>>(); - List<ServiceHealth> healths = new ArrayList<ServiceHealth>(); - ecpectedPortalRestResponse.setMessage("Success!"); - ecpectedPortalRestResponse.setResponse(healths); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); - return ecpectedPortalRestResponse; - } - - public PortalRestResponse<List<ServiceHealth>> errorResponse() { - PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = new PortalRestResponse<List<ServiceHealth>>(); - List<ServiceHealth> healths = new ArrayList<ServiceHealth>(); - ecpectedPortalRestResponse.setMessage("Error!"); - ecpectedPortalRestResponse.setResponse(healths); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - return ecpectedPortalRestResponse; - } - - @Test - public void getAllHealthyNodesTest() { - PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = successResponse(); - PortalRestResponse<List<ServiceHealth>> actualPortalRestRespone = new PortalRestResponse<List<ServiceHealth>>(); - actualPortalRestRespone = consulClientController.getAllHealthyNodes(mockedRequest, mockedResponse, service); - assertTrue(actualPortalRestRespone.equals(ecpectedPortalRestResponse)); - - } - - @Test - public void getAllHealthyNodesExceptionTest() { - PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = errorResponse(); - PortalRestResponse<List<ServiceHealth>> actualPortalRestRespone = new PortalRestResponse<List<ServiceHealth>>(); - Mockito.when(consulHealthService.getAllHealthyNodes(service)).thenThrow(consulException); - actualPortalRestRespone = consulClientController.getAllHealthyNodes(mockedRequest, mockedResponse, service); - assertTrue(actualPortalRestRespone.equals(ecpectedPortalRestResponse)); - } - - @Test - public void getAllNodesTest() { - PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = successResponse(); - PortalRestResponse<List<ServiceHealth>> actualPortalRestRespone = new PortalRestResponse<List<ServiceHealth>>(); - actualPortalRestRespone = consulClientController.getAllNodes(mockedRequest, mockedResponse, service); - assertTrue(actualPortalRestRespone.equals(ecpectedPortalRestResponse)); - } - - @Test - public void getAllNodesExceptionTest() { - PortalRestResponse<List<ServiceHealth>> ecpectedPortalRestResponse = errorResponse(); - PortalRestResponse<List<ServiceHealth>> actualPortalRestRespone = new PortalRestResponse<List<ServiceHealth>>(); - Mockito.when(consulHealthService.getAllNodes(service)).thenThrow(consulException); - actualPortalRestRespone = consulClientController.getAllNodes(mockedRequest, mockedResponse, service); - assertTrue(actualPortalRestRespone.equals(ecpectedPortalRestResponse)); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardControllerTest.java deleted file mode 100644 index eed560de..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardControllerTest.java +++ /dev/null @@ -1,427 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -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.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.controller.DashboardController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.CommonWidget; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.support.CollaborateList; -import org.openecomp.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({EPUserUtils.class, CollaborateList.class, SystemProperties.class, EPCommonSystemProperties.class}) -public class DashboardControllerTest { - - @Mock - DashboardSearchService searchService = new DashboardSearchServiceImpl(); - - @InjectMocks - DashboardController dashboardController = new DashboardController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - - NullPointerException nullPointerException = new NullPointerException(); - - MockEPUser mockUser = new MockEPUser(); - - public CommonWidgetMeta mockCommonWidgetMeta() { - CommonWidgetMeta commonWidgetMeta= new CommonWidgetMeta(); - List<CommonWidget> widgetList = new ArrayList<>(); - CommonWidget commonWidget = new CommonWidget(); - commonWidget.setId((long) 1); - commonWidget.setCategory("test"); - commonWidget.setHref("testhref"); - commonWidget.setTitle("testTitle"); - commonWidget.setContent("testcontent"); - commonWidget.setEventDate("testDate"); - commonWidget.setSortOrder(1); - widgetList.add(commonWidget); - commonWidgetMeta.setItems(widgetList); - - return commonWidgetMeta; - } - - public CommonWidget mockCommonWidget() { - - CommonWidget commonWidget = new CommonWidget(); - commonWidget.setId((long) 1); - commonWidget.setCategory("test"); - commonWidget.setHref("testhref"); - commonWidget.setTitle("testTitle"); - commonWidget.setContent("testcontent"); - commonWidget.setEventDate("testDate"); - commonWidget.setSortOrder(1); - - return commonWidget; - } - - - @Test - public void getWidgetDataTest() throws IOException { - - String resourceType = null; - PortalRestResponse<CommonWidgetMeta> expectedData = new PortalRestResponse<CommonWidgetMeta>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("Unexpected resource type null"); - expectedData.setResponse(null); - - PortalRestResponse<CommonWidgetMeta> actualResponse = dashboardController.getWidgetData(mockedRequest, resourceType); - assertEquals(expectedData,actualResponse); - } - - @Test - public void getWidgetDataWithValidResourceTest() throws IOException { - String resourceType = "EVENTS"; - CommonWidgetMeta commonWidgetMeta= mockCommonWidgetMeta(); - commonWidgetMeta.setCategory(null); - - Mockito.when(searchService.getWidgetData(resourceType)).thenReturn(commonWidgetMeta); - PortalRestResponse<CommonWidgetMeta> expectedData = new PortalRestResponse<CommonWidgetMeta>(); - expectedData.setStatus(PortalRestStatusEnum.OK); - expectedData.setMessage("success"); - expectedData.setResponse(commonWidgetMeta); - - PortalRestResponse<CommonWidgetMeta> actualResponse = dashboardController.getWidgetData(mockedRequest, resourceType); - System.out.println(actualResponse); - assertEquals(expectedData,actualResponse); - } - - @Test - public void saveWidgetDataBulkNullTest() throws IOException { - CommonWidgetMeta commonWidgetMeta= mockCommonWidgetMeta(); - commonWidgetMeta.setCategory(null); - - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("ERROR"); - expectedData.setResponse("Category cannot be null or empty"); - - PortalRestResponse<String> actualResponse = dashboardController.saveWidgetDataBulk(commonWidgetMeta); - assertEquals(expectedData,actualResponse); - } - - @Test - public void saveWidgetUnexpectedDataBulkTest() throws IOException { - CommonWidgetMeta commonWidgetMeta= mockCommonWidgetMeta(); - commonWidgetMeta.setCategory("Unexpected Data"); - - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("Unexpected resource type Unexpected Data"); - expectedData.setResponse(null); - - PortalRestResponse<String> actualResponse = dashboardController.saveWidgetDataBulk(commonWidgetMeta); - assertEquals(expectedData,actualResponse); - - } - - @Test - public void saveWidgetInvalidDataBulkTest() throws IOException { - CommonWidgetMeta commonWidgetMeta= mockCommonWidgetMeta(); - commonWidgetMeta.setCategory("EVENTS"); - - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("Invalid category: test"); - expectedData.setResponse(null); - - PortalRestResponse<String> actualResponse = dashboardController.saveWidgetDataBulk(commonWidgetMeta); - assertEquals(expectedData,actualResponse); - } - - @Test - public void saveWidgetDataBulkTest() throws IOException { - - List<CommonWidget> widgetList = new ArrayList<>(); - CommonWidget commonWidget = new CommonWidget("EVENTS", "http://test.com", "testTitle", "testcontent", "2017-07-01", 1); - widgetList.add(commonWidget); - CommonWidgetMeta commonWidgetMeta= new CommonWidgetMeta("EVENTS", widgetList); - - - - /* commonWidgetMeta.setItems(widgetList); - - commonWidgetMeta.setCategory("EVENTS");*/ - - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.OK); - expectedData.setMessage("success"); - expectedData.setResponse("success"); - - Mockito.when(searchService.saveWidgetDataBulk(commonWidgetMeta)).thenReturn("success"); - - PortalRestResponse<String> actualResponse = dashboardController.saveWidgetDataBulk(commonWidgetMeta); - assertEquals(expectedData,actualResponse); - } - - @Test - public void saveWidgetDataNullTest() throws IOException { - - CommonWidget commonWidget = mockCommonWidget(); - commonWidget.setId((long)1); - commonWidget.setContent("test"); - commonWidget.setCategory(null); - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("ERROR"); - expectedData.setResponse("Category cannot be null or empty"); - - PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget); - assertEquals(expectedData,actualResponse); - - } - - @Test - public void saveWidgetDataErrorTest() throws IOException { - - CommonWidget commonWidget = mockCommonWidget(); - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("Invalid category: test"); - expectedData.setResponse(null); - - PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget); - assertEquals(expectedData,actualResponse); - } - - @Test - public void saveWidgetDataTest() throws IOException { - - CommonWidgetMeta commonWidgetMeta= new CommonWidgetMeta(); - List<CommonWidget> widgetList = new ArrayList<>(); - CommonWidget commonWidget = new CommonWidget(); - commonWidget.setId((long) 1); - commonWidget.setCategory("EVENTS"); - commonWidget.setHref("http://test.com"); - commonWidget.setTitle("testTitle"); - commonWidget.setContent("testcontent"); - commonWidget.setEventDate("2017-07-01"); - commonWidget.setSortOrder(1); - widgetList.add(commonWidget); - commonWidgetMeta.setItems(widgetList); - - commonWidgetMeta.setCategory("EVENTS"); - - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.OK); - expectedData.setMessage("success"); - expectedData.setResponse("success"); - - Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn("success"); - - PortalRestResponse<String> actualResponse = dashboardController.saveWidgetData(commonWidget); - assertEquals(expectedData,actualResponse); - - } - - @Test - public void deleteWidgetDataTest() throws IOException { - - CommonWidget commonWidget = mockCommonWidget(); - - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.OK); - expectedData.setMessage("success"); - expectedData.setResponse(null); - - Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn("success"); - - PortalRestResponse<String> actualResponse = dashboardController.deleteWidgetData(commonWidget); - assertEquals(expectedData,actualResponse); - - } - - @Test - public void getActiveUsersTest(){ - List<String> activeUsers = new ArrayList<>(); - List<String> expectedUsersList = new ArrayList<>(); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - String userId = user.getOrgUserId(); - Mockito.when(searchService.getRelatedUsers(userId)).thenReturn(activeUsers); - expectedUsersList= dashboardController.getActiveUsers(mockedRequest); - assertEquals(expectedUsersList, activeUsers); - } - - - @Test - public void getActiveUsersExceptionTest(){ - List<String> activeUsers = new ArrayList<>(); - List<String> expectedUsersList = new ArrayList<>(); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - String userId = user.getOrgUserId(); - Mockito.when(searchService.getRelatedUsers(userId)).thenThrow(nullPointerException); - expectedUsersList = dashboardController.getActiveUsers(mockedRequest); - assertEquals(expectedUsersList, activeUsers); - } - - @Test - public void getOnlineUserUpdateRateTest(){ - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.OK); - expectedData.setMessage("success"); - expectedData.setResponse("{onlineUserUpdateRate=1400000, onlineUserUpdateDuration=1400000}"); - - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.ONLINE_USER_UPDATE_RATE)).thenReturn("1400"); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.ONLINE_USER_UPDATE_DURATION)).thenReturn("1400"); - - PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getOnlineUserUpdateRate(mockedRequest); - assertEquals(expectedData.getStatus(),actualResponse.getStatus()); - } - - @Test - public void getOnlineUserUpdateRateExceptionTest(){ - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("java.lang.NullPointerException"); - expectedData.setResponse(null); - - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.ONLINE_USER_UPDATE_RATE)).thenThrow(nullPointerException); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.ONLINE_USER_UPDATE_DURATION)).thenThrow(nullPointerException); - - PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getOnlineUserUpdateRate(mockedRequest); - assertEquals(expectedData,actualResponse); - } - - @Test - public void getWindowWidthThresholdForRightMenuTest(){ - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.OK); - expectedData.setMessage("success"); - expectedData.setResponse("{windowWidth=1400}"); - - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_RIGHT_MENU)).thenReturn("1400"); - - PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getWindowWidthThresholdForRightMenu(mockedRequest); - assertEquals(expectedData.getStatus(),actualResponse.getStatus()); - } - - @Test - public void getWindowWidthThresholdForRightMenuExceptionTest(){ - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("java.lang.NullPointerException"); - expectedData.setResponse(null); - - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_RIGHT_MENU)).thenThrow(nullPointerException); - - PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getWindowWidthThresholdForRightMenu(mockedRequest); - assertEquals(expectedData,actualResponse); - } - - @Test - public void getWindowWidthThresholdForLeftMenuTest(){ - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.OK); - expectedData.setMessage("success"); - expectedData.setResponse("{windowWidth=1400}"); - - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_LEFT_MENU)).thenReturn("1400"); - - PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getWindowWidthThresholdForLeftMenu(mockedRequest); - assertEquals(expectedData.getStatus(),actualResponse.getStatus()); - } - - @Test - public void getWindowWidthThresholdForLeftMenuExceptionTest(){ - PortalRestResponse<String> expectedData = new PortalRestResponse<String>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("java.lang.NullPointerException"); - expectedData.setResponse(null); - - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.WINDOW_WIDTH_THRESHOLD_LEFT_MENU)).thenThrow(nullPointerException); - - PortalRestResponse<Map<String, String>> actualResponse = dashboardController.getWindowWidthThresholdForLeftMenu(mockedRequest); - assertEquals(expectedData,actualResponse); - } - - @Test - public void getActiveUsersNullTest(){ - PortalRestResponse<List<String>> expectedData = new PortalRestResponse<List<String>>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("User object is null? - check logs"); - expectedData.setResponse(new ArrayList<>()); - - PortalRestResponse<List<String>> actualResponse = dashboardController.activeUsers(mockedRequest); - assertEquals(expectedData,actualResponse); - } - - @Test - public void activeUsersTest(){ - EPUser user = mockUser.mockEPUser(); - PortalRestResponse<List<String>> expectedData = new PortalRestResponse<List<String>>(); - expectedData.setStatus(PortalRestStatusEnum.OK); - expectedData.setMessage("success"); - expectedData.setResponse(new ArrayList<>()); - PowerMockito.mockStatic(EPUserUtils.class); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - PortalRestResponse<List<String>> actualResponse = dashboardController.activeUsers(mockedRequest); - assertEquals(expectedData,actualResponse); - } - -// @Test -// public void activeUsersExceptionTest(){ -// EPUser user = mockUser.mockEPUser(); -// user.setLoginId("test"); -// String loginId = "abc"; -// PortalRestResponse<List<String>> expectedData = new PortalRestResponse<List<String>>(); -// expectedData.setStatus(PortalRestStatusEnum.ERROR); -// expectedData.setMessage("java.lang.NullPointerException"); -// expectedData.setResponse(null); -// -//// PowerMockito.mockStatic(EPUserUtils.class); -// Mockito.when(searchService.getRelatedUsers(user.getLoginId(user.getLoginId()))).thenReturn(nullPointerException); -// PortalRestResponse<List<String>> actualResponse = dashboardController.activeUsers(mockedRequest); -// System.out.println(actualResponse); -// //assertEquals(expectedData,actualResponse); -// } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/EPFusionBaseControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/EPFusionBaseControllerTest.java deleted file mode 100644 index 683738b9..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/EPFusionBaseControllerTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import java.util.HashMap; -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.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.controller.EPFusionBaseController; -import org.openecomp.portalapp.portal.controller.DashboardController; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.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({EPUserUtils.class, SystemProperties.class}) -public class EPFusionBaseControllerTest { - - @Mock - DashboardSearchService searchService = new DashboardSearchServiceImpl(); - - @InjectMocks - EPFusionBaseController epFusionBaseController; /*= mock(EPFusionBaseController.class);*/ - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - - NullPointerException nullPointerException = new NullPointerException(); - - MockEPUser mockUser = new MockEPUser(); - - @Test - public void messagesTest(){ - Map<String, Object> expectedData = new HashMap<String, Object>(); - Map<String, Object> actualData = null; - - PowerMockito.mockStatic(SystemProperties.class); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)).then(null); - actualData = epFusionBaseController.messages(mockedRequest); - System.out.println(); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAccessRolesControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAccessRolesControllerTest.java deleted file mode 100644 index d2e1b13c..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAccessRolesControllerTest.java +++ /dev/null @@ -1,509 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -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.openecomp.portalapp.portal.controller.ExternalAccessRolesController; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.ExternalAccessRolesService; -import org.openecomp.portalapp.portal.service.ExternalAccessRolesServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.CentralRole; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.domain.AuditLog; -import org.openecomp.portalsdk.core.domain.Role; -import org.springframework.http.HttpStatus; -import org.springframework.web.client.HttpClientErrorException; -public class ExternalAccessRolesControllerTest { - - @Mock - ExternalAccessRolesService externalAccessRolesService = new ExternalAccessRolesServiceImpl(); - - @InjectMocks - ExternalAccessRolesController externalAccessRolesController = new ExternalAccessRolesController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - @Mock - AuditLog auditLog = new AuditLog(); - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - HttpClientErrorException httpClientErrorException = new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Failed"); - - MockEPUser mockUser = new MockEPUser(); - String loginId = "guestT"; - String uebKey = "testUebKey"; - - @Test - public void getUserTest() throws Exception { - List<EPUser> userList = new ArrayList<>(); - Mockito.when(externalAccessRolesService.getUser(loginId)).thenReturn(userList); - assertNull(externalAccessRolesController.getUser(mockedRequest, mockedResponse, loginId)); - } - - @Test - public void getUserExceptionTest() throws Exception { - Mockito.when(externalAccessRolesService.getUser(loginId)) - .thenThrow(nullPointerException); - assertNull(externalAccessRolesController.getUser(mockedRequest, mockedResponse, loginId)); - } - - public EPApp mockApp() - { - EPApp app = new EPApp(); - app.setName("Test"); - app.setImageUrl("test"); - app.setDescription("test"); - app.setNotes("test"); - app.setUrl("test"); - app.setId((long) 1); - app.setAppRestEndpoint("test"); - app.setAlternateUrl("test"); - app.setName("test"); - app.setMlAppName("test"); - app.setMlAppAdminId("test"); - app.setUsername("test"); - app.setAppPassword("test"); - app.setOpen(false); - app.setEnabled(false); - app.setUebKey("test"); - app.setUebSecret("test"); - app.setUebTopicName("test"); - app.setAppType(1); - return app; - } - - @Test - public void getRolesForAppTest() throws Exception { - List<EPApp> applicationList = new ArrayList<EPApp>(); - List<CentralRole> answer = new ArrayList<>(); - EPApp app = mockApp(); - applicationList.add(app); - Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); - Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app); - Mockito.when(externalAccessRolesService.getRolesForApp(mockedRequest.getHeader(uebKey))).thenReturn(answer); - assertEquals(externalAccessRolesController.getRolesForApp(mockedRequest, mockedResponse), answer); - } - - @Test - public void getRolesForAppExceptionTest() throws Exception { - List<EPApp> applicationList = new ArrayList<EPApp>(); - List<CentralRole> answer = new ArrayList<>(); - EPApp app = mockApp(); - applicationList.add(app); - Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); - Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app); - Mockito.when(externalAccessRolesService.getRolesForApp(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - assertNull(externalAccessRolesController.getRolesForApp(mockedRequest, mockedResponse)); - } - - @Test - public void getRoleFunctionsListTest() throws Exception { - List<CentralRoleFunction> answer = new ArrayList<>(); - Mockito.when(externalAccessRolesService.getRoleFuncList(mockedRequest.getHeader(uebKey))).thenReturn(answer); - assertEquals(externalAccessRolesController.getRoleFunctionsList(mockedRequest, mockedResponse), answer); - } - - @Test - public void getRoleFunctionsListExceptionTest() throws Exception { - Mockito.when(externalAccessRolesService.getRoleFuncList(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - assertNull(externalAccessRolesController.getRoleFunctionsList(mockedRequest, mockedResponse)); - } - - @Test - public void getRoleInfoTest() throws Exception { - CentralRole answer = new CentralRole(); - long roleId = 1; - Mockito.when(externalAccessRolesService.getRoleInfo(roleId, mockedRequest.getHeader(uebKey))) - .thenReturn(answer); - assertEquals(externalAccessRolesController.getRoleInfo(mockedRequest, mockedResponse, roleId), answer); - } - - @Test - public void getRoleInfoExceptionTest() throws Exception { - long roleId = 1; - Mockito.when(externalAccessRolesService.getRoleInfo(roleId, mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - assertNull(externalAccessRolesController.getRoleInfo(mockedRequest, mockedResponse, roleId)); - } - - @Test - public void getRoleFunctionTest() throws Exception { - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - String code = "test_menu"; - Mockito.when(externalAccessRolesService.getRoleFunction(code, mockedRequest.getHeader(uebKey))) - .thenReturn(centralRoleFunction); - assertEquals(externalAccessRolesController.getRoleFunction(mockedRequest, mockedResponse, code), - centralRoleFunction); - } - - @Test - public void getRoleFunctionExceptionTest() throws Exception { - String code = "test_menu"; - Mockito.when(externalAccessRolesService.getRoleFunction(code, mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - assertNull(externalAccessRolesController.getRoleFunction(mockedRequest, mockedResponse, code)); - } - - @Test - public void saveRoleFunctionIfIsIsNotDeletedTest() throws Exception { - List<EPApp> applicationList = new ArrayList<EPApp>(); - EPApp app = mockApp(); - applicationList.add(app); - Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - String data = null; - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralRoleFunction, app)).thenReturn(false); - portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void saveRoleFunctionExceptionTest() throws Exception { - List<EPApp> applicationList = new ArrayList<EPApp>(); - EPApp app = mockApp(); - applicationList.add(app); - Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - String data = null; - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralRoleFunction, app)).thenThrow(nullPointerException); - portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data); - System.out.println(portalRestResponse); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void saveRoleFunctionTest() throws Exception { - List<EPApp> applicationList = new ArrayList<EPApp>(); - List<CentralRole> answer = new ArrayList<>(); - EPApp app = mockApp(); - applicationList.add(app); - Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList); - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - String data = null; - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - Mockito.when(externalAccessRolesService.saveCentralRoleFunction(centralRoleFunction, app)).thenReturn(true); - portalRestResponse = externalAccessRolesController.saveRoleFunction(mockedRequest, mockedResponse, data); - System.out.println(portalRestResponse); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - -// @Test -// public void deleteRoleFunctionTest() throws Exception { -// PortalRestResponse<String> portalRestResponse = null; -// PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); -// expectedportalRestResponse.setMessage("Successfully Deleted"); -// expectedportalRestResponse.setResponse("Success"); -// PortalRestStatusEnum portalRestStatusEnum = null; -// EPUser user = mockUser.mockEPUser(); -// EPApp app = mockApp(); -// expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); -// String code ="testNew"; -// Mockito.when(externalAccessRolesService.getUser(mockedRequest.getHeader("LOGIN_ID"))).thenReturn((List<EPUser>) user); -// Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader("UEBKEY")).get(0)).thenReturn(app); -// Mockito.when(externalAccessRolesService.deleteCentralRoleFunction(code, app)).thenReturn(true); -// portalRestResponse = externalAccessRolesController.deleteRoleFunction(mockedRequest, mockedResponse, code); -// assertEquals(portalRestResponse, expectedportalRestResponse); -// } - - @Test - public void getActiveRolesTest() throws Exception { - List<CentralRole> cenRole = new ArrayList<>(); - Mockito.when(externalAccessRolesService.getActiveRoles(mockedRequest.getHeader(uebKey))).thenReturn(cenRole); - List<CentralRole> expectedCenRole = externalAccessRolesController.getActiveRoles(mockedRequest, mockedResponse); - assertEquals(expectedCenRole, cenRole); - } - - @Test - public void getActiveRolesExceptionTest() throws Exception { - Mockito.when(externalAccessRolesService.getActiveRoles(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - assertNull(externalAccessRolesController.getActiveRoles(mockedRequest, mockedResponse)); - } - - @Test - public void deleteDependcyRoleRecordExceptionTest() throws Exception { - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Failed to deleteDependencyRoleRecord"); - expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - long roleId = 123; - portalRestResponse = externalAccessRolesController.deleteDependencyRoleRecord(mockedRequest, mockedResponse, roleId); - assertEquals(expectedportalRestResponse, portalRestResponse); - } - - @Test - public void bulkUploadFunctionsTest() throws Exception { - Integer result = 0; - Mockito.when(externalAccessRolesService.bulkUploadFunctions(mockedRequest.getHeader(uebKey))) - .thenReturn(result); - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Successfully added: 0"); - expectedportalRestResponse.setResponse("Success"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); - portalRestResponse = externalAccessRolesController.bulkUploadFunctions(mockedRequest, mockedResponse); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void bulkUploadFunctionsExceptionTest() throws Exception { - Mockito.when(externalAccessRolesService.bulkUploadFunctions(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Failed to bulkUploadFunctions"); - expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - portalRestResponse = externalAccessRolesController.bulkUploadFunctions(mockedRequest, mockedResponse); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void bulkUploadRolesTest() throws Exception { - Integer result = 0; - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Successfully added: 0"); - expectedportalRestResponse.setResponse("Success"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); - Mockito.when(externalAccessRolesService.bulkUploadRoles(mockedRequest.getHeader(uebKey))).thenReturn(result); - portalRestResponse = externalAccessRolesController.bulkUploadRoles(mockedRequest, mockedResponse); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void bulkUploadRolesTestException() throws Exception { - Mockito.when(externalAccessRolesService.bulkUploadRoles(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Failed to bulkUploadRoles"); - expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - portalRestResponse = externalAccessRolesController.bulkUploadRoles(mockedRequest, mockedResponse); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void bulkUploadRoleFunctionsTest() throws Exception { - Integer result = 0; - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Successfully added: 0"); - expectedportalRestResponse.setResponse("Success"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); - Mockito.when(externalAccessRolesService.bulkUploadRolesFunctions(mockedRequest.getHeader(uebKey))) - .thenReturn(result); - portalRestResponse = externalAccessRolesController.bulkUploadRoleFunctions(mockedRequest, mockedResponse); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void bulkUploadRoleFunctionsException() throws Exception { - Mockito.when(externalAccessRolesService.bulkUploadRolesFunctions(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Failed to bulkUploadRoleFunctions"); - expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - portalRestResponse = externalAccessRolesController.bulkUploadRoleFunctions(mockedRequest, mockedResponse); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void bulkUploadUserRolesTest() throws Exception { - Integer result = 0; - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Successfully added: 0"); - expectedportalRestResponse.setResponse("Success"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); - Mockito.when(externalAccessRolesService.bulkUploadUserRoles(mockedRequest.getHeader(uebKey))) - .thenReturn(result); - portalRestResponse = externalAccessRolesController.bulkUploadUserRoles(mockedRequest, mockedResponse); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void bulkUploadUserRolesExceptionTest() throws Exception { - Mockito.when(externalAccessRolesService.bulkUploadUserRoles(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Failed to bulkUploadUserRoles"); - expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - portalRestResponse = externalAccessRolesController.bulkUploadUserRoles(mockedRequest, mockedResponse); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void bulkUploadPartnerFunctionsTest() throws Exception { - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Successfully added"); - expectedportalRestResponse.setResponse("Success"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); - portalRestResponse = externalAccessRolesController.bulkUploadPartnerFunctions(mockedRequest, mockedResponse, null); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - - @Test - public void bulkUploadPartnerRolesTest() throws Exception { - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Successfully added"); - expectedportalRestResponse.setResponse("Success"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); - List<Role> upload = new ArrayList<>(); - portalRestResponse = externalAccessRolesController.bulkUploadPartnerRoles(mockedRequest, mockedResponse, - upload); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void bulkUploadPartnerRolesExceptionTest() throws Exception - { - ExternalAccessRolesService externalAccessRolesService = null; - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Successfully added"); - expectedportalRestResponse.setResponse("Success"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); - List<Role> upload = new ArrayList<>(); - portalRestResponse = externalAccessRolesController.bulkUploadPartnerRoles(mockedRequest, mockedResponse, - upload); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void getMenuFunctionsTest() throws Exception { - List<String> functionsList = new ArrayList<>(); - Mockito.when(externalAccessRolesService.getMenuFunctionsList(mockedRequest.getHeader(uebKey))) - .thenReturn(functionsList); - List<String> expectedFunctionsList = externalAccessRolesController.getMenuFunctions(mockedRequest, - mockedResponse); - assertEquals(functionsList, expectedFunctionsList); - } - - @Test - public void getMenuFunctionsExceptionTest() throws Exception { - Mockito.when(externalAccessRolesService.getMenuFunctionsList(mockedRequest.getHeader(uebKey))) - .thenThrow(httpClientErrorException); - assertNull(externalAccessRolesController.getMenuFunctions(mockedRequest, mockedResponse)); - } - -// @Test -// public void getUsersOfApplicationTest() throws Exception { -// List<String> users = new ArrayList<>(); -// Mockito.when(externalAccessRolesService.getAllUsers(mockedRequest.getHeader(uebKey))).thenReturn(users); -// List<String> expectedusers = externalAccessRolesController.getUsersOfApplication(mockedRequest, mockedResponse); -// assertEquals(users, expectedusers); -// } - -// @Test -// public void getUsersOfApplicationExceptionTest() throws Exception { -// Mockito.when(externalAccessRolesService.getAllUsers(mockedRequest.getHeader(uebKey))) -// .thenThrow(httpClientErrorException); -// assertNull(externalAccessRolesController.getUsersOfApplication(mockedRequest, mockedResponse)); -// } - - @Test - public void saveRoleExceptionTest() throws Exception { - Role role = new Role(); - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Failed to saveRole"); - expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - List<Role> upload = new ArrayList<>(); - portalRestResponse = externalAccessRolesController.saveRole(mockedRequest, mockedResponse,role); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - @Test - public void deleteRoleExceptionTest() throws Exception { - String role = "TestNew"; - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Failed to deleteRole for 'TestNew'"); - expectedportalRestResponse.setResponse("Failed"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - portalRestResponse = externalAccessRolesController.deleteRole(mockedRequest, mockedResponse,role); - assertEquals(portalRestResponse, expectedportalRestResponse); - } - - - @Test - public void bulkUploadPartnerRoleFunctionsTest() throws Exception { - PortalRestResponse<String> portalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Successfully added"); - expectedportalRestResponse.setResponse("Success"); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); - List<Role> upload = new ArrayList<>(); - portalRestResponse = externalAccessRolesController.bulkUploadPartnerRoleFunctions(mockedRequest, mockedResponse,upload); - assertEquals(portalRestResponse, expectedportalRestResponse); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAppsRestfulControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAppsRestfulControllerTest.java deleted file mode 100644 index 43860d45..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ExternalAppsRestfulControllerTest.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -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.openecomp.portalapp.portal.controller.ExternalAppsRestfulController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.EPLoginService; -import org.openecomp.portalapp.portal.service.EPLoginServiceImpl; -import org.openecomp.portalapp.portal.service.EPRoleService; -import org.openecomp.portalapp.portal.service.EPRoleServiceImpl; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalapp.portal.service.UserNotificationServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.service.DataAccessServiceImpl; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.slf4j.MDC; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({ MDC.class, EPCommonSystemProperties.class }) -public class ExternalAppsRestfulControllerTest { - - @InjectMocks - ExternalAppsRestfulController externalAppsRestfulController = new ExternalAppsRestfulController(); - @Mock - FunctionalMenuService functionalMenuService = new FunctionalMenuServiceImpl(); - - @Mock - EPLoginService epLoginService = new EPLoginServiceImpl(); - - @Mock - AdminRolesService adminRolesService = new AdminRolesServiceImpl(); - - @Mock - UserNotificationService userNotificationService = new UserNotificationServiceImpl(); - - @Mock - EPRoleService epRoleService = new EPRoleServiceImpl(); - - @Mock - EcompPortalUtils EcompPortalUtils = new EcompPortalUtils(); - - @Mock - DataAccessService DataAccessService = new DataAccessServiceImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - MockEPUser mockUser = new MockEPUser(); - - @Test(expected = Exception.class) - public void getFunctionalMenuItemsForUserIfUSerNullTest() throws - Exception - { - PowerMockito.mockStatic(EPCommonSystemProperties.class); - PowerMockito.mockStatic(MDC.class); - EPUser epUser = null; - String loginId = "guestT"; - Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test"); - Mockito.when(epLoginService.findUserWithoutPwd(loginId)).thenReturn(epUser); - externalAppsRestfulController.getFunctionalMenuItemsForUser(mockedRequest, - mockedResponse); - } - - @Test - public void getFunctionalMenuItemsForUserIfSuperAdminTest() throws Exception { - PowerMockito.mockStatic(EPCommonSystemProperties.class); - PowerMockito.mockStatic(MDC.class); - EPUser epUser = mockUser.mockEPUser(); - epUser.setId((long) 1); - epUser.setLoginId("guestT"); - String loginId = "guestT"; - Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test"); - Mockito.when(epLoginService.findUserWithoutPwd(loginId)).thenReturn(epUser); - List<FunctionalMenuItem> expectedList = new ArrayList<FunctionalMenuItem>(); - FunctionalMenuItem functionalMenuItem = new FunctionalMenuItem(); - expectedList.add(functionalMenuItem); - Mockito.when(mockedRequest.getHeader("LoginId")).thenReturn("guestT"); - Mockito.when(adminRolesService.isSuperAdmin(epUser)).thenReturn(true); - Mockito.when(functionalMenuService.getFunctionalMenuItems()).thenReturn(expectedList); - List<FunctionalMenuItem> actualList = externalAppsRestfulController.getFunctionalMenuItemsForUser(mockedRequest, - mockedResponse); - assertNull(actualList.get(0).menuId); - } - - @Test - public void getFunctionalMenuItemsForUserTest() throws Exception { - PowerMockito.mockStatic(EPCommonSystemProperties.class); - PowerMockito.mockStatic(MDC.class); - EPUser epUser = mockUser.mockEPUser(); - epUser.setId((long) 1); - epUser.setLoginId("guestT"); - String loginId = "guestT"; - Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test"); - Mockito.when(epLoginService.findUserWithoutPwd(loginId)).thenReturn(epUser); - List<FunctionalMenuItem> expectedList = new ArrayList<FunctionalMenuItem>(); - FunctionalMenuItem functionalMenuItem = new FunctionalMenuItem(); - expectedList.add(functionalMenuItem); - Mockito.when(mockedRequest.getHeader("LoginId")).thenReturn("guestT"); - Mockito.when(adminRolesService.isSuperAdmin(epUser)).thenReturn(false); - Mockito.when(functionalMenuService.getFunctionalMenuItemsForUser(epUser.getOrgUserId())) - .thenReturn(expectedList); - List<FunctionalMenuItem> actualList = externalAppsRestfulController.getFunctionalMenuItemsForUser(mockedRequest, - mockedResponse); - assertNull(actualList.get(0).menuId); - } - - @Test(expected = Exception.class) - public void getFavoritesForUserIfUserNullTest() throws Exception { - List<FavoritesFunctionalMenuItemJson> favorites = new ArrayList<FavoritesFunctionalMenuItemJson>(); - FavoritesFunctionalMenuItemJson favoritesFunctionalMenuItemJson = new FavoritesFunctionalMenuItemJson(); - favorites.add(favoritesFunctionalMenuItemJson); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - PowerMockito.mockStatic(MDC.class); - Mockito.when(mockedRequest.getHeader(EPCommonSystemProperties.MDC_LOGIN_ID)).thenReturn("Login_URL"); - Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test"); - EPUser epUser = null; - externalAppsRestfulController.getFavoritesForUser(mockedRequest, mockedResponse); - } - - @Test - public void getFavoritesForUserTest() throws Exception { - PowerMockito.mockStatic(EPCommonSystemProperties.class); - PowerMockito.mockStatic(MDC.class); - EPUser epUser = mockUser.mockEPUser(); - epUser.setId((long) 1); - epUser.setLoginId("guestT"); - String loginId = "guestT"; - Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test"); - List<FavoritesFunctionalMenuItemJson> favorites = new ArrayList<FavoritesFunctionalMenuItemJson>(); - FavoritesFunctionalMenuItemJson favoritesFunctionalMenuItemJson = new FavoritesFunctionalMenuItemJson(); - favorites.add(favoritesFunctionalMenuItemJson); - Mockito.when(mockedRequest.getHeader(EPCommonSystemProperties.MDC_LOGIN_ID)).thenReturn("Login_URL"); - Mockito.when(MDC.get(EPCommonSystemProperties.PARTNER_NAME)).thenReturn("Test"); - Mockito.when(epLoginService.findUserWithoutPwd("Login_URL")).thenReturn(epUser); - Mockito.when(functionalMenuService.getFavoriteItems(epUser.getId())).thenReturn(favorites); - List<FavoritesFunctionalMenuItemJson> actaulFavorites = externalAppsRestfulController - .getFavoritesForUser(mockedRequest, mockedResponse); - assertEquals(actaulFavorites.size(), 1); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/FunctionalMenuControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/FunctionalMenuControllerTest.java deleted file mode 100644 index 03e2107a..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/FunctionalMenuControllerTest.java +++ /dev/null @@ -1,506 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -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.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.mockito.runners.MockitoJUnitRunner; -import org.openecomp.portalapp.portal.controller.FunctionalMenuController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl; -import org.openecomp.portalapp.portal.service.SearchService; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole; -import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRolesList; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FieldsValidator.FieldName; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItemWithRoles; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.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 FunctionalMenuControllerTest extends MockitoTestSuite { - - String userid = "ab1234"; - - @Mock - FunctionalMenuService functionalMenuService = new FunctionalMenuServiceImpl(); - - @InjectMocks - FunctionalMenuController functionalMenuController = new FunctionalMenuController(); - - @Mock - private DataAccessService dataAccessService; - - @Mock - SearchService searchService; - - @Mock - AdminRolesService adminRolesService = new AdminRolesServiceImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - - @InjectMocks - EPUserUtils ePUserUtils = new EPUserUtils(); - - @Mock - EPUser epuser; - - MockEPUser mockUser = new MockEPUser(); - - List<BusinessCardApplicationRolesList> appRoles = new ArrayList<BusinessCardApplicationRolesList>(); - List<BusinessCardApplicationRolesList> appRolesActual = new ArrayList<BusinessCardApplicationRolesList>(); - - List<BusinessCardApplicationRole> userAppRoleList = new ArrayList<BusinessCardApplicationRole>(); - - public List<BusinessCardApplicationRole> mockBusinessCardApplicationRole() { - List<BusinessCardApplicationRole> userAppRoleList = new ArrayList<BusinessCardApplicationRole>(); - - BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole(); - businessCardApplicationRole.setRoleName("ADMIN"); - businessCardApplicationRole.setAppName("ASDC"); - - BusinessCardApplicationRole businessCardApplicationRole1 = new BusinessCardApplicationRole(); - businessCardApplicationRole1.setAppName("ASDC"); - businessCardApplicationRole1.setRoleName("Tester"); - - userAppRoleList.add(businessCardApplicationRole); - userAppRoleList.add(businessCardApplicationRole1); - return userAppRoleList; - } - - public List<BusinessCardApplicationRolesList> mockBusinessCardApplicationRolesList() { - List<BusinessCardApplicationRolesList> appRolesActual = new ArrayList<BusinessCardApplicationRolesList>(); - - BusinessCardApplicationRolesList businessCardApplicationRolesList = new BusinessCardApplicationRolesList(); - businessCardApplicationRolesList.setAppName("ASDC"); - - List<String> roleNames = new ArrayList<String>(); - roleNames.add("ADMIN"); - roleNames.add("Tester"); - businessCardApplicationRolesList.setRoleNames(roleNames); - - appRolesActual.add(businessCardApplicationRolesList); - return appRolesActual; - } - - @Test - public void getAppListTestIfAppAlredyExistsBusinessCardApplicationRolesList() throws IOException { - - userAppRoleList = mockBusinessCardApplicationRole(); - appRolesActual = mockBusinessCardApplicationRolesList(); - - Mockito.when(functionalMenuService.getUserAppRolesList(userid)).thenReturn(userAppRoleList); - - appRoles = functionalMenuController.getAppList(mockedRequest, userid); - - assertEquals(appRolesActual.size(), appRoles.size()); - assertEquals(appRolesActual.get(0).getAppName(), appRoles.get(0).getAppName()); - assertEquals(appRolesActual.get(0).getRoleNames(), appRoles.get(0).getRoleNames()); - - } - - @Test - public void getAppListTestIfAppDoesnotExistsInBusinessCardApplicationRolesList() throws IOException { - - userAppRoleList = mockBusinessCardApplicationRole(); - BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole(); - businessCardApplicationRole.setAppName("CCD"); - businessCardApplicationRole.setRoleName("ADMIN"); - userAppRoleList.add(businessCardApplicationRole); - appRolesActual = mockBusinessCardApplicationRolesList(); - BusinessCardApplicationRolesList businessCardApplicationRolesList = new BusinessCardApplicationRolesList(); - businessCardApplicationRolesList.setAppName("CCD"); - List<String> roleNames1 = new ArrayList<String>(); - roleNames1.add("ADMIN"); - businessCardApplicationRolesList.setRoleNames(roleNames1); - appRolesActual.add(businessCardApplicationRolesList); - Mockito.when(functionalMenuService.getUserAppRolesList(userid)).thenReturn(userAppRoleList); - appRoles = functionalMenuController.getAppList(mockedRequest, userid); - assertEquals(appRolesActual.size(), appRoles.size()); - assertEquals(appRolesActual.get(0).getAppName(), appRoles.get(0).getAppName()); - assertEquals(appRolesActual.get(0).getRoleNames(), appRoles.get(0).getRoleNames()); - assertEquals(appRolesActual.get(1).getAppName(), appRoles.get(1).getAppName()); - assertEquals(appRolesActual.get(1).getRoleNames(), appRoles.get(1).getRoleNames()); - - } - - @Test - public void regenerateAncestorTableTest() { - EPUser user = mockUser.mockEPUser(); - - HttpSession session = mockedRequest.getSession(); - session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - FieldsValidator acutualFieldValidator = null; - FieldsValidator expectedFieldValidator = new FieldsValidator(); - List<FieldName> fields = new ArrayList<>(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(fields); - expectedFieldValidator.setErrorCode(null); - Mockito.when(!adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(functionalMenuService.regenerateAncestorTable()).thenReturn(expectedFieldValidator); - acutualFieldValidator = functionalMenuController.regenerateAncestorTable(mockedRequest, mockedResponse); - assertTrue(acutualFieldValidator.equals(expectedFieldValidator)); - } - - @Test - public void getFunctionalMenuStaticInfoExceptionTest(){ - String fnMenuStaticactualResponse = null; - String fnMenuStaticexpectedResponse = null; - String orgUserIdStr = null; - - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(searchService.searchUserByUserId(orgUserIdStr)).thenReturn(user); - fnMenuStaticactualResponse = functionalMenuController.getFunctionalMenuStaticInfo(mockedRequest, mockedResponse); - - assertEquals(fnMenuStaticactualResponse, fnMenuStaticexpectedResponse); - - } - - @Test - public void getFunctionalMenuStaticInfoTest(){ - String fnMenuStaticactualResponse = null; - String fnMenuStaticexpectedResponse = "{\"firstName\":\"test\",\"lastName\":\"test\",\"last_login\":\"09/08/2017 03:48:13-0400\",\"userId\":\"guestT\",\"email\":\"test\"}"; - String orgUserIdStr = null; - - EPUser user = mockUser.mockEPUser(); - user.setEmail("test"); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(searchService.searchUserByUserId(orgUserIdStr)).thenReturn(user); - fnMenuStaticactualResponse = functionalMenuController.getFunctionalMenuStaticInfo(mockedRequest, mockedResponse); - assertEquals(fnMenuStaticactualResponse.length(), fnMenuStaticexpectedResponse.length()); - } - - @Test - public void getMenuItemsForAuthUserNullTest(){ - List<FunctionalMenuItem> actualmenuItems = null; - List<FunctionalMenuItem> expectedmenuItems = null; - - actualmenuItems = functionalMenuController.getMenuItemsForAuthUser(mockedRequest, mockedResponse); - assertEquals(actualmenuItems, expectedmenuItems); - } - - @Test - public void getMenuItemsForAuthUserIsSuperAdminTest(){ - List<FunctionalMenuItem> actualmenuItems = null; - List<FunctionalMenuItem> expectedmenuItems = new ArrayList<FunctionalMenuItem>(); - EPUser user = mockUser.mockEPUser(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - - actualmenuItems = functionalMenuController.getMenuItemsForAuthUser(mockedRequest, mockedResponse); - assertEquals(actualmenuItems, expectedmenuItems); - } - - @Test - public void getMenuItemsForAuthUserTest(){ - List<FunctionalMenuItem> actualmenuItems = null; - List<FunctionalMenuItem> expectedmenuItems = new ArrayList<FunctionalMenuItem>(); - EPUser user = mockUser.mockEPUser(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - - actualmenuItems = functionalMenuController.getMenuItemsForAuthUser(mockedRequest, mockedResponse); - assertEquals(actualmenuItems, expectedmenuItems); - } - - @Test - public void getFunctionalMenuItemDetailsBadPermissionTest(){ - Integer menuId = 1234; - FunctionalMenuItem actualmenuItem = null; - FunctionalMenuItem expectedmenuItem = null; - EPUser user = mockUser.mockEPUser(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - - actualmenuItem = functionalMenuController.getFunctionalMenuItemDetails(mockedRequest, menuId, mockedResponse); - assertEquals(actualmenuItem, expectedmenuItem); - } - - @Test - public void getFunctionalMenuItemDetailsTest(){ - Integer menuId = 1234; - FunctionalMenuItem actualmenuItem = null; - FunctionalMenuItem expectedmenuItem = null; - EPUser user = mockUser.mockEPUser(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(functionalMenuService.getFunctionalMenuItemDetails(menuId)).thenReturn(actualmenuItem); - - actualmenuItem = functionalMenuController.getFunctionalMenuItemDetails(mockedRequest, menuId, mockedResponse); - assertEquals(actualmenuItem, expectedmenuItem); - } - - @Test - public void getMenuItemsForEditingTest(){ - List<FunctionalMenuItem> actualMenuItems = null; - List<FunctionalMenuItem> expectedMenuItems = null; - EPUser user = mockUser.mockEPUser(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(functionalMenuService.getFunctionalMenuItems(true)).thenReturn(actualMenuItems); - - actualMenuItems = functionalMenuController.getMenuItemsForEditing(mockedRequest, mockedResponse); - assertEquals(actualMenuItems, expectedMenuItems); - } - - @Test - public void getMenuItemsForEditingBadPermissionsTest(){ - List<FunctionalMenuItem> actualMenuItems = null; - List<FunctionalMenuItem> expectedMenuItems = null; - EPUser user = mockUser.mockEPUser(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(functionalMenuService.getFunctionalMenuItems(true)).thenReturn(actualMenuItems); - - actualMenuItems = functionalMenuController.getMenuItemsForEditing(mockedRequest, mockedResponse); - assertEquals(actualMenuItems, expectedMenuItems); - } - - @Test - public void getMenuItemsForNotificationsTest(){ - List<FunctionalMenuItem> actualMenuItems = null; - List<FunctionalMenuItem> expectedMenuItems = new ArrayList<FunctionalMenuItem>(); - Mockito.when(functionalMenuService.getFunctionalMenuItemsForNotificationTree(false)).thenReturn(actualMenuItems); - - actualMenuItems = functionalMenuController.getMenuItemsForNotifications(mockedRequest, mockedResponse); - assertEquals(actualMenuItems, expectedMenuItems); - } - - @Test - public void getMenuItemsForAppTest(){ - Integer appId = 1234; - List<FunctionalMenuItem> actualMenuItems = null; - List<FunctionalMenuItem> expectedMenuItems = null; - Mockito.when(functionalMenuService.getFunctionalMenuItemsForApp(appId)).thenReturn(actualMenuItems); - - actualMenuItems = functionalMenuController.getMenuItemsForApp(mockedRequest, appId); - assertEquals(actualMenuItems, expectedMenuItems); - } - - @Test - public void getMenuItemsForUserTest(){ - String orgUserId ="test"; - List<FunctionalMenuItem> actualMenuItems = null; - List<FunctionalMenuItem> expectedMenuItems = null; - Mockito.when(functionalMenuService.getFunctionalMenuItemsForUser(orgUserId)).thenReturn(actualMenuItems); - - actualMenuItems = functionalMenuController.getMenuItemsForUser(mockedRequest, orgUserId); - assertEquals(actualMenuItems, expectedMenuItems); - } - - @Test - public void createFunctionalMenuItemTest(){ - FieldsValidator actualFieldsValidator = new FieldsValidator(); - FieldsValidator expectedFieldsValidator = new FieldsValidator(); - List<FieldName> fields = new ArrayList<>(); - expectedFieldsValidator.setHttpStatusCode((long) 200); - expectedFieldsValidator.setFields(fields); - expectedFieldsValidator.setErrorCode(null); - FunctionalMenuItemWithRoles menuItemJson = new FunctionalMenuItemWithRoles(); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(functionalMenuService.createFunctionalMenuItem(menuItemJson)).thenReturn(expectedFieldsValidator); - actualFieldsValidator = functionalMenuController.createFunctionalMenuItem(mockedRequest, menuItemJson, mockedResponse); - assertEquals(actualFieldsValidator, expectedFieldsValidator); - } - - @Test - public void createFunctionalMenuItemBadPermisssionsTest(){ - FieldsValidator actualFieldsValidator = null; - FieldsValidator expectedFieldsValidator = null; - FunctionalMenuItemWithRoles menuItemJson = new FunctionalMenuItemWithRoles(); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(functionalMenuService.createFunctionalMenuItem(menuItemJson)).thenReturn(expectedFieldsValidator); - actualFieldsValidator = functionalMenuController.createFunctionalMenuItem(mockedRequest, menuItemJson, mockedResponse); - assertEquals(actualFieldsValidator, expectedFieldsValidator); - } - - @Test - public void getFavoritesForUserTest(){ - List<FavoritesFunctionalMenuItemJson> actualFavoritesFunctionalMenuItemsJson = null; - List<FavoritesFunctionalMenuItemJson> expectedFunctionalMenuItemsJson = new ArrayList<FavoritesFunctionalMenuItemJson>(); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(functionalMenuService.getFavoriteItems(user.getId())).thenReturn(expectedFunctionalMenuItemsJson); - actualFavoritesFunctionalMenuItemsJson = functionalMenuController.getFavoritesForUser(mockedRequest, mockedResponse); - assertEquals(actualFavoritesFunctionalMenuItemsJson, expectedFunctionalMenuItemsJson); - } - - @Test - public void deleteFavoriteItemTest(){ - Long userId = (long)1; - Long menuId = (long)1; - FieldsValidator actualFieldsValidator = new FieldsValidator(); - FieldsValidator expectedFieldsValidator = new FieldsValidator(); - List<FieldName> fields = new ArrayList<>(); - expectedFieldsValidator.setHttpStatusCode((long) 200); - expectedFieldsValidator.setFields(fields); - expectedFieldsValidator.setErrorCode(null); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(functionalMenuService.removeFavoriteItem(user.getId(), menuId)).thenReturn(actualFieldsValidator); - actualFieldsValidator = functionalMenuController.deleteFavoriteItem(mockedRequest, menuId, mockedResponse); - assertEquals(actualFieldsValidator, expectedFieldsValidator); - } - - @Test - public void addFavoriteItemTest(){ - FavoritesFunctionalMenuItem menuItemJson = new FavoritesFunctionalMenuItem(); - FieldsValidator actualFieldsValidator = new FieldsValidator(); - FieldsValidator expectedFieldsValidator = new FieldsValidator(); - List<FieldName> fields = new ArrayList<>(); - expectedFieldsValidator.setHttpStatusCode((long) 200); - expectedFieldsValidator.setFields(fields); - expectedFieldsValidator.setErrorCode(null); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(functionalMenuService.setFavoriteItem(menuItemJson)).thenReturn(actualFieldsValidator); - actualFieldsValidator = functionalMenuController.addFavoriteItem(mockedRequest, menuItemJson, mockedResponse); - assertEquals(actualFieldsValidator, expectedFieldsValidator); - } - - @Test - public void getMenuItemsTest(){ - List<FunctionalMenuItem> actualFunctionalMenuItems = new ArrayList<FunctionalMenuItem>(); - List<FunctionalMenuItem> expectedFunctionalMenuItems = new ArrayList<FunctionalMenuItem>(); - List<FunctionalMenuItem> menuItems = new ArrayList<FunctionalMenuItem>(); - Mockito.when(functionalMenuService.getFunctionalMenuItems()).thenReturn(menuItems); - actualFunctionalMenuItems = functionalMenuController.getMenuItems(mockedRequest, mockedResponse); - assertEquals(actualFunctionalMenuItems, expectedFunctionalMenuItems); - } - - @Test - public void deleteFunctionalMenuItemTest(){ - Long menuId = (long)1; - FieldsValidator actualFieldsValidator = new FieldsValidator(); - FieldsValidator expectedFieldsValidator = new FieldsValidator(); - List<FieldName> fields = new ArrayList<>(); - expectedFieldsValidator.setHttpStatusCode((long) 200); - expectedFieldsValidator.setFields(fields); - expectedFieldsValidator.setErrorCode(null); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(functionalMenuService.deleteFunctionalMenuItem(menuId)).thenReturn(actualFieldsValidator); - actualFieldsValidator = functionalMenuController.deleteFunctionalMenuItem(mockedRequest, menuId, mockedResponse); - assertEquals(actualFieldsValidator, expectedFieldsValidator); - } - - @Test - public void deleteFunctionalMenuItemBadPermissionsTest(){ - Long menuId = (long)1; - FieldsValidator actualFieldsValidator = null; - FieldsValidator expectedFieldsValidator = null; - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(functionalMenuService.deleteFunctionalMenuItem(menuId)).thenReturn(actualFieldsValidator); - actualFieldsValidator = functionalMenuController.deleteFunctionalMenuItem(mockedRequest, menuId, mockedResponse); - assertEquals(actualFieldsValidator, expectedFieldsValidator); - } - - @Test - public void editFunctionalMenuItemTest(){ - FunctionalMenuItemWithRoles menuItemJson = new FunctionalMenuItemWithRoles(); - FieldsValidator actualFieldsValidator = new FieldsValidator(); - FieldsValidator expectedFieldsValidator = new FieldsValidator(); - List<FieldName> fields = new ArrayList<>(); - expectedFieldsValidator.setHttpStatusCode((long) 200); - expectedFieldsValidator.setFields(fields); - expectedFieldsValidator.setErrorCode(null); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(functionalMenuService.editFunctionalMenuItem(menuItemJson)).thenReturn(actualFieldsValidator); - actualFieldsValidator = functionalMenuController.editFunctionalMenuItem(mockedRequest, menuItemJson, mockedResponse); - assertEquals(actualFieldsValidator, expectedFieldsValidator); - } - - @Test - public void editFunctionalMenuItemBadPermissionsTest(){ - FunctionalMenuItemWithRoles menuItemJson = new FunctionalMenuItemWithRoles(); - FieldsValidator actualFieldsValidator = null; - FieldsValidator expectedFieldsValidator = null; - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(functionalMenuService.editFunctionalMenuItem(menuItemJson)).thenReturn(actualFieldsValidator); - actualFieldsValidator = functionalMenuController.editFunctionalMenuItem(mockedRequest, menuItemJson, mockedResponse); - assertEquals(actualFieldsValidator, expectedFieldsValidator); - } - - @Test - public void getECOMPTitleTest(){ - PortalRestResponse<String> actualportalRestResponse = null; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - expectedportalRestResponse.setMessage("success"); - expectedportalRestResponse.setResponse("Portal"); - PowerMockito.mockStatic(SystemProperties.class); - Mockito.when(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME)).thenReturn("Portal"); - actualportalRestResponse = functionalMenuController.getECOMPTitle(mockedRequest, mockedResponse); - assertEquals(actualportalRestResponse, expectedportalRestResponse); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/GetAccessControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/GetAccessControllerTest.java deleted file mode 100644 index b9ab249e..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/GetAccessControllerTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertTrue; - -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.openecomp.portalapp.portal.controller.GetAccessController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.GetAccessResult; -import org.openecomp.portalapp.portal.service.GetAccessService; -import org.openecomp.portalapp.portal.service.GetAccessServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; - -public class GetAccessControllerTest { - - @Mock - GetAccessService getAccessService = new GetAccessServiceImpl(); - - @InjectMocks - GetAccessController getAccessController = new GetAccessController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - MockEPUser mockUser = new MockEPUser(); - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - - @Test - public void getAppList() throws IOException - { - List<GetAccessResult> expectedAppsList = new ArrayList<GetAccessResult>(); - EPUser user = mockUser.mockEPUser(); - GetAccessResult getAccessResult = new GetAccessResult(); - getAccessResult.setRowId("1"); - getAccessResult.setRoleId((long) 1); - getAccessResult.setEcompFunction("test"); - getAccessResult.setAppName("Test_App"); - getAccessResult.setAppMotsId(1); - getAccessResult.setRoleName("Test_role"); - getAccessResult.setRoleActive("N"); - getAccessResult.setReqType("test"); - - expectedAppsList.add(getAccessResult); - - List<GetAccessResult> actualAppsList = null; - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(getAccessService.getAppAccessList(user)).thenReturn(expectedAppsList); - actualAppsList = getAccessController.getAppList(mockedRequest); - assertTrue(actualAppsList.contains(getAccessResult)); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ManifestControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ManifestControllerTest.java deleted file mode 100644 index ceaceaac..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/ManifestControllerTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.jar.Attributes; - -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.openecomp.portalapp.portal.controller.ManifestController; -import org.openecomp.portalapp.portal.service.ManifestService; -import org.openecomp.portalapp.portal.service.ManifestServiceImpl; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; - -public class ManifestControllerTest extends MockitoTestSuite{ - - - @Mock - ManifestService manifestService = new ManifestServiceImpl(); - - @InjectMocks - ManifestController manifestController = new ManifestController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - NullPointerException nullPointerException = new NullPointerException(); - - @Test - public void getManifestTest() throws IOException - { - Map<String, Object> expectedResponse = new HashMap<String, Object>(); - Attributes attributes = new Attributes(); - expectedResponse.put("test", attributes); - Mockito.when(manifestService.getWebappManifest()).thenReturn(attributes); - Map<String, Object> actualResponse = manifestController.getManifest(mockedRequest); - assertTrue((actualResponse.keySet().toArray().length) == 1); - - } - - @Test - public void getManifestExceptionTest() throws IOException - { - Mockito.when(manifestService.getWebappManifest()).thenThrow(nullPointerException); - Map<String, Object> actualResponse = manifestController.getManifest(mockedRequest); - assertTrue((actualResponse.keySet().toArray().length) == 1); - assertTrue(actualResponse.get("error").equals("failed to get manifest: java.lang.NullPointerException")); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java deleted file mode 100644 index 765de291..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceControllerTest.java +++ /dev/null @@ -1,223 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; - -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.openecomp.portalapp.portal.controller.MicroserviceController; -import org.openecomp.portalapp.portal.domain.MicroserviceData; -import org.openecomp.portalapp.portal.domain.WidgetCatalog; -import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl; -import org.openecomp.portalapp.portal.service.MicroserviceService; -import org.openecomp.portalapp.portal.service.MicroserviceServiceImpl; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.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.core.ParameterizedTypeReference; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.client.RestTemplate; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(WidgetServiceHeaders.class) -public class MicroserviceControllerTest extends MockitoTestSuite{ - - @InjectMocks - MicroserviceController microserviceController = new MicroserviceController(); - - @Mock - ConsulHealthService consulHealthService = new ConsulHealthServiceImpl(); - - @Mock - MicroserviceService microserviceService = new MicroserviceServiceImpl(); - - @Mock - RestTemplate template = new RestTemplate(); - - @Mock - MicroserviceData microserviceData = new MicroserviceData(); - - @SuppressWarnings("rawtypes") - @Mock - ResponseEntity<List<WidgetCatalog>> ans = new ResponseEntity<List<WidgetCatalog>>(HttpStatus.OK); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - @Mock - EcompPortalUtils EcompPortalUtils = new EcompPortalUtils(); - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - @Test - public void createMicroserviceIfServiceDataNullTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("FAILURE"); - expectedportalRestResponse.setResponse("MicroserviceData cannot be null or empty"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - MicroserviceData microserviceData = null; - PortalRestResponse<String> actualportalRestResponse = microserviceController.createMicroservice(mockedRequest, - mockedResponse, microserviceData); - assertEquals(actualportalRestResponse, expectedportalRestResponse); - } - - @Test - public void createMicroserviceTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("SUCCESS"); - expectedportalRestResponse.setResponse(""); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - PortalRestResponse<String> actualportalRestResponse = microserviceController.createMicroservice(mockedRequest, - mockedResponse, microserviceData); - assertEquals(actualportalRestResponse, expectedportalRestResponse); - } - - @Test - public void createMicroserviceExceptionTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("FAILURE"); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - Mockito.when(microserviceService.saveMicroservice(microserviceData)).thenReturn((long) 1); - Mockito.when(microserviceData.getParameterList()).thenThrow(nullPointerException); - PortalRestResponse<String> actualportalRestResponse = microserviceController.createMicroservice(mockedRequest, - mockedResponse, microserviceData); - assertEquals(actualportalRestResponse, expectedportalRestResponse); - } - - @Test - public void getMicroserviceTest() throws Exception { - Mockito.when(microserviceService.getMicroserviceData()).thenReturn(null); - List<MicroserviceData> list = microserviceController.getMicroservice(mockedRequest, mockedResponse); - assertEquals(list, null); - } - - @Test - public void updateMicroserviceIfServiceISNullTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("FAILURE"); - expectedportalRestResponse.setResponse("MicroserviceData cannot be null or empty"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - MicroserviceData microserviceData = null; - PortalRestResponse<String> actualportalRestResponse = microserviceController.updateMicroservice(mockedRequest, - mockedResponse, 1, microserviceData); - assertEquals(actualportalRestResponse, expectedportalRestResponse); - } - - @Test - public void updateMicroserviceTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("SUCCESS"); - expectedportalRestResponse.setResponse(""); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - PortalRestResponse<String> actualportalRestResponse = microserviceController.updateMicroservice(mockedRequest, - mockedResponse, 1, microserviceData); - assertEquals(actualportalRestResponse, expectedportalRestResponse); - } - - @Test - public void updateMicroserviceExceptionTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("FAILURE"); - expectedportalRestResponse.setResponse(null); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - Mockito.when(microserviceController.updateMicroservice(mockedRequest, mockedResponse, 1, microserviceData)) - .thenThrow(nullPointerException); - PortalRestResponse<String> actualportalRestResponse = microserviceController.updateMicroservice(mockedRequest, - mockedResponse, 1, microserviceData); - assertEquals(actualportalRestResponse, expectedportalRestResponse); - } - - @Test - public void deleteMicroserviceExceptionTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("FAILURE"); - expectedportalRestResponse.setResponse( - "I/O error on GET request for \"" + EcompPortalUtils.widgetMsProtocol() + "://null/widget/microservices/widgetCatalog/service/1\":null; nested exception is java.net.UnknownHostException: null"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - PowerMockito.mockStatic(WidgetServiceHeaders.class); - PortalRestResponse<String> actuaPportalRestResponse = microserviceController.deleteMicroservice(mockedRequest, - mockedResponse, 1); - assertEquals(actuaPportalRestResponse.getStatus(), expectedportalRestResponse.getStatus()); - } - - @SuppressWarnings("unchecked") - @Test - public void deleteMicroserviceTest() throws Exception { - String HTTPS = "https://"; - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("SOME WIDGETS ASSOICATE WITH THIS SERVICE"); - expectedportalRestResponse.setResponse("'null' ,'null' "); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.WARN); - List<WidgetCatalog> List = new ArrayList<WidgetCatalog>(); - WidgetCatalog widgetCatalog = new WidgetCatalog(); - widgetCatalog.setId(1); - WidgetCatalog widgetCatalog1 = new WidgetCatalog(); - widgetCatalog.setId(2); - List.add(widgetCatalog); - List.add(widgetCatalog1); - PowerMockito.mockStatic(WidgetServiceHeaders.class); - String whatService = "widgets-service"; - Mockito.when(consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))).thenReturn("Test"); - Mockito.when(ans.getBody()).thenReturn(List); - ParameterizedTypeReference<List<WidgetCatalog>> typeRef = new ParameterizedTypeReference<List<WidgetCatalog>>() { - }; - Mockito.when(template.exchange( - HTTPS + consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port")) - + "/widget/microservices/widgetCatalog/service/" + 1, - HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), typeRef)).thenReturn(ans); - - PortalRestResponse<String> actuaPportalRestResponse = microserviceController.deleteMicroservice(mockedRequest, - mockedResponse, 1); - assertEquals(actuaPportalRestResponse, expectedportalRestResponse); - } - - @SuppressWarnings("unchecked") - @Test - public void deleteMicroserviceWhenNoWidgetsAssociatedTest() throws Exception { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("SUCCESS"); - expectedportalRestResponse.setResponse(""); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - List<WidgetCatalog> List = new ArrayList<WidgetCatalog>(); - PowerMockito.mockStatic(WidgetServiceHeaders.class); - String whatService = "widgets-service"; - Mockito.when(consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))).thenReturn("Test"); - Mockito.when(ans.getBody()).thenReturn(List); - ParameterizedTypeReference<List<WidgetCatalog>> typeRef = new ParameterizedTypeReference<List<WidgetCatalog>>() { - }; - Mockito.when(template.exchange( - EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port")) - + "/widget/microservices/widgetCatalog/service/" + 1, - HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), typeRef)).thenReturn(ans); - PortalRestResponse<String> actuaPportalRestResponse = microserviceController.deleteMicroservice(mockedRequest, - mockedResponse, 1); - assertEquals(actuaPportalRestResponse, expectedportalRestResponse); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceProxyControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceProxyControllerTest.java deleted file mode 100644 index 115819d2..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/MicroserviceProxyControllerTest.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertTrue; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.openecomp.portalapp.portal.controller.MicroserviceProxyController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.MicroserviceProxyService; -import org.openecomp.portalapp.portal.service.MicroserviceProxyServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.springframework.http.HttpStatus; -import org.springframework.web.client.HttpClientErrorException; - -import com.fasterxml.jackson.databind.ObjectMapper; - - - -public class MicroserviceProxyControllerTest extends MockitoTestSuite { - - @Mock - MicroserviceProxyService microserviceProxyService = new MicroserviceProxyServiceImpl(); - - @InjectMocks - MicroserviceProxyController microserviceProxyController = new MicroserviceProxyController(); - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - @Mock - ObjectMapper objectMapper = new ObjectMapper(); - MockEPUser mockUser = new MockEPUser(); - - @Test - public void getMicroserviceProxyTest() throws Exception { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(microserviceProxyService.proxyToDestination(1, user, mockedRequest)).thenReturn("Success"); - String acutualString = microserviceProxyController.getMicroserviceProxy(mockedRequest, getMockedResponse(), 1); - assertTrue(acutualString.equals("{\"error\":\"Success\"}")); - } - - @Test(expected = NullPointerException.class) - public void getMicroserviceProxyNullPoniterExceptionTest() throws Exception { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(microserviceProxyService.proxyToDestination(1, user, mockedRequest)) - .thenThrow(nullPointerException); - microserviceProxyController.getMicroserviceProxy(mockedRequest, getMockedResponse(), 1); - } - - @Test - public void getMicroserviceProxyExceptionTest() throws Exception { - HttpClientErrorException httpClientErrorException = new HttpClientErrorException(HttpStatus.OK, "Success"); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(microserviceProxyService.proxyToDestination(1, user, mockedRequest)) - .thenThrow(httpClientErrorException); - String acutualString = microserviceProxyController.getMicroserviceProxy(mockedRequest, getMockedResponse(), 1); - assertTrue(acutualString.equals("{\"error\":\"\"}")); - } - - @Test - public void getMicroserviceProxyByWidgetIdTest() throws Exception { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(microserviceProxyService.proxyToDestinationByWidgetId(1, user, mockedRequest)) - .thenReturn("Success"); - String acutualString = microserviceProxyController.getMicroserviceProxyByWidgetId(mockedRequest, - getMockedResponse(), 1); - assertTrue(acutualString.equals("{\"error\":\"Success\"}")); - } - - @Test(expected = NullPointerException.class) - public void getMicroserviceProxyByWidgetIdNullPointerExceptionTest() throws Exception { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(microserviceProxyService.proxyToDestinationByWidgetId(1, user, mockedRequest)) - .thenThrow(nullPointerException); - microserviceProxyController.getMicroserviceProxyByWidgetId(mockedRequest, getMockedResponse(), 1); - } - - @Test - public void getMicroserviceProxyByWidgetIdExceptionTest() throws Exception { - HttpClientErrorException httpClientErrorException = new HttpClientErrorException(HttpStatus.OK, "Success"); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(microserviceProxyService.proxyToDestinationByWidgetId(1, user, mockedRequest)) - .thenThrow(httpClientErrorException); - String acutualString = microserviceProxyController.getMicroserviceProxyByWidgetId(mockedRequest, - getMockedResponse(), 1); - assertTrue(acutualString.equals("{\"error\":\"\"}")); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/PortalAdminControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/PortalAdminControllerTest.java deleted file mode 100644 index 4f3d1791..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/PortalAdminControllerTest.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -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.openecomp.portalapp.portal.controller.PortalAdminController; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.exceptions.NoHealthyServiceException; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.PortalAdminService; -import org.openecomp.portalapp.portal.service.PortalAdminServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.PortalAdmin; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.service.AuditServiceImpl; - -public class PortalAdminControllerTest extends MockitoTestSuite{ - - @InjectMocks - PortalAdminController portalAdminController = new PortalAdminController(); - - @Mock - AdminRolesService adminRolesService = new AdminRolesServiceImpl(); - - @Mock - PortalAdminService portalAdminService = new PortalAdminServiceImpl(); - - @Mock - AuditService auditService = new AuditServiceImpl(); - - - @Mock - EcompPortalUtils ecompPortalUtils = new EcompPortalUtils(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - - MockEPUser mockUser = new MockEPUser(); - - - @Test - public void getPortalAdminsTest() - { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<PortalAdmin> expectedPortalAdminsList = new ArrayList<PortalAdmin>(); - PortalAdmin portalAdmin= new PortalAdmin(); - - portalAdmin.setUserId((long) 1); - portalAdmin.setLoginId("guestT"); - portalAdmin.setFirstName("Test_FirstName"); - portalAdmin.setLastName("Test_LastName"); - - expectedPortalAdminsList.add(portalAdmin); - - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - - Mockito.when(portalAdminService.getPortalAdmins()).thenReturn(expectedPortalAdminsList); - List<PortalAdmin> actualPortalAdminsList = portalAdminController.getPortalAdmins(mockedRequest, mockedResponse); - assertEquals(actualPortalAdminsList,expectedPortalAdminsList); - - } -// @Test -// public void getPortalAdminsIfUserIsNullTest() -// { -// EPUser user = null; -// Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); -// -// assertNull(portalAdminController.getPortalAdmins(mockedRequest, mockedResponse)); -// -// } - - @Test - public void getPortalAdminsIfUserIsSuperAdminTest() - { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - assertNull(portalAdminController.getPortalAdmins(mockedRequest, mockedResponse)); - - } - - - - @Test - public void createPortalAdminTest() - { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - FieldsValidator actualFieldValidator = new FieldsValidator(); - String sbcid = "Test"; - - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(portalAdminService.createPortalAdmin(sbcid)).thenReturn(expectedFieldValidator); - actualFieldValidator = portalAdminController.createPortalAdmin(mockedRequest, sbcid, mockedResponse); - assertEquals(actualFieldValidator,expectedFieldValidator); - - } - -// @Test -// public void createPortalAdminIfUserIsNullTest() -// { -// //EPUser user = null; -// Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(null); -// String sbcid = "null"; -// assertNull(portalAdminController.createPortalAdmin(mockedRequest, sbcid, mockedResponse)); -// -// } - - @Test - public void createPortalAdminIfUserIsSuperAdminTest() - { - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - String sbcid = "Test"; - assertNull(portalAdminController.createPortalAdmin(mockedRequest, sbcid, mockedResponse)); - - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RoleManageControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RoleManageControllerTest.java deleted file mode 100644 index faa9b1f7..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RoleManageControllerTest.java +++ /dev/null @@ -1,189 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; - -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.openecomp.portalapp.controller.core.RoleController; -import org.openecomp.portalapp.controller.core.RoleFunctionListController; -import org.openecomp.portalapp.controller.core.RoleListController; -import org.openecomp.portalapp.portal.controller.RoleManageController; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.ExternalAccessRolesService; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.springframework.web.servlet.ModelAndView; - -public class RoleManageControllerTest { - - - - @Mock - RoleController roleController; - - @Mock - RoleListController roleListController; - - @Mock - RoleFunctionListController roleFunctionListController; - - - @Mock - ExternalAccessRolesService externalAccessRolesService; - - @Mock - ExternalAccessRolesService externalAccessRolesService1 = null; - - @InjectMocks - RoleManageController roleManageController = new RoleManageController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - MockEPUser mockUser = new MockEPUser(); - - @Test - public void toggleRoleTest() - { - PortalRestResponse<String> portalRestResponse = new PortalRestResponse<String>(); - portalRestResponse.setMessage("success"); - portalRestResponse.setResponse(null); - PortalRestStatusEnum portalRestStatusEnum = null; - portalRestResponse.setStatus(portalRestStatusEnum.OK); - - PortalRestResponse<String> expectedpPortalRestResponse=roleManageController.toggleRole(mockedRequest, mockedResponse); - assertEquals(portalRestResponse,expectedpPortalRestResponse); - - } - -// @Test -// public void toggleRoleExceptionTest() -// { -// PortalRestResponse<String> portalRestResponse = new PortalRestResponse<String>(); -// portalRestResponse.setMessage("success"); -// portalRestResponse.setResponse(null); -// PortalRestStatusEnum portalRestStatusEnum = null; -// portalRestResponse.setStatus(portalRestStatusEnum.OK); -// Mockito.doNothing().when(roleListController).toggleRole(mockedRequest, mockedResponse))).th -// getRoleListController().toggleRole(request, response) -// -// PortalRestResponse<String> expectedpPortalRestResponse=roleManageController.toggleRole(mockedRequest, mockedResponse); -// assertEquals(portalRestResponse,expectedpPortalRestResponse); -// -// } - @Test - public void removeRoleTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleListController.removeRole(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.removeRole(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } - - @Test - public void saveRoleTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleController.saveRole(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.saveRole(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } - - @Test - public void removeRoleRoleFunctionTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleController.removeRoleFunction(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.removeRoleRoleFunction(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } - - @Test - public void addRoleRoRoleFunctionTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleController.addRoleFunction(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.addRoleRoRoleFunction(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } - - @Test - public void removeChildRoleTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleController.removeChildRole(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.removeChildRole(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } - - - @Test - public void getRoleTest() throws Exception - { - Mockito.doNothing().when(roleController).getRole(mockedRequest, mockedResponse); - roleManageController.getRole(mockedRequest, mockedResponse); - } - - @Test - public void getRolesTest() throws Exception - { - Mockito.doNothing().when(roleListController).getRoles(mockedRequest, mockedResponse); - roleManageController.getRoles(mockedRequest, mockedResponse); - } - - @Test - public void getRoleFunctionListTest() throws Exception - { - Mockito.doNothing().when(roleFunctionListController).getRoleFunctionList(mockedRequest, mockedResponse); - roleManageController.getRoleFunctionList(mockedRequest, mockedResponse); - } - - @Test - public void saveRoleFunctionTest() throws Exception - { - Mockito.doNothing().when(roleFunctionListController).saveRoleFunction(mockedRequest, mockedResponse, "test"); - roleManageController.saveRoleFunction(mockedRequest, mockedResponse, "test"); - } - - @Test - public void removeRoleFunctionTest() throws Exception - { - Mockito.doNothing().when(roleFunctionListController).removeRoleFunction(mockedRequest, mockedResponse, "test"); - roleManageController.removeRoleFunction(mockedRequest, mockedResponse, "test"); - } - - @Test - public void syncRolesTest() throws Exception - { - EPApp app = new EPApp(); - Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app); - roleManageController.syncRoles(app); - } - - - @Test - public void addeChildRoleTest() throws Exception - { - ModelAndView modelandView = new ModelAndView("login.htm"); - Mockito.when(roleController.addChildRole(mockedRequest, mockedResponse)).thenReturn(modelandView); - ModelAndView expectedModelandView = roleManageController.addChildRole(mockedRequest, mockedResponse); - assertEquals(expectedModelandView, modelandView); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RolesApprovalSystemControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RolesApprovalSystemControllerTest.java deleted file mode 100644 index 79ae0276..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/RolesApprovalSystemControllerTest.java +++ /dev/null @@ -1,323 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; - -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.openecomp.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; -import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemUser; -import org.openecomp.portalapp.portal.controller.RolesApprovalSystemController; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.UserRolesService; -import org.openecomp.portalapp.portal.transport.ExternalRequestFieldsValidator; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; - -public class RolesApprovalSystemControllerTest extends MockitoTestSuite { - - @Mock - UserRolesService userRolesService; - - @InjectMocks - RolesApprovalSystemController rolesApprovalSystemController = new RolesApprovalSystemController(); - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void postUserProfileIfRolesNullTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Request has no roles"); - expectedportalRestResponse.setResponse("save user profile failed"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = null; - extSysUser.setRoles(externalSystemRoleApprovalList); - - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .postUserProfile(mockedRequest, extSysUser, mockedResponse); - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void postUserProfileTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Saved Successfully"); - expectedportalRestResponse.setResponse("Success"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); - externalSystemRoleApprovalList.add(externalSystemRoleApproval); - extSysUser.setRoles(externalSystemRoleApprovalList); - ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(true, - "Saved Successfully"); - - Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "POST")) - .thenReturn(externalRequestFieldsValidator); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .postUserProfile(mockedRequest, extSysUser, mockedResponse); - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void postUserProfileFailureTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Received Bad String"); - expectedportalRestResponse.setResponse("save user profile failed"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); - externalSystemRoleApprovalList.add(externalSystemRoleApproval); - extSysUser.setRoles(externalSystemRoleApprovalList); - ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(false, - "Received Bad String"); - Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "POST")) - .thenReturn(externalRequestFieldsValidator); - - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .postUserProfile(mockedRequest, extSysUser, mockedResponse); - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void postUserProfileExceptionTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse("save user profile failed"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); - externalSystemRoleApprovalList.add(externalSystemRoleApproval); - extSysUser.setRoles(externalSystemRoleApprovalList); - Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "POST")).thenThrow(nullPointerException); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .postUserProfile(mockedRequest, extSysUser, mockedResponse); - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void putUserProfileIfLoginIdNullTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Request has no login ID"); - expectedportalRestResponse.setResponse("save user profile failed"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId(null); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - extSysUser.setRoles(externalSystemRoleApprovalList); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .putUserProfile(mockedRequest, extSysUser, mockedResponse); - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void putUserProfileTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Updated Successfully"); - expectedportalRestResponse.setResponse("Success"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); - externalSystemRoleApprovalList.add(externalSystemRoleApproval); - extSysUser.setRoles(externalSystemRoleApprovalList); - ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(true, - "Updated Successfully"); - - Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "PUT")) - .thenReturn(externalRequestFieldsValidator); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .putUserProfile(mockedRequest, extSysUser, mockedResponse); - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void putUserProfileFailureTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Received Bad String"); - expectedportalRestResponse.setResponse("save user profile failed"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); - externalSystemRoleApprovalList.add(externalSystemRoleApproval); - extSysUser.setRoles(externalSystemRoleApprovalList); - ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(false, - "Received Bad String"); - - Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "PUT")) - .thenReturn(externalRequestFieldsValidator); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .putUserProfile(mockedRequest, extSysUser, mockedResponse); - - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void putUserProfileExceptionTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse("save user profile failed"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); - externalSystemRoleApprovalList.add(externalSystemRoleApproval); - extSysUser.setRoles(externalSystemRoleApprovalList); - Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "PUT")).thenThrow(nullPointerException); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .putUserProfile(mockedRequest, extSysUser, mockedResponse); - - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void deleteUserProfileIfApplicationNameNullTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Request has no application name"); - expectedportalRestResponse.setResponse("delete user profile failed"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName(null); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - extSysUser.setRoles(externalSystemRoleApprovalList); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .deleteUserProfile(mockedRequest, extSysUser, mockedResponse); - - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void deleteUserProfileIfMyloginrequestIdNullTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Request has no request ID"); - expectedportalRestResponse.setResponse("delete user profile failed"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId(null); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - extSysUser.setRoles(externalSystemRoleApprovalList); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .deleteUserProfile(mockedRequest, extSysUser, mockedResponse); - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void deleteUserProfileTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("Deleted Successfully"); - expectedportalRestResponse.setResponse("Success"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); - externalSystemRoleApprovalList.add(externalSystemRoleApproval); - extSysUser.setRoles(externalSystemRoleApprovalList); - ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(true, - "Success"); - - Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "DELETE")) - .thenReturn(externalRequestFieldsValidator); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .deleteUserProfile(mockedRequest, extSysUser, mockedResponse); - - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void deleteUserProfileFailureTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("failed"); - expectedportalRestResponse.setResponse("delete user profile failed"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); - externalSystemRoleApprovalList.add(externalSystemRoleApproval); - extSysUser.setRoles(externalSystemRoleApprovalList); - ExternalRequestFieldsValidator externalRequestFieldsValidator = new ExternalRequestFieldsValidator(false, - "failed"); - - Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "DELETE")) - .thenReturn(externalRequestFieldsValidator); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .deleteUserProfile(mockedRequest, extSysUser, mockedResponse); - - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } - - @Test - public void deleteUserProfileExceptionTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse("delete user profile failed"); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - ExternalSystemUser extSysUser = new ExternalSystemUser(); - extSysUser.setApplicationName("Test_App"); - extSysUser.setLoginId("1"); - extSysUser.setMyloginrequestId("Test"); - List<ExternalSystemRoleApproval> externalSystemRoleApprovalList = new ArrayList<ExternalSystemRoleApproval>(); - ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); - externalSystemRoleApprovalList.add(externalSystemRoleApproval); - extSysUser.setRoles(externalSystemRoleApprovalList); - Mockito.when(userRolesService.setExternalRequestUserAppRole(extSysUser, "DELETE")).thenThrow(nullPointerException); - PortalRestResponse<String> actualportalRestResponse = rolesApprovalSystemController - .deleteUserProfile(mockedRequest, extSysUser, mockedResponse); - - assertEquals(expectedportalRestResponse, actualportalRestResponse); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SessionCommunicationControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SessionCommunicationControllerTest.java deleted file mode 100644 index cc7bf040..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SessionCommunicationControllerTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.*; - -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.openecomp.portalapp.controller.sessionmgt.SessionCommunicationController; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.service.sessionmgt.ManageService; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; - -public class SessionCommunicationControllerTest { - - - @Mock - ManageService manageService; - - @InjectMocks - SessionCommunicationController SessionCommunicationController = new SessionCommunicationController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - NullPointerException nullPointerException = new NullPointerException(); - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - MockEPUser mockUser = new MockEPUser(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - - - @Test - public void getSessionSlotCheckIntervalTest() throws Exception - { - Mockito.when(manageService.fetchSessionSlotCheckInterval()).thenReturn(1); - int result = SessionCommunicationController.getSessionSlotCheckInterval(mockedRequest, mockedResponse); - assertEquals(result, 1); - - } - - @Test - public void extendSessionTimeOutsTest() throws Exception - { - Mockito.doNothing().when(manageService).extendSessionTimeOuts("test"); - Boolean result = SessionCommunicationController.extendSessionTimeOuts(mockedRequest, mockedResponse, "test"); - assertEquals(result, true); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/TicketEventControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/TicketEventControllerTest.java deleted file mode 100644 index fe656269..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/TicketEventControllerTest.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -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.MockitoAnnotations; -import org.openecomp.portalapp.portal.controller.TicketEventController; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.web.support.UserUtils; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(UserUtils.class) -public class TicketEventControllerTest { - - @Mock - UserNotificationService userNotificationService; - - @InjectMocks - TicketEventController ticketEventController = new TicketEventController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockEPUser mockUser = new MockEPUser(); - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - -// @Test -// public void saveTest() throws Exception { -// String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}"; -// PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest, -// mockedResponse, ticketEventJson); -// assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.OK) == 0); -// } - - @Test - public void saveTestForException() throws Exception { - String ticketEventJson = "\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}"; - PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest, - mockedResponse, ticketEventJson); - assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0); - } - -// @Test -// public void saveTestForApplicationValid() throws Exception { -// String ticketEventJson = "{\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}"; -// PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest, -// mockedResponse, ticketEventJson); -// assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0); -// assertEquals(actualPortalRestResponse.getMessage(), "application is mandatory"); -// -// } - - @Test - public void saveTestForBodyValid() throws Exception { - String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\",\"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}"; - PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest, - mockedResponse, ticketEventJson); - assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0); - assertEquals(actualPortalRestResponse.getMessage(), "body is mandatory"); - } - - @Test - public void saveTestForEventSourceValid() throws Exception { - String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}"; - PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest, - mockedResponse, ticketEventJson); - assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0); - assertEquals(actualPortalRestResponse.getMessage(), "Message Source is mandatory"); - } - - @Test - public void saveTestForUserListValid() throws Exception { - String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {}}"; - PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest, - mockedResponse, ticketEventJson); - assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0); - assertEquals(actualPortalRestResponse.getMessage(), "At least one user Id is mandatory"); - } -}
\ No newline at end of file diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserControllerTest.java deleted file mode 100644 index 19f309b4..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserControllerTest.java +++ /dev/null @@ -1,137 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; - -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.openecomp.portalapp.portal.controller.UserController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.UserService; -import org.openecomp.portalapp.portal.service.UserServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.ProfileDetail; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(CipherUtil.class) -public class UserControllerTest extends MockitoTestSuite { - - @InjectMocks - UserController userController = new UserController(); - - @Mock - UserService userService = new UserServiceImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - MockEPUser mockUser = new MockEPUser(); - - @Test - public void getLoggedinUserExceptionTest() { - EPUser epUser = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(epUser); - PortalRestResponse<ProfileDetail> expectedResponse = new PortalRestResponse<ProfileDetail>(); - expectedResponse.setMessage(null); - expectedResponse.setResponse(null); - expectedResponse.setStatus(PortalRestStatusEnum.ERROR); - PortalRestResponse<ProfileDetail> response = userController.getLoggedinUser(mockedRequest); - assertEquals(response, expectedResponse); - } - - @Test - public void getLoggedinUserTest() throws Exception { - EPUser epUser = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(epUser); - PortalRestResponse<ProfileDetail> expectedResponse = new PortalRestResponse<ProfileDetail>(); - expectedResponse.setMessage("success"); - ProfileDetail profileDetail = new ProfileDetail(); - expectedResponse.setResponse(profileDetail); - expectedResponse.setStatus(PortalRestStatusEnum.OK); - PowerMockito.mockStatic(CipherUtil.class); - Mockito.when(CipherUtil.decrypt(epUser.getLoginPwd())).thenReturn("Password"); - PortalRestResponse<ProfileDetail> response = userController.getLoggedinUser(mockedRequest); - assertEquals(response.getMessage(), expectedResponse.getMessage()); - assertEquals(response.getStatus(), expectedResponse.getStatus()); - } - - @Test - public void modifyLoggedinUserIfProfileNullTest() { - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage("java.lang.NullPointerException"); - expectedResponse.setResponse(null); - expectedResponse.setStatus(PortalRestStatusEnum.ERROR); - ProfileDetail profileDetail = null; - PortalRestResponse<String> actualResponse = userController.modifyLoggedinUser(mockedRequest, profileDetail); - assertEquals(actualResponse, expectedResponse); - assertEquals(actualResponse.getStatus(), expectedResponse.getStatus()); - } - - @Test - public void modifyLoggedinUserExceptionTest() { - EPUser epUser = mockUser.mockEPUser(); - - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage( - "java.lang.ClassCastException: com.sun.crypto.provider.AESCipher$General cannot be cast to javax.crypto.CipherSpi"); - expectedResponse.setResponse(null); - expectedResponse.setStatus(PortalRestStatusEnum.ERROR); - ProfileDetail profileDetail = new ProfileDetail(); - profileDetail.setFirstName("Test_FirstName"); - profileDetail.setLastName("Test_LastName"); - profileDetail.setEmail("Test_Email"); - profileDetail.setLoginId("Test_LoginId"); - profileDetail.setLoginPassword("Test_LoginPassword"); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(epUser); - PortalRestResponse<String> actualResponse = userController.modifyLoggedinUser(mockedRequest, profileDetail); - assertEquals(actualResponse, expectedResponse); - - } - - /*@Test - public void modifyLoggedinUserTest() throws Exception { - EPUser epUser = mockUser.mockEPUser(); - PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); - expectedResponse.setMessage("success"); - expectedResponse.setResponse(null); - PortalRestStatusEnum enu = null; - expectedResponse.setStatus(enu.OK); - ProfileDetail profileDetail = new ProfileDetail(); - profileDetail.setFirstName("Test_FirstName"); - profileDetail.setLastName("Test_LastName"); - profileDetail.setEmail("Test_Email"); - profileDetail.setLoginId("Test_LoginId"); - profileDetail.setLoginPassword("Test_LoginPassword"); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(epUser); - PowerMockito.mockStatic(CipherUtil.class); - Mockito.when(CipherUtil.decrypt(epUser.getLoginPwd())).thenReturn("Password"); - PortalRestResponse<String> actualResponse = userController.modifyLoggedinUser(mockedRequest, profileDetail); - System.out.println(actualResponse); - }*/ -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserNotificationControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserNotificationControllerTest.java deleted file mode 100644 index 2bc6977d..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserNotificationControllerTest.java +++ /dev/null @@ -1,263 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -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.openecomp.portalapp.portal.controller.UserNotificationController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl; -import org.openecomp.portalapp.portal.service.UserNotificationService; -import org.openecomp.portalapp.portal.service.UserNotificationServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.EpNotificationItem; -import org.openecomp.portalapp.portal.transport.EpNotificationItemVO; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.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 UserNotificationControllerTest { - - @Mock - FunctionalMenuService functionalMenuService = new FunctionalMenuServiceImpl(); - - @Mock - UserNotificationService userNotificationService = new UserNotificationServiceImpl(); - - @InjectMocks - UserNotificationController userNotificationController = new UserNotificationController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockEPUser mockUser = new MockEPUser(); - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - @Test - public void getMenuIdRoleIdTest() { - List<FunctionalMenuRole> expectedMenuRoleList = new ArrayList<FunctionalMenuRole>(); - FunctionalMenuRole functionalMenuRole = new FunctionalMenuRole(); - functionalMenuRole.setId(new Integer(99999999)); - functionalMenuRole.setMenuId((long) 137); - functionalMenuRole.setAppId(new Integer(456)); - functionalMenuRole.setRoleId(new Integer(6214)); - expectedMenuRoleList.add(functionalMenuRole); - List<FunctionalMenuRole> actualFunctionalMenuRoleList = null; - Mockito.when(functionalMenuService.getFunctionalMenuRole()).thenReturn(expectedMenuRoleList); - actualFunctionalMenuRoleList = userNotificationController.getMenuIdRoleId(mockedRequest, mockedResponse); - assertTrue(actualFunctionalMenuRoleList.equals(expectedMenuRoleList)); - - } - - @Test - public void getNotificationsTest() { - EPUser user = mockUser.mockEPUser(); - HttpSession session = mockedRequest.getSession(); - session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EpNotificationItem> expectedEpNotificationList = new ArrayList<EpNotificationItem>(); - EpNotificationItem epNotificationItem = new EpNotificationItem(); - epNotificationItem.setNotificationId((long) 200); - expectedEpNotificationList.add(epNotificationItem); - PortalRestResponse<List<EpNotificationItem>> expectedportalRestResponse = new PortalRestResponse<List<EpNotificationItem>>(); - expectedportalRestResponse.setMessage("success"); - expectedportalRestResponse.setResponse(expectedEpNotificationList); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK); - PortalRestResponse<List<EpNotificationItem>> actualPortalRestResponse = null; - Mockito.when(userNotificationService.getNotifications(user.getId())).thenReturn(expectedEpNotificationList); - actualPortalRestResponse = userNotificationController.getNotifications(mockedRequest, mockedResponse); - assertTrue(expectedportalRestResponse.equals(actualPortalRestResponse)); - - } - - @Test - public void getNotificationsCatchesExceptionTest() { - EPUser user = mockUser.mockEPUser(); - HttpSession session = mockedRequest.getSession(); - session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EpNotificationItem> expectedEpNotificationList = null; - PortalRestResponse<List<EpNotificationItem>> expectedportalRestResponse = new PortalRestResponse<List<EpNotificationItem>>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse(expectedEpNotificationList); - expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - PortalRestResponse<List<EpNotificationItem>> actualPortalRestResponse = null; - Mockito.when(userNotificationService.getNotifications(user.getId())).thenThrow(new NullPointerException()); - actualPortalRestResponse = userNotificationController.getNotifications(mockedRequest, mockedResponse); - assertTrue(expectedportalRestResponse.equals(actualPortalRestResponse)); - } - - @Test - public void getAdminNotificationsTest() { - EPUser user = mockUser.mockEPUser(); - HttpSession session = mockedRequest.getSession(); - session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - List<EpNotificationItemVO> actualEpNotificationsList = new ArrayList<EpNotificationItemVO>(); - List<EpNotificationItemVO> expectedEpNotificationsList = new ArrayList<EpNotificationItemVO>(); - EpNotificationItemVO epNotificationItemVO = new EpNotificationItemVO(); - epNotificationItemVO.setId((long) 1); - expectedEpNotificationsList.add(epNotificationItemVO); - Mockito.when(userNotificationService.getAdminNotificationVOS(Matchers.anyLong())).thenReturn(expectedEpNotificationsList); - actualEpNotificationsList = userNotificationController.getAdminNotifications(mockedRequest, mockedResponse); - assertTrue(actualEpNotificationsList.equals(expectedEpNotificationsList)); - } - - @Test - public void saveTestWhenNotificationIsNull() throws Exception { - EPUser user = mockUser.mockEPUser(); - HttpSession session = mockedRequest.getSession(); - session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - - PortalRestResponse<String> actualPortalRestResponse = new PortalRestResponse<String>(); - PortalRestResponse<String> expectedPortalRestResponse = new PortalRestResponse<String>(); - expectedPortalRestResponse.setMessage("FAILURE"); - expectedPortalRestResponse.setResponse("Notification Header cannot be null or empty"); - expectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - - EpNotificationItem notificationItem = null; - actualPortalRestResponse = userNotificationController.save(mockedRequest, mockedResponse, notificationItem); - assertTrue(actualPortalRestResponse.equals(expectedPortalRestResponse)); - } - - @Test - public void saveTestWhenEndTimeIsGreater() throws Exception { - EPUser user = mockUser.mockEPUser(); - HttpSession session = mockedRequest.getSession(); - session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - PortalRestResponse<String> actualPortalRestResponse = new PortalRestResponse<String>(); - PortalRestResponse<String> expectedPortalRestResponse = new PortalRestResponse<String>(); - expectedPortalRestResponse.setMessage("FAILURE"); - expectedPortalRestResponse.setResponse("End Time should be greater than start time"); - expectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - EpNotificationItem notificationItem = new EpNotificationItem(); - notificationItem.setNotificationId((long) 1); - notificationItem.setMsgHeader("Test"); - Date currentDate = new Date(); - Calendar c = Calendar.getInstance(); - c.setTime(currentDate); - c.add(Calendar.DATE, 1); - Date currentDatePlusOne = c.getTime(); - notificationItem.setStartTime(currentDatePlusOne); - notificationItem.setEndTime(currentDate); - - actualPortalRestResponse = userNotificationController.save(mockedRequest, mockedResponse, notificationItem); - assertTrue(actualPortalRestResponse.equals(expectedPortalRestResponse)); - - } - - @Test - public void saveTestWhenNoRoleIDExists() throws Exception { - EPUser user = mockUser.mockEPUser(); - HttpSession session = mockedRequest.getSession(); - session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - PortalRestResponse<String> actualPortalRestResponse = new PortalRestResponse<String>(); - PortalRestResponse<String> expectedPortalRestResponse = new PortalRestResponse<String>(); - expectedPortalRestResponse.setMessage("FAILURE"); - expectedPortalRestResponse.setResponse("No Roles Ids Exist for the selected Roles"); - expectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - EpNotificationItem notificationItem = new EpNotificationItem(); - notificationItem.setNotificationId((long) 1); - notificationItem.setMsgHeader("Test"); - notificationItem.setIsForAllRoles("N"); - Date currentDate = new Date(); - Calendar c = Calendar.getInstance(); - c.setTime(currentDate); - c.add(Calendar.DATE, 1); - Date currentDatePlusOne = c.getTime(); - notificationItem.setStartTime(currentDate); - notificationItem.setEndTime(currentDatePlusOne); - List<Long> roleList = new ArrayList<Long>(); - notificationItem.setRoleIds(roleList); - actualPortalRestResponse = userNotificationController.save(mockedRequest, mockedResponse, notificationItem); - assertTrue(actualPortalRestResponse.equals(expectedPortalRestResponse)); - } - - @Test - public void saveTest() throws Exception { - EPUser user = mockUser.mockEPUser(); - HttpSession session = mockedRequest.getSession(); - session.setAttribute("user", user); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - PortalRestResponse<String> actualPortalRestResponse = new PortalRestResponse<String>(); - PortalRestResponse<String> expectedPortalRestResponse = new PortalRestResponse<String>(); - expectedPortalRestResponse.setMessage("SUCCESS"); - expectedPortalRestResponse.setResponse(""); - expectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); - EpNotificationItem notificationItem = new EpNotificationItem(); - notificationItem.setNotificationId((long) 1); - notificationItem.setMsgHeader("Test"); - notificationItem.setIsForAllRoles("Y"); - Date currentDate = new Date(); - Calendar c = Calendar.getInstance(); - c.setTime(currentDate); - c.add(Calendar.DATE, 1); - Date currentDatePlusOne = c.getTime(); - notificationItem.setStartTime(currentDate); - notificationItem.setEndTime(currentDatePlusOne); - List<Long> roleList = new ArrayList<Long>(); - Long role1 = (long) 1; - roleList.add(role1); - notificationItem.setRoleIds(roleList); - HttpServletRequest request = mockitoTestSuite.getMockedRequest(); - PowerMockito.mockStatic(UserUtils.class); - Mockito.when(UserUtils.getUserIdAsLong(request)).thenReturn((long) 1); - Mockito.when(userNotificationService.saveNotification(notificationItem)).thenReturn("Test"); - actualPortalRestResponse = userNotificationController.save(mockedRequest, mockedResponse, notificationItem); - assertTrue(actualPortalRestResponse.equals(expectedPortalRestResponse)); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRolesControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRolesControllerTest.java deleted file mode 100644 index 4014f441..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/UserRolesControllerTest.java +++ /dev/null @@ -1,308 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -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.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.controller.UserRolesController; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EcompAuditLog; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.SearchService; -import org.openecomp.portalapp.portal.service.UserRolesService; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.AppWithRolesForUser; -import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.FieldsValidator.FieldName; -import org.openecomp.portalapp.portal.transport.RoleInAppForUser; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({EcompPortalUtils.class, EPCommonSystemProperties.class, EcompAuditLog.class, SystemProperties.class}) -public class UserRolesControllerTest extends MockitoTestSuite { - - String userid = "ab1234"; - - @Mock - UserRolesService userRolesService; - - @Mock - SearchService searchService; - - @Mock - AuditService auditService; - - @Mock - AdminRolesService adminRolesService; - - @Mock - FieldsValidator fieldsValidator; - - @InjectMocks - UserRolesController userRolesController = new UserRolesController(); - - @Mock - private DataAccessService dataAccessService; - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - - @Mock - EPUser epuser; - - MockEPUser mockUser = new MockEPUser(); - - @Test - public void putAppWithUserRoleRequestTest() { - - FieldsValidator actualFieldsValidator = null; - - AppWithRolesForUser appWithRolesForUser = new AppWithRolesForUser(); - List<RoleInAppForUser> listofRoles = new ArrayList<RoleInAppForUser>(); - - appWithRolesForUser.setOrgUserId("guest"); - appWithRolesForUser.setAppId((long) 550); - appWithRolesForUser.setAppName("D2 Services Analytics Dashboard"); - appWithRolesForUser.setAppRoles(listofRoles); - - RoleInAppForUser roleInAppForUser = new RoleInAppForUser(); - roleInAppForUser.setIsApplied(false); - roleInAppForUser.setRoleId((long) 1); - roleInAppForUser.setRoleName("System Administrator"); - - RoleInAppForUser roleInAppForUser1 = new RoleInAppForUser(); - roleInAppForUser1.setIsApplied(true); - roleInAppForUser1.setRoleId((long) 16); - roleInAppForUser1.setRoleName("Standard User"); - - listofRoles.add(roleInAppForUser); - listofRoles.add(roleInAppForUser1); - EPUser user = mockUser.mockEPUser(); - FieldsValidator expectedFieldValidator = new FieldsValidator(); - List<FieldName> fields = new ArrayList<>(); - - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(fields); - expectedFieldValidator.setErrorCode(null); - HttpSession session = mockedRequest.getSession(); - session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(userRolesService.putUserAppRolesRequest(appWithRolesForUser, user)) - .thenReturn(expectedFieldValidator); - - actualFieldsValidator = userRolesController.putAppWithUserRoleRequest(mockedRequest, appWithRolesForUser, - mockedResponse); - assertEquals(expectedFieldValidator.getHttpStatusCode(), actualFieldsValidator.getHttpStatusCode()); - assertEquals(expectedFieldValidator.getErrorCode(), actualFieldsValidator.getErrorCode()); - assertEquals(expectedFieldValidator.getFields(), actualFieldsValidator.getFields()); - - } - - @Test - public void getPhoneBookSearchResultBadPermissionsTest() { - String searchString = "test"; - String actualResult = null; - String expectedResult = null; - - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false); - Mockito.when(searchService.searchUsersInPhoneBook(searchString)).thenReturn(actualResult); - - actualResult = userRolesController.getPhoneBookSearchResult(mockedRequest, searchString, mockedResponse); - assertEquals(expectedResult, actualResult); - - } - - @Test - public void getPhoneBookSearchResultValidationTest() { - String searchString = " t"; - String actualResult = null; - String expectedResult = null; - - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false); - Mockito.when(searchService.searchUsersInPhoneBook(searchString)).thenReturn(actualResult); - - actualResult = userRolesController.getPhoneBookSearchResult(mockedRequest, searchString, mockedResponse); - assertEquals(expectedResult, actualResult); - - } - - @Test - public void getPhoneBookSearchResultTest() { - String searchString = "test"; - String actualResult = null; - String expectedResult = null; - - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false); - Mockito.when(searchService.searchUsersInPhoneBook(searchString)).thenReturn(actualResult); - - actualResult = userRolesController.getPhoneBookSearchResult(mockedRequest, searchString, mockedResponse); - assertEquals(expectedResult, actualResult); - - } - - @Test - public void getAppsWithAdminRoleStateForUserTest(){ - - String orgUserId = "hb123f"; - AppsListWithAdminRole actualResult = new AppsListWithAdminRole(); - AppsListWithAdminRole expectedResult = new AppsListWithAdminRole(); - EPUser user = mockUser.mockEPUser(); - // PowerMockito.mockStatic(EcompPortalUtils.class); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(adminRolesService.getAppsWithAdminRoleStateForUser(orgUserId)).thenReturn(actualResult); - - actualResult = userRolesController.getAppsWithAdminRoleStateForUser(mockedRequest, orgUserId, mockedResponse); - assertEquals(expectedResult, actualResult); - } - - /*@Test - public void getAppsWithAdminRoleStateForUserBadRequestTest(){ - - String orgUserId = "hb123f"; - AppsListWithAdminRole actualResult = null; - AppsListWithAdminRole expectedResult = null; - EPUser user = mockUser.mockEPUser(); - PowerMockito.mockStatic(EcompPortalUtils.class); - PowerMockito.when(EcompPortalUtils.legitimateUserId(orgUserId)).thenReturn(false); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(adminRolesService.getAppsWithAdminRoleStateForUser(orgUserId)).thenReturn(actualResult); - - actualResult = userRolesController.getAppsWithAdminRoleStateForUser(mockedRequest, orgUserId, mockedResponse); - assertEquals(expectedResult, actualResult); - }*/ - - @Test - public void putAppsWithAdminRoleStateForUserBadStatusCodeTest(){ - FieldsValidator actualFieldsValidator = null; - AppsListWithAdminRole newAppsListWithAdminRoles = new AppsListWithAdminRole(); - FieldsValidator expectedFieldsValidator = new FieldsValidator(); - List<FieldName> fieldNames = new ArrayList<FieldName>(); - expectedFieldsValidator.setErrorCode(null); - expectedFieldsValidator.setFields(fieldNames); - expectedFieldsValidator.setHttpStatusCode((long)200); - - EPUser user = mockUser.mockEPUser(); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - - actualFieldsValidator = userRolesController.putAppsWithAdminRoleStateForUser(mockedRequest, newAppsListWithAdminRoles, mockedResponse); - assertEquals(expectedFieldsValidator, actualFieldsValidator); - } - - - /*@Test - public void putAppsWithAdminRoleStateForUserTest() { - - FieldsValidator actualFieldsValidator = null; - AppsListWithAdminRole newAppsListWithAdminRoles = new AppsListWithAdminRole(); - EPUser user = mockUser.mockEPUser(); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(adminRolesService.isAccountAdmin(user)).thenReturn(false); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - PowerMockito.mockStatic(EcompAuditLog.class); - PowerMockito.mockStatic(SystemProperties.class); - Mockito.when(SystemProperties.getProperty(EcompAuditLog.CD_ACTIVITY_UPDATE_ACCOUNT_ADMIN)).thenReturn("1400"); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP)).thenReturn("1400"); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)).thenReturn("1400"); - Mockito.when(SystemProperties.getProperty(SystemProperties.MDC_TIMER)).thenReturn("1400"); - - actualFieldsValidator = userRolesController.putAppsWithAdminRoleStateForUser(mockedRequest, newAppsListWithAdminRoles, mockedResponse); - - System.out.println(actualFieldsValidator); - Mockito.when(searchService.searchUsersInPhoneBook(searchString)).thenReturn(actualResult); - - actualResult = userRolesController.getPhoneBookSearchResult(mockedRequest, searchString, mockedResponse); - assertEquals(expectedResult, actualResult); - - }*/ - - /*@Test - public void putAppsWithAdminRoleStateForUserTest(){ - FieldsValidator actualFieldsValidator = null; - AppsListWithAdminRole newAppsListWithAdminRoles = new AppsListWithAdminRole(); - FieldsValidator expectedFieldsValidator = new FieldsValidator(); - List<FieldName> fieldNames = new ArrayList<FieldName>(); - expectedFieldsValidator.setErrorCode(null); - expectedFieldsValidator.setFields(fieldNames); - expectedFieldsValidator.setHttpStatusCode((long)200); - - EPUser user = mockUser.mockEPUser(); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - PowerMockito.mockStatic(EcompAuditLog.class); - PowerMockito.mockStatic(SystemProperties.class); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(adminRolesService.setAppsWithAdminRoleStateForUser(newAppsListWithAdminRoles)); - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - - // Mockito.call(auditService.logActivity(auditLog, null)); -// Mockito.when(SystemProperties.getProperty(EcompAuditLog.CD_ACTIVITY_UPDATE_ACCOUNT_ADMIN)).thenReturn("1400"); -// Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP)).thenReturn("1400"); -// Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)).thenReturn("1400"); -// Mockito.when(SystemProperties.getProperty(SystemProperties.MDC_TIMER)).thenReturn("1400"); - - actualFieldsValidator = userRolesController.putAppsWithAdminRoleStateForUser(mockedRequest, newAppsListWithAdminRoles, mockedResponse); - assertEquals(expectedFieldsValidator, actualFieldsValidator); - }*/ -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WebAnalyticsExtAppControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WebAnalyticsExtAppControllerTest.java deleted file mode 100644 index 4973894a..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WebAnalyticsExtAppControllerTest.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.*; - -import java.io.InputStream; -import java.nio.charset.StandardCharsets; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.commons.io.IOUtils; -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.openecomp.portalapp.portal.controller.WebAnalyticsExtAppController; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; -import org.openecomp.portalapp.portal.service.AppsCacheService; -import org.openecomp.portalapp.portal.service.AppsCacheServiceImple; -import org.openecomp.portalapp.portal.transport.Analytics; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.onboarding.crossapi.PortalAPIResponse; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.service.AuditServiceImpl; -import org.openecomp.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,IOUtils.class,Object.class}) -public class WebAnalyticsExtAppControllerTest { - - - - @InjectMocks - WebAnalyticsExtAppController webAnalyticsExtAppController = new WebAnalyticsExtAppController(); - - @Mock - AdminRolesService adminRolesService = new AdminRolesServiceImpl(); - - @Mock - AppsCacheService appCacheService = new AppsCacheServiceImple(); - - @Mock - AuditService auditService = new AuditServiceImpl(); - -// @Mock -// InputStream analyticsFileStream; - - - @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 getAnalyticsScriptTest() throws Exception - { - String expectedResponse = "http://www.ecomp.com"; - - InputStream analyticsFileStream = null; - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(IOUtils.class); - Mockito.when(IOUtils.toString(analyticsFileStream, StandardCharsets.UTF_8.name())).thenReturn("PORTAL_ENV_URL"); - Mockito.when(SystemProperties.getProperty("frontend_url")).thenReturn("http://www.ecomp.com/test"); - String actualResponse = webAnalyticsExtAppController.getAnalyticsScript(mockedRequest); -// assertNull(webAnalyticsExtAppController.getAnalyticsScript(mockedRequest)); - - // System.out.println(actualResponse); - assertTrue(actualResponse.equals(expectedResponse)); - }*/ - - /*@Test - public void getAnalyticsScriptExceptionTest() throws Exception - { - String expectedResponse = ""; - InputStream analyticsFileStream = null; - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(IOUtils.class); - Mockito.when(IOUtils.toString(analyticsFileStream, StandardCharsets.UTF_8.name())).thenThrow(nullPointerException); - Mockito.when(SystemProperties.getProperty("frontend_url")).thenReturn("http://www.ecomp.com/test"); - String actualResponse = webAnalyticsExtAppController.getAnalyticsScript(mockedRequest); - assertEquals(actualResponse,expectedResponse); - }*/ - - @Test - public void storeAnalyticsScriptIfAnalyticsNullTest() throws Exception - { - PortalAPIResponse expectedPortalAPIResponse = new PortalAPIResponse(true, "error"); - Analytics analytics= null; - Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(null); - PortalAPIResponse actualPortalAPIResponse = webAnalyticsExtAppController.storeAnalyticsScript(mockedRequest, analytics); - assertTrue(expectedPortalAPIResponse.getMessage().equals(actualPortalAPIResponse.getMessage())); - assertTrue(expectedPortalAPIResponse.getStatus().equals(actualPortalAPIResponse.getStatus())); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogController.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogController.java deleted file mode 100644 index f3255917..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogController.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertEquals; - -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.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.controller.DashboardController; -import org.openecomp.portalapp.portal.domain.WidgetCatalog; -import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl; -import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.service.MicroserviceService; -import org.openecomp.portalapp.portal.service.MicroserviceServiceImpl; -import org.openecomp.portalapp.portal.service.WidgetParameterService; -import org.openecomp.portalapp.portal.service.WidgetParameterServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.portal.utils.CustomLoggingFilter; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.client.RestClientException; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({EPUserUtils.class}) -public class WidgetsCatalogController { - - @Mock - ConsulHealthService consulHealthService = new ConsulHealthServiceImpl(); - - @Mock - MicroserviceService microserviceService = new MicroserviceServiceImpl(); - - @Mock - WidgetParameterService widgetParameterService = new WidgetParameterServiceImpl(); - - @InjectMocks - WidgetsCatalogController widgetsCatalogController = new WidgetsCatalogController(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - - NullPointerException nullPointerException = new NullPointerException(); - - MockEPUser mockUser = new MockEPUser(); - - /*public List<WidgetCatalog> getUserWidgetCatalog(HttpServletRequest request, HttpServletResponse response, - @PathVariable("loginName") String loginName) throws RestClientException, Exception { - List<WidgetCatalog> widgets = new ArrayList<>(); - try { - CustomLoggingFilter d; - ResponseEntity<ArrayList> ans = template.exchange( - EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) - + "/widget/microservices/widgetCatalog/" + loginName, - HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class); - widgets = ans.getBody(); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getUserWidgetCatalog failed", e); - // returning null because null help check on the UI if there was a - // communication problem with Microservice. - return null; - } - return widgets; - } - - @Test - public void getWidgetDataTest(){ - - String resourceType = null; - List<WidgetCatalog> expectedData = new ArrayList<WidgetCatalog>(); - expectedData.setStatus(PortalRestStatusEnum.ERROR); - expectedData.setMessage("Unexpected resource type null"); - expectedData.setResponse(null); - - PortalRestResponse<CommonWidgetMeta> actualResponse = dashboardController.getWidgetData(mockedRequest, resourceType); - assertEquals(expectedData,actualResponse); - - - }*/ -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java deleted file mode 100644 index 60a9b7a1..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/WidgetsCatalogMarkupControllerTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.openecomp.portalapp.portal.test.controller; - -import static org.junit.Assert.assertTrue; - -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.openecomp.portalapp.portal.controller.WidgetsCatalogMarkupController; -import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; -import org.openecomp.portalapp.portal.service.ConsulHealthService; -import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.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.web.client.RestClientException; -import org.springframework.web.client.RestTemplate; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(WidgetServiceHeaders.class) -public class WidgetsCatalogMarkupControllerTest extends MockitoTestSuite { - - @InjectMocks - WidgetsCatalogMarkupController widgetsCatalogMarkupController = new WidgetsCatalogMarkupController(); - - @Mock - ConsulHealthService consulHealthService = new ConsulHealthServiceImpl(); - - @Mock - RestTemplate template = new RestTemplate(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - @Mock - CipherUtil cipherUtil= new CipherUtil(); - - @Mock - EcompPortalUtils EcompPortalUtils =new EcompPortalUtils(); - - @Mock - WidgetServiceHeaders WidgetServiceHeaders ; - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - - @SuppressWarnings("static-access") - @Test - public void getWidgetMarkupTest() throws RestClientException, Exception - { - String whatService = "widgets-service"; - PowerMockito.mockStatic(WidgetServiceHeaders.class); - Mockito.when(template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, null) + "/widget/microservices/markup/" + 1, String.class, - WidgetServiceHeaders.getInstance())).thenReturn("Success"); - String response = widgetsCatalogMarkupController.getWidgetMarkup(mockedRequest, mockedResponse, 1); - assertTrue(response.equals("Success")); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/MockEPUser.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/MockEPUser.java deleted file mode 100644 index 344350e0..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/MockEPUser.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.core; - -import java.util.Date; - -import org.openecomp.portalapp.portal.domain.EPUser; - -public class MockEPUser { - - public EPUser mockEPUser() { - - EPUser ePUser = new EPUser(); - ePUser.setOrgId(null); - ePUser.setManagerId(null); - ePUser.setFirstName("test"); - ePUser.setLastName("test"); - ePUser.setMiddleInitial(null); - ePUser.setPhone(null); - ePUser.setFax(null); - ePUser.setCellular(null); - ePUser.setEmail(null); - ePUser.setAddressId(null); - ePUser.setAlertMethodCd(null); - ePUser.setHrid(null); - ePUser.setOrgUserId("guestT"); - ePUser.setOrgCode(null); - ePUser.setAddress1(null); - ePUser.setAddress2(null); - ePUser.setCity(null); - ePUser.setState(null); - ePUser.setZipCode(null); - ePUser.setCountry(null); - ePUser.setOrgManagerUserId(null); - ePUser.setLocationClli(null); - ePUser.setBusinessCountryCode(null); - ePUser.setBusinessCountryName(null); - ePUser.setBusinessUnit(null); - ePUser.setBusinessUnitName(null); - ePUser.setDepartment(null); - ePUser.setDepartmentName(null); - ePUser.setCompanyCode(null); - ePUser.setCompany(null); - ePUser.setZipCodeSuffix(null); - ePUser.setJobTitle(null); - ePUser.setCommandChain(null); - ePUser.setSiloStatus(null); - ePUser.setCostCenter(null); - ePUser.setFinancialLocCode(null); - - ePUser.setLoginId(null); - ePUser.setLoginPwd(null); - Date date = new Date(); - ePUser.setLastLoginDate(date); - ePUser.setActive(true); - ePUser.setInternal(false); - ePUser.setSelectedProfileId(null); - ePUser.setTimeZoneId(null); - ePUser.setOnline(true); - ePUser.setChatId(null); - ePUser.setUserApps(null); - ePUser.setPseudoRoles(null); - - ePUser.setId((long) -1); - return ePUser; - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/PopulateSampleTestData.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/PopulateSampleTestData.java deleted file mode 100644 index 8f99f442..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/PopulateSampleTestData.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.core; - -import java.sql.Connection; -import java.sql.SQLException; - -import javax.sql.DataSource; - -import org.junit.Before; -import org.junit.Test; -import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.ClassPathResource; -import org.springframework.jdbc.datasource.DataSourceUtils; -import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; - -public class PopulateSampleTestData extends ApplicationCommonContextTestSuite { - - @Autowired - DataSource dataSource; - - @Before - public void populateTestData() throws SQLException { - - String sql = "PopulateTestData.sql"; - createConnection(sql); - } - - public void createConnection(String sql) { - Connection connection = null; - ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); - populator.addScript(new ClassPathResource(sql)); - try { - connection = DataSourceUtils.getConnection(dataSource); - populator.populate(connection); - } finally { - if (connection != null) { - DataSourceUtils.releaseConnection(connection, dataSource); - } - } - } - - @Test - public void populateTest() { - assert (true); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RemoveSampleTestData.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RemoveSampleTestData.java deleted file mode 100644 index c9954a69..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RemoveSampleTestData.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.core; - -import java.sql.Connection; -import java.sql.SQLException; - -import javax.sql.DataSource; - -import org.junit.After; -import org.junit.Test; -import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.ClassPathResource; -import org.springframework.jdbc.datasource.DataSourceUtils; -import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; - -public class RemoveSampleTestData extends ApplicationCommonContextTestSuite { - @Autowired - DataSource dataSource; - - public static int count = 0; - - @After - public void removeTestData() throws SQLException { - String sql = "RemoveTestData.sql"; - createConnection(sql); - } - - public void createConnection(String sql) { - Connection connection = null; - ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); - populator.addScript(new ClassPathResource(sql)); - try { - connection = DataSourceUtils.getConnection(dataSource); - populator.populate(connection); - } finally { - if (connection != null) { - DataSourceUtils.releaseConnection(connection, dataSource); - } - } - } - - @Test - public void removeTest() { - assert (true); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RestURLsTestSuite.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RestURLsTestSuite.java deleted file mode 100644 index 10108cde..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/core/RestURLsTestSuite.java +++ /dev/null @@ -1,333 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.core; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.nio.charset.Charset; -import java.util.ArrayList; - -import org.junit.Assert; -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin; -import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole; -import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.ResultActions; -import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * - * Use RestURLsTestSuite to test Rest API URL's - */ -public class RestURLsTestSuite extends ApplicationCommonContextTestSuite { - - public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(), - MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); - - String url = null; - - MockEPUser mockUser = new MockEPUser(); - - public byte[] convertObjectToJsonBytes(Object object) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - return mapper.writeValueAsBytes(object); - } - - public void requestBuilder(String url) throws Exception { - EPUser user = mockUser.mockEPUser(); - - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get(url); - requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - ResultActions ra = getMockMvc().perform(requestBuilder); - assertData(ra); - } - - public void assertData(ResultActions ra) { - Assert.assertEquals("application/json", ra.andReturn().getResponse().getContentType()); - Assert.assertEquals(200, ra.andReturn().getResponse().getStatus()); - - } - - @Test - public void getMenuItemsTest() throws Exception { - url = "/portalApi/functionalMenu"; - requestBuilder(url); - } - - @Test - public void getMenuItemsForNotificationsTest() throws Exception { - url = "/portalApi/functionalMenuForNotificationTree"; - requestBuilder(url); - } - - @Test - public void getUserAppsTestnew() throws Exception { - url = "/portalApi/userApps"; - requestBuilder(url); - } - - @Test - public void getPersUserAppsTest() throws Exception { - url = "/portalApi/persUserApps"; - requestBuilder(url); - } - - @Test - public void getAppCatalogTest() throws Exception { - url = "/portalApi/appCatalog"; - requestBuilder(url); - } - - @Test - public void getAppListNewTest() throws Exception { - ResultActions ra = getMockMvc() - .perform(MockMvcRequestBuilders.get("/portalApi/userApplicationRoles").param("userId", "guest")); - assertData(ra); - } - - @Test - public void getAvailableAppListTest() throws Exception { - url = "/portalApi/availableApps"; - requestBuilder(url); - } - - @Test - public void getAllAppsTest() throws Exception { - url = "/portalApi/allAvailableApps"; - requestBuilder(url); - } - - @Test - public void getUserProfileTest() throws Exception { - url = "/portalApi/userProfile"; - requestBuilder(url); - } - - @Test - public void getRolesByAppTest() throws Exception { - EPUser user = mockUser.mockEPUser(); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/adminAppsRoles/550"); - requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - ResultActions ra = getMockMvc().perform(requestBuilder); - assertData(ra); - } - - @Test - public void getAppsWithAdminRoleStateForUserTest() throws Exception { - url = "/portalApi/adminAppsRoles?user=guest"; - requestBuilder(url); - - } - - @Test - public void getUsersFromAppEndpointTest() throws Exception { - url = "/portalApi/app/550/users"; - requestBuilder(url); - } - - @Test - public void getOnboardingAppsTest() throws Exception { - url = "/portalApi/onboardingApps"; - requestBuilder(url); - } - - @Test - public void getMenuItemsForAuthUserTest() throws Exception { - url = "/portalApi/functionalMenuForAuthUser"; - requestBuilder(url); - } - - @Test - public void getMenuItemsForEditingTest() throws Exception { - url = "/portalApi/functionalMenuForEditing"; - requestBuilder(url); - } - - @Test - public void getAppRolesTest() throws Exception { - url = "/portalApi/appRoles/455"; - requestBuilder(url); - } - - @Test - public void regenerateAncestorTableTest() throws Exception { - - EPUser user = mockUser.mockEPUser(); - - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders - .get("/portalApi/regenerateFunctionalMenuAncestors"); - requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - ResultActions ra = getMockMvc().perform(requestBuilder); - assertEquals("application/json;charset=UTF-8", ra.andReturn().getResponse().getContentType()); - Assert.assertEquals(200, ra.andReturn().getResponse().getStatus()); - - } - - @Test - public void getAppListTest() throws Exception { - url = "/portalApi/getAppList"; - requestBuilder(url); - } - - @Test - public void getFavoritesForUserTest() throws Exception { - url = "/portalApi/getFavoriteItems"; - requestBuilder(url); - } - - @Test - public void getManifestTest() throws Exception { - url = "/portalApi/manifest"; - requestBuilder(url); - } - - @Test - public void getActiveUsersTest() throws Exception { - url = "/portalApi/dashboard/activeUsers"; - requestBuilder(url); - } - - @Test - public void searchPortalTest() throws Exception { - EPUser user = mockUser.mockEPUser(); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/dashboard/search") - .param("searchString", "guest"); - requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - ResultActions ra = getMockMvc().perform(requestBuilder); - assertData(ra); - } - - @Test - public void getWidgetDataTest() throws Exception { - EPUser user = mockUser.mockEPUser(); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/dashboard/widgetData") - .param("resourceType", "guest"); - requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - ResultActions ra = getMockMvc().perform(requestBuilder); - assertData(ra); - } - - @Test - public void getAppsAndContactsTest() throws Exception { - url = "/portalApi/contactus/allapps"; - requestBuilder(url); - } - - @Test - public void getPortalDetailsTest() throws Exception { - url = "/portalApi/contactus/feedback"; - requestBuilder(url); - } - - @Test - public void getAppCategoryFunctionsTest() throws Exception { - url = "/portalApi/contactus/functions"; - requestBuilder(url); - } - - @Test - public void getOnlineUserUpdateRateTest() throws Exception { - url = "/portalApi/dashboard/onlineUserUpdateRate"; - requestBuilder(url); - } - - @Test - public void getMenuIdRoleIdTest() throws Exception { - url = "/portalApi/getFunctionalMenuRole"; - requestBuilder(url); - } - - @Test - public void getNotificationsTest() throws Exception { - url = "/portalApi/getNotifications"; - requestBuilder(url); - } - - @Test - public void getAdminNotificationsTest() throws Exception { - url = "/portalApi/getAdminNotifications"; - requestBuilder(url); - } - - @Test - public void getNotificationAppRolesTest() throws Exception { - url = "/portalApi/getNotificationAppRoles"; - requestBuilder(url); - } - - @Test - public void getNotificationUpdateRateTest() throws Exception { - url = "/portalApi/notificationUpdateRate"; - requestBuilder(url); - } - - @Test - public void notificationReadTest() throws Exception { - url = "/portalApi/notificationRead?notificationId=262"; - requestBuilder(url); - } - - @Test - public void testGetRolesTest() throws Exception { - url = "/portalApi/notificationRole/248/roles"; - requestBuilder(url); - } - - @Test - public void putAppsWithAdminRoleStateForUserTest() throws Exception { - - AppsListWithAdminRole appsListWithAdminRole = new AppsListWithAdminRole(); - appsListWithAdminRole.setOrgUserId("guest"); - ArrayList<AppNameIdIsAdmin> appsRoles = new ArrayList<AppNameIdIsAdmin>(); - AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin(); - appNameIdIsAdmin.setId((long) 455); - appNameIdIsAdmin.setAppName("CCD"); - appNameIdIsAdmin.setIsAdmin(true); - appNameIdIsAdmin.setRestrictedApp(false); - appsRoles.add(appNameIdIsAdmin); - appsListWithAdminRole.setAppsRoles(appsRoles); - EPUser user = mockUser.mockEPUser(); - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.put("/portalApi/adminAppsRoles") - .contentType(APPLICATION_JSON_UTF8).content(convertObjectToJsonBytes(appsListWithAdminRole)); - - requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); - ResultActions ra = getMockMvc().perform(requestBuilder); - assertData(ra); - } - - @Test - public void ticketEventControllerForExternalSystem() throws Exception { - String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}"; - MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/auxapi/ticketevent") - .contentType(APPLICATION_JSON_UTF8).content(ticketEventJson); - ResultActions ra = getMockMvc().perform(requestBuilder); - assertTrue(ra.andReturn().getResponse().getContentType().contains("application/json")); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserAppTest.java deleted file mode 100644 index ed13c2df..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserAppTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.AdminUserApp; - -public class AdminUserAppTest { - - public AdminUserApp mockAdminUserApp(){ - - AdminUserApp adminUserApp = new AdminUserApp(); - - adminUserApp.setUserId((long)1); - adminUserApp.setFirstName("test"); - adminUserApp.setLastName("test"); - adminUserApp.setOrgUserId("test"); - adminUserApp.setAppId((long)1); - adminUserApp.setAppName("test"); - - return adminUserApp; - } - - @Test - public void adminUserAppTest(){ - AdminUserApp adminUserApp = mockAdminUserApp(); - - assertEquals(adminUserApp.getUser_Id(), new Long(1)); - assertEquals(adminUserApp.getFirstName(), "test"); - assertEquals(adminUserApp.getLastName(), "test"); - assertEquals(adminUserApp.getOrgUserId(), "test"); - assertEquals(adminUserApp.getAppName(), "test"); - assertEquals(adminUserApp.getAppId(), new Long(1)); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserApplicationsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserApplicationsTest.java deleted file mode 100644 index 6faf44a8..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AdminUserApplicationsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import javax.persistence.Column; -import javax.persistence.Id; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.AdminUserApp; -import org.openecomp.portalapp.portal.domain.AdminUserApplications; - -public class AdminUserApplicationsTest { - - public AdminUserApplications mockAdminUserApplications(){ - - AdminUserApp adminUserApp = new AdminUserApp(); - - adminUserApp.setUserId((long)1); - adminUserApp.setFirstName("test"); - adminUserApp.setLastName("test"); - adminUserApp.setOrgUserId("test"); - adminUserApp.setAppId((long)1); - adminUserApp.setAppName("test"); - - AdminUserApplications adminUserApplications = new AdminUserApplications(adminUserApp); - - adminUserApplications.setUser_Id((long)1); - adminUserApplications.setFirstName("test"); - adminUserApplications.setLastName("test"); - adminUserApplications.setOrgUserId("test"); - return adminUserApplications; - } - - @Test - public void adminUserAppTest(){ - AdminUserApplications adminUserApplications = mockAdminUserApplications(); - AdminUserApp adminUserApp = new AdminUserApp(); - - adminUserApp.setUserId((long)1); - adminUserApp.setFirstName("test"); - adminUserApp.setLastName("test"); - adminUserApp.setOrgUserId("test"); - adminUserApp.setAppId((long)1); - adminUserApp.setAppName("test"); - AdminUserApplications adminUserApplications1 = new AdminUserApplications(adminUserApp); - - assertEquals(adminUserApplications.getUser_Id(), new Long(1)); - assertEquals(adminUserApplications.getFirstName(), "test"); - assertEquals(adminUserApplications.getLastName(), "test"); - assertEquals(adminUserApplications.getOrgUserId(), "test"); - - - assertEquals(adminUserApplications1.getApps().get(0).getAppId(),adminUserApp.getAppId()); - assertEquals(adminUserApplications1.getApps().get(0).getAppName(),adminUserApp.getAppName()); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AppContactUsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AppContactUsTest.java deleted file mode 100644 index f4368616..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/AppContactUsTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.AppContactUs; - -public class AppContactUsTest { - - public AppContactUs mockAppContactUs(){ - AppContactUs appContactUs = new AppContactUs(); - appContactUs.setDescription("test"); - appContactUs.setContactEmail("test"); - appContactUs.setContactName("test"); - appContactUs.setUrl("test"); - appContactUs.setActiveYN("test"); - - return appContactUs; - } - - @Test - public void mockAppContactUsTest(){ - AppContactUs appContactUs = mockAppContactUs(); - - assertEquals(appContactUs.getDescription(), "test"); - assertEquals(appContactUs.getContactEmail(), "test"); - assertEquals(appContactUs.getContactName(), "test"); - assertEquals(appContactUs.getUrl(), "test"); - assertEquals(appContactUs.getActiveYN(), "test"); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/CentralRoleFunctionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/CentralRoleFunctionTest.java deleted file mode 100644 index 83bdc591..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/CentralRoleFunctionTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; - -public class CentralRoleFunctionTest { - - public CentralRoleFunction mockCentralRoleFunction(){ - - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - - centralRoleFunction.setCode("test"); - centralRoleFunction.setName("test"); - centralRoleFunction.setAppId((long)1); - centralRoleFunction.setEditUrl("test"); - - return centralRoleFunction; - } - - @Test - public void centralRoleFunctionTest(){ - CentralRoleFunction centralRoleFunction = mockCentralRoleFunction(); - - assertEquals(centralRoleFunction.getAppId(), new Long(1)); - assertEquals(centralRoleFunction.getCode(), "test"); - assertEquals(centralRoleFunction.getName(), "test"); - assertEquals(centralRoleFunction.getEditUrl(), "test"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppRoleFunctionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppRoleFunctionTest.java deleted file mode 100644 index a3f24631..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppRoleFunctionTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPAppRoleFunction; - -public class EPAppRoleFunctionTest { - - public EPAppRoleFunction mockEPAppRoleFunction(){ - EPAppRoleFunction epAppRoleFunction = new EPAppRoleFunction(); - epAppRoleFunction.setRoleId((long)1); - epAppRoleFunction.setAppId((long)1); - epAppRoleFunction.setCode("test"); - - return epAppRoleFunction; - } - - @Test - public void epAppRoleFunctionTest(){ - EPAppRoleFunction epAppRoleFunction = mockEPAppRoleFunction(); - - assertEquals(epAppRoleFunction.getRoleId(), new Long(1)); - assertEquals(epAppRoleFunction.getAppId(), new Long(1)); - assertEquals(epAppRoleFunction.getCode(), "test"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppTest.java deleted file mode 100644 index 9a60e7d7..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPAppTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPApp; - -public class EPAppTest { - - public EPApp mockEPApp(){ - EPApp epApp = new EPApp(); - - epApp.setName("test"); - epApp.setImageUrl("test"); - epApp.setDescription("test"); - epApp.setNotes("test"); - epApp.setUrl("test"); - epApp.setAlternateUrl("test"); - epApp.setAppRestEndpoint("test"); - epApp.setMlAppName("test"); - epApp.setMlAppAdminId("test"); - epApp.setMotsId((long)1); - epApp.setUsername("test"); - epApp.setAppPassword("test"); - epApp.setOpen(false); - epApp.setEnabled(false); - epApp.setUebTopicName("test"); - epApp.setUebSecret("test"); - epApp.setAppType(1); - epApp.setCentralAuth(false); - epApp.setNameSpace("test"); - - return epApp; - } - - @Test - public void epAppTest(){ - EPApp epApp = mockEPApp(); - - assertEquals(epApp.getName(), "test"); - assertEquals(epApp.getImageUrl(), "test"); - assertEquals(epApp.getDescription(), "test"); - assertEquals(epApp.getNotes(), "test"); - assertEquals(epApp.getUrl(), "test"); - assertEquals(epApp.getAlternateUrl(), "test"); - assertEquals(epApp.getAppRestEndpoint(), "test"); - assertEquals(epApp.getMlAppName(), "test"); - assertEquals(epApp.getMlAppAdminId(), "test"); - assertEquals(epApp.getMotsId(), new Long(1)); - assertEquals(epApp.getUsername(), "test"); - assertEquals(epApp.getAppPassword(), "test"); - assertEquals(epApp.getOpen(), false); - assertEquals(epApp.getEnabled(), false); - assertEquals(epApp.getUebTopicName(), "test"); - assertEquals(epApp.getUebSecret(), "test"); - assertEquals(epApp.getAppType(), Integer.valueOf(1)); - assertEquals(epApp.getCentralAuth(), false); - assertEquals(epApp.getNameSpace(), "test"); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointAccountTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointAccountTest.java deleted file mode 100644 index 07206244..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointAccountTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPEndpointAccount; - -public class EPEndpointAccountTest { - - public EPEndpointAccount mockEPEndpointAccount(){ - EPEndpointAccount epEndpointAccount = new EPEndpointAccount(); - - epEndpointAccount.setEp_id((long)1); - epEndpointAccount.setAccount_id((long)1); - epEndpointAccount.setId((long)1); - - return epEndpointAccount; - } - - @Test - public void epEndpointAccount(){ - EPEndpointAccount epEndpointAccount = mockEPEndpointAccount(); - assertEquals(epEndpointAccount.getEp_id(), new Long(1)); - assertEquals(epEndpointAccount.getAccount_id(), new Long(1)); - assertEquals(epEndpointAccount.getId(), new Long(1)); - - assertEquals(epEndpointAccount.toString(), "EPEndpointAccount [id=1, ep_id=1, account_id=1]"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointTest.java deleted file mode 100644 index 8fbee988..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPEndpointTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPEndpoint; - -public class EPEndpointTest { - - public EPEndpoint mockEPEndpoint(){ - EPEndpoint epEndpoint = new EPEndpoint(); - - epEndpoint.setId((long)1); - epEndpoint.setName("test"); - - return epEndpoint; - } - - @Test - public void epEndpointTest(){ - EPEndpoint epEndpoint = mockEPEndpoint(); - - assertEquals(epEndpoint.getId(), new Long(1)); - assertEquals(epEndpoint.getName(), "test"); - assertEquals("EPEndpoint [id=1, name=test]", epEndpoint.toString()); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPRoleTest.java deleted file mode 100644 index 05453bfa..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPRoleTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPRole; - -public class EPRoleTest { - - public EPRole mockEPRole(){ - EPRole epRole = new EPRole(); - - epRole.setName("test"); - epRole.setActive(false); - epRole.setPriority(1); - epRole.setAppId((long)1); - epRole.setAppRoleId((long)1); - - return epRole; - } - - @Test - public void epRoleTest(){ - EPRole epRole = mockEPRole(); - - assertEquals(epRole.getName(), "test"); - assertEquals(epRole.getActive(), false); - assertEquals(epRole.getPriority().toString(),"1"); - assertEquals(epRole.getAppId(), new Long(1)); - assertEquals(epRole.getAppRoleId(), new Long(1)); - - assertEquals(epRole.toString(), "[Id = null, name = test]"); - - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppCatalogRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppCatalogRolesTest.java deleted file mode 100644 index a21eec76..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppCatalogRolesTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserAppCatalogRoles; - -public class EPUserAppCatalogRolesTest { - - public EPUserAppCatalogRoles mockEPUserAppCatalogRoles(){ - EPUserAppCatalogRoles epUserAppCatalogRoles = new EPUserAppCatalogRoles(); - - epUserAppCatalogRoles.setRequestedRoleId((long)1); - epUserAppCatalogRoles.setRolename("test"); - epUserAppCatalogRoles.setRequestStatus("status"); - epUserAppCatalogRoles.setAppId((long)1); - - return epUserAppCatalogRoles; - } - - @Test - public void epUserAppCatalogRolesTest(){ - EPUserAppCatalogRoles epUserAppCatalogRoles = mockEPUserAppCatalogRoles(); - - assertEquals(epUserAppCatalogRoles.getRequestedRoleId(), new Long(1)); - assertEquals(epUserAppCatalogRoles.getRolename(), "test"); - assertEquals(epUserAppCatalogRoles.getRequestStatus(), "status"); - assertEquals(epUserAppCatalogRoles.getAppId(), new Long(1)); - - assertEquals("EPUserAppCatalogRoles [requestedRoleId=1, rolename=test, requestStatus=status, appId=1]", epUserAppCatalogRoles.toString()); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesRequestDetailTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesRequestDetailTest.java deleted file mode 100644 index c9147bbe..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesRequestDetailTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequest; -import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequestDetail; - -public class EPUserAppRolesRequestDetailTest { - - public EPUserAppRolesRequestDetail mockEPUserAppRolesRequestDetail(){ - - EPUserAppRolesRequest epUserAppRolesRequest = new EPUserAppRolesRequest(); - epUserAppRolesRequest.setUserId((long)1); - epUserAppRolesRequest.setAppId((long)1); - epUserAppRolesRequest.setCreated(new Date()); - epUserAppRolesRequest.setUpdatedDate(new Date()); - epUserAppRolesRequest.setRequestStatus("test"); - - EPUserAppRolesRequestDetail epUserAppRolesRequestDetail = new EPUserAppRolesRequestDetail(); - epUserAppRolesRequestDetail.setReqRoleId((long)1); - epUserAppRolesRequestDetail.setReqType("test"); - epUserAppRolesRequestDetail.setEpRequestIdData(epUserAppRolesRequest); - - return epUserAppRolesRequestDetail; - } - - @Test - public void epUserAppRolesRequestDetailTest(){ - - EPUserAppRolesRequest epUserAppRolesRequest = new EPUserAppRolesRequest(); - epUserAppRolesRequest.setUserId((long)1); - epUserAppRolesRequest.setAppId((long)1); - epUserAppRolesRequest.setCreated(new Date()); - epUserAppRolesRequest.setUpdatedDate(new Date()); - epUserAppRolesRequest.setRequestStatus("test"); - - EPUserAppRolesRequestDetail epUserAppRolesRequestDetail = mockEPUserAppRolesRequestDetail(); - - EPUserAppRolesRequestDetail epUserAppRolesRequestDetail1 = new EPUserAppRolesRequestDetail(); - epUserAppRolesRequestDetail1.setReqRoleId((long)1); - epUserAppRolesRequestDetail1.setReqType("test"); - epUserAppRolesRequestDetail1.setEpRequestIdData(epUserAppRolesRequest); - - assertEquals(epUserAppRolesRequestDetail.getReqRoleId(), new Long(1)); - assertEquals(epUserAppRolesRequestDetail.getReqType(), "test"); - assertEquals(epUserAppRolesRequestDetail.getEpRequestIdData(), epUserAppRolesRequest); - assertEquals(epUserAppRolesRequestDetail.hashCode(), epUserAppRolesRequestDetail1.hashCode()); - - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesTest.java deleted file mode 100644 index 540c63e9..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppRolesTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserAppRoles; - -public class EPUserAppRolesTest { - - public EPUserAppRoles mockEPUserAppRoles(){ - EPUserAppRoles epUserAppRoles = new EPUserAppRoles(); - - epUserAppRoles.setRoleId((long)1); - epUserAppRoles.setAppId((long)1); - - return epUserAppRoles; - } - - @Test - public void epUserAppRolesTest(){ - EPUserAppRoles epUserAppRoles = mockEPUserAppRoles(); - - assertEquals(epUserAppRoles.getRoleId(), new Long(1)); - assertEquals(epUserAppRoles.getAppId(), new Long(1)); - assertEquals("EpUserAppRoles [roleId=1, appId=1]", epUserAppRoles.toString()); - } -} - diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppTest.java deleted file mode 100644 index 0c450ebb..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUserApp; - -public class EPUserAppTest { - - public EPUserApp mockEPUserApp(){ - - EPApp epApp = new EPApp(); - epApp.setName("test"); - epApp.setImageUrl("test"); - epApp.setDescription("test"); - epApp.setNotes("test"); - epApp.setUrl("test"); - epApp.setAlternateUrl("test"); - epApp.setAppRestEndpoint("test"); - epApp.setMlAppName("test"); - epApp.setMlAppAdminId("test"); - epApp.setMotsId((long)1); - epApp.setUsername("test"); - epApp.setAppPassword("test"); - - - //Role - EPRole epRole = new EPRole(); - epRole.setName("test"); - epRole.setActive(false); - epRole.setPriority(1); - epRole.setAppId((long)1); - epRole.setAppRoleId((long)1); - - EPUserApp user = new EPUserApp(); - user.setUserId((long)1); - user.setApp(epApp); - user.setRole(epRole); - user.setPriority((short)32767); - - - return user; - } - - @Test - public void userTest(){ - EPUserApp user = mockEPUserApp(); - - EPApp epApp = new EPApp(); - epApp.setName("test"); - epApp.setImageUrl("test"); - epApp.setDescription("test"); - epApp.setNotes("test"); - epApp.setUrl("test"); - epApp.setAlternateUrl("test"); - epApp.setAppRestEndpoint("test"); - epApp.setMlAppName("test"); - epApp.setMlAppAdminId("test"); - epApp.setMotsId((long)1); - epApp.setUsername("test"); - epApp.setAppPassword("test"); - user.setApp(epApp); - - //Role - EPRole epRole = new EPRole(); - epRole.setName("test"); - epRole.setActive(false); - epRole.setPriority(1); - epRole.setAppId((long)1); - epRole.setAppRoleId((long)1); - - - assertEquals(user.getUserId(),Long.valueOf(1)); - assertEquals(user.getApp(), epApp); - assertEquals(user.getPriority().getClass(), Short.class); - - assertEquals(user.toString(), "[u: 1; a: null, r: null; appRoleId: 1]"); - - assertEquals(user.hashCode(), user.hashCode()); - - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsManualSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsManualSortPreferenceTest.java deleted file mode 100644 index afad6f63..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsManualSortPreferenceTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserAppsManualSortPreference; - -public class EPUserAppsManualSortPreferenceTest { - - public EPUserAppsManualSortPreference mockEPUserAppsManualSortPreference(){ - - EPUserAppsManualSortPreference epUserAppsManualSortPreference = new EPUserAppsManualSortPreference(); - epUserAppsManualSortPreference.setUserId(1); - epUserAppsManualSortPreference.setAppId((long)1); - epUserAppsManualSortPreference.setAppManualSortOrder(1); - - return epUserAppsManualSortPreference; - } - - @Test - public void epUserAppsManualSortPreferenceTest(){ - - EPUserAppsManualSortPreference epUserAppsManualSortPreference = mockEPUserAppsManualSortPreference(); - - assertEquals(epUserAppsManualSortPreference.getUserId(), 1); - assertEquals(epUserAppsManualSortPreference.getAppId(), new Long(1)); - assertEquals(epUserAppsManualSortPreference.getAppManualSortOrder(), 1); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsSortPreferenceTest.java deleted file mode 100644 index 545c16d5..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserAppsSortPreferenceTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserAppsSortPreference; - -public class EPUserAppsSortPreferenceTest { - - public EPUserAppsSortPreference mockEPUserAppsSortPreferenceTest(){ - - EPUserAppsSortPreference epUserAppsSortPreference = new EPUserAppsSortPreference(); - epUserAppsSortPreference.setUserId(1); - epUserAppsSortPreference.setSortPref("test"); - epUserAppsSortPreference.setId((long)1); - epUserAppsSortPreference.setCreated(new Date()); - epUserAppsSortPreference.setModified(new Date()); - epUserAppsSortPreference.setModifiedId((long)1); - epUserAppsSortPreference.setRowNum((long)1); - epUserAppsSortPreference.setAuditTrail(null); - - return epUserAppsSortPreference; - } - - @Test - public void epUserAppsSortPreferenceTest() { - EPUserAppsSortPreference epUserAppsSortPreference = mockEPUserAppsSortPreferenceTest(); - - assertEquals(epUserAppsSortPreference.getUserId(), 1); - assertEquals(epUserAppsSortPreference.getSortPref(), "test"); - assertEquals(epUserAppsSortPreference.getId(), new Long(1)); - assertEquals(epUserAppsSortPreference.getCreated(), new Date()); - assertEquals(epUserAppsSortPreference.getModified(), new Date()); - assertEquals(epUserAppsSortPreference.getModifiedId(), new Long(1)); - assertEquals(epUserAppsSortPreference.getRowNum(), new Long(1)); - assertEquals(epUserAppsSortPreference.getAuditTrail(), null); - - - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserNotificationTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserNotificationTest.java deleted file mode 100644 index 64313e52..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserNotificationTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUserNotification; - -public class EPUserNotificationTest { - - public EPUserNotification mockEPUserNotification(){ - - EPUserNotification epUserNotification = new EPUserNotification(); - - epUserNotification.setUserId((long)1); - epUserNotification.setNotificationId((long)1); - epUserNotification.setViewed("test"); - epUserNotification.setUpdateTime(new Date()); - - return epUserNotification; - } - - @Test - public void epUserNotificationTest(){ - EPUserNotification epUserNotification = mockEPUserNotification(); - - assertEquals(epUserNotification.getUserId(), new Long(1)); - assertEquals(epUserNotification.getNotificationId(), new Long(1)); - assertEquals(epUserNotification.getViewed(), "test"); - // assertEquals(epUserNotification.getUpdateTime(), new Date()); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserTest.java deleted file mode 100644 index 54e6193d..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPUserTest.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPUser; - -public class EPUserTest { - - public EPUser mockEPUser(){ - - EPUser epUser = new EPUser(); - - epUser.setId((long)1); - epUser.setManagerId((long) 1234); - epUser.setFirstName("test"); - epUser.setLastName("test"); - epUser.setMiddleInitial("test"); - epUser.setPhone("test"); - epUser.setFax("test"); - epUser.setCellular("test"); - epUser.setEmail("test"); - epUser.setAddressId((long) 123); - epUser.setAlertMethodCd("test"); - epUser.setHrid("test"); - epUser.setOrgUserId("test"); - epUser.setOrgCode("test"); - epUser.setAddress1("test"); - epUser.setAddress2("test"); - epUser.setCity("test"); - epUser.setState("test"); - epUser.setZipCode("test"); - epUser.setCountry("test"); - epUser.setOrgManagerUserId("test"); - epUser.setLocationClli("test"); - epUser.setBusinessCountryCode("test"); - epUser.setBusinessCountryName("test"); - epUser.setBusinessUnit("test"); - epUser.setBusinessUnitName("test"); - epUser.setDepartment("test"); - epUser.setDepartmentName("test"); - epUser.setCompanyCode("test"); - epUser.setCompany("test"); - epUser.setZipCodeSuffix("test"); - epUser.setJobTitle("test"); - epUser.setCommandChain("test"); - epUser.setSiloStatus("test"); - epUser.setCostCenter("test"); - epUser.setFinancialLocCode("test"); - epUser.setLoginId("test"); - epUser.setLoginPwd("test"); - epUser.setLastLoginDate(new Date()); - epUser.setActive(false); - epUser.setInternal(false); - epUser.setSelectedProfileId((long) 12345); - epUser.setTimeZoneId((long) 12345); - epUser.setOnline(false); - epUser.setChatId("test"); - return epUser; - - } - - @Test - public void userTest(){ - EPUser user = mockEPUser(); - - assertEquals(user.getId(), new Long(1)); - assertEquals(user.getManagerId(), new Long(1234)); - assertEquals(user.getFirstName(), "test"); - assertEquals(user.getLastName(), "test"); - assertEquals(user.getMiddleInitial(), "test"); - assertEquals(user.getPhone(), "test"); - assertEquals(user.getFax(), "test"); - assertEquals(user.getCellular(), "test"); - assertEquals(user.getEmail(), "test"); - assertEquals(user.getAddressId(), new Long(123) ); - assertEquals(user.getAlertMethodCd(), "test"); - assertEquals(user.getHrid(), "test"); - assertEquals(user.getOrgUserId(), "test"); - assertEquals(user.getOrgCode(), "test"); - assertEquals(user.getAddress1(), "test"); - assertEquals(user.getAddress2(), "test"); - assertEquals(user.getState(), "test"); - assertEquals(user.getZipCode(), "test"); - assertEquals(user.getCountry(), "test"); - assertEquals(user.getOrgManagerUserId(), "test"); - assertEquals(user.getLocationClli(), "test"); - assertEquals(user.getBusinessCountryCode(), "test"); - assertEquals(user.getBusinessCountryName(), "test"); - assertEquals(user.getBusinessUnit(), "test"); - assertEquals(user.getBusinessUnitName(), "test"); - assertEquals(user.getDepartment(), "test"); - assertEquals(user.getDepartmentName(), "test"); - assertEquals(user.getCompanyCode(), "test"); - assertEquals(user.getCompany(), "test"); - assertEquals(user.getZipCodeSuffix(), "test"); - assertEquals(user.getJobTitle(), "test"); - assertEquals(user.getCommandChain(), "test"); - assertEquals(user.getSiloStatus(), "test"); - assertEquals(user.getFinancialLocCode(), "test"); - assertEquals(user.getLoginId(), "test"); - assertEquals(user.getLoginPwd(), "test"); - assertEquals(user.getActive(), false); - assertEquals(user.getInternal(), false); - assertEquals(user.getSelectedProfileId(), new Long (12345)); - assertEquals(user.getTimeZoneId(), new Long (12345)); - assertEquals(user.getChatId(), "test"); - - //assertEquals(user.toString(), "EPUser [orgId=null, managerId=1234, firstName=test, middleInitial=test, lastName=test, phone=test, fax=test, cellular=test, email=test, addressId=123, alertMethodCd=test, hrid=test, orgUserId=test, orgCode=test, address1=test, address2=test, city=test, state=test, zipCode=test, country=test, orgManagerUserId=test, locationClli=test, businessCountryCode=test, businessCountryName=test, businessUnit=test, businessUnitName=test, department=test, departmentName=test, companyCode=test, company=test, zipCodeSuffix=test, jobTitle=test, commandChain=test, siloStatus=test, costCenter=test, financialLocCode=test, loginId=test, loginPwd=test, lastLoginDate=Tue Sep 05 11:04:49 EDT 2017, active=false, internal=false, selectedProfileId=12345, timeZoneId=12345, online=false, chatId=test, isGuest=false, userApps=[], pseudoRoles=[]]"); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPWidgetsManualSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPWidgetsManualSortPreferenceTest.java deleted file mode 100644 index 69aa3db0..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EPWidgetsManualSortPreferenceTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPWidgetsManualSortPreference; - -public class EPWidgetsManualSortPreferenceTest { - - public EPWidgetsManualSortPreference mockEPWidgetsManualSortPreference(){ - EPWidgetsManualSortPreference epWidgetsManualSortPreference = new EPWidgetsManualSortPreference(); - - epWidgetsManualSortPreference.setUserId(1); - epWidgetsManualSortPreference.setWidgetId((long)1); - epWidgetsManualSortPreference.setWidgetRow(1); - epWidgetsManualSortPreference.setWidgetCol(1); - epWidgetsManualSortPreference.setWidgetWidth(1); - epWidgetsManualSortPreference.setWidgetHeight(1); - - return epWidgetsManualSortPreference; - } - - @Test - public void epWidgetsManualSortPreferenceTest(){ - EPWidgetsManualSortPreference epWidgetsManualSortPreference = mockEPWidgetsManualSortPreference(); - - assertEquals(epWidgetsManualSortPreference.getWidgetId(), new Long(1)); - assertEquals(epWidgetsManualSortPreference.getUserId(), 1); - assertEquals(epWidgetsManualSortPreference.getWidgetRow(), 1); - assertEquals(epWidgetsManualSortPreference.getWidgetCol(), 1); - assertEquals(epWidgetsManualSortPreference.getWidgetHeight(), 1); - assertEquals(epWidgetsManualSortPreference.getWidgetWidth(), 1); - - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleIdTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleIdTest.java deleted file mode 100644 index ca2bdfb3..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleIdTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EcompAppRoleId; - -public class EcompAppRoleIdTest { - - public EcompAppRoleId mockEcompAppRoleId(){ - - EcompAppRoleId ecompAppRoleId = new EcompAppRoleId(); - - ecompAppRoleId.setAppId((long)1); - ecompAppRoleId.setAppName("test"); - ecompAppRoleId.setRoleId(1); - ecompAppRoleId.setRoleName("test"); - - return ecompAppRoleId; - } - - @Test - public void ecompAppRoleIdTest(){ - - EcompAppRoleId ecompAppRoleId = mockEcompAppRoleId(); - - assertEquals(ecompAppRoleId.getAppId(), new Long(1)); - assertEquals(ecompAppRoleId.getAppName(), "test"); - assertEquals(ecompAppRoleId.getRoleId().toString(), "1"); - assertEquals(ecompAppRoleId.getRoleName(), "test"); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleTest.java deleted file mode 100644 index 4ba244b7..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/EcompAppRoleTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EcompAppRole; - -public class EcompAppRoleTest { - - public EcompAppRole mockEcompAppRole(){ - EcompAppRole ecompAppRole = new EcompAppRole(); - - ecompAppRole.setAppId((long)1); - ecompAppRole.setAppName("test"); - ecompAppRole.setRoleId(1); - ecompAppRole.setRoleName("test"); - - return ecompAppRole; - } - - @Test - public void ecompAppRoleTest(){ - EcompAppRole ecompAppRole = mockEcompAppRole(); - - assertEquals(ecompAppRole.getAppId(), new Long(1)); - assertEquals(ecompAppRole.getAppName(), "test"); - assertEquals(ecompAppRole.getRoleId().toString(), "1"); - assertEquals(ecompAppRole.getRoleName(), "test"); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalRoleDetailsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalRoleDetailsTest.java deleted file mode 100644 index e007102c..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalRoleDetailsTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.EPAppRoleFunction; -import org.openecomp.portalapp.portal.domain.ExternalRoleDetails; - -public class ExternalRoleDetailsTest { - - public ExternalRoleDetails mockExternalRoleDetails(){ - - List<EPAppRoleFunction> epAppRoleFunctionList = new ArrayList<EPAppRoleFunction>(); - - EPAppRoleFunction epAppRoleFunction = new EPAppRoleFunction(); - epAppRoleFunction.setRoleId((long)1); - epAppRoleFunction.setAppId((long)1); - epAppRoleFunction.setCode("test"); - - epAppRoleFunctionList.add(epAppRoleFunction); - - ExternalRoleDetails externalRoleDetails = new ExternalRoleDetails(); - - externalRoleDetails.setName("test"); - externalRoleDetails.setActive(false); - externalRoleDetails.setPriority(1); - externalRoleDetails.setAppId((long)1); - externalRoleDetails.setAppRoleId((long)1); - externalRoleDetails.setPerms(epAppRoleFunctionList); - - return externalRoleDetails; - } - - @Test - public void externalRoleDetailsTest(){ - - List<EPAppRoleFunction> epAppRoleFunctionList = new ArrayList<EPAppRoleFunction>(); - - EPAppRoleFunction epAppRoleFunction = new EPAppRoleFunction(); - epAppRoleFunction.setRoleId((long)1); - epAppRoleFunction.setAppId((long)1); - epAppRoleFunction.setCode("test"); - - epAppRoleFunctionList.add(epAppRoleFunction); - - ExternalRoleDetails externalRoleDetails = mockExternalRoleDetails(); - - assertEquals(externalRoleDetails.getAppId(), new Long(1)); - assertEquals(externalRoleDetails.getAppRoleId(), new Long(1)); - assertEquals(externalRoleDetails.getPriority().toString(), "1"); - assertEquals(externalRoleDetails.getName(), "test"); - assertEquals(externalRoleDetails.getPriority().toString(), "1"); - assertEquals(externalRoleDetails.getPerms().size(), epAppRoleFunctionList.size()); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemAccessTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemAccessTest.java deleted file mode 100644 index ea884578..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemAccessTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.ExternalSystemAccess; - -public class ExternalSystemAccessTest { - - public ExternalSystemAccess mockExternalSystemAccess(){ - ExternalSystemAccess externalSystemAccess = new ExternalSystemAccess("test", false); - - externalSystemAccess.setKey("test"); - externalSystemAccess.setAccessValue(false); - - return externalSystemAccess; - } - - @Test - public void externalSystemAccessTest(){ - ExternalSystemAccess externalSystemAccess = mockExternalSystemAccess(); - - assertEquals(externalSystemAccess.getKey(), "test"); - assertEquals(externalSystemAccess.getAccessValue(), false); - } -} - diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemRoleApprovalTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemRoleApprovalTest.java deleted file mode 100644 index 2c47ed5a..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ExternalSystemRoleApprovalTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.externalsystemapproval.model.ExternalSystemRoleApproval; - -public class ExternalSystemRoleApprovalTest { - - public ExternalSystemRoleApproval mockExternalSystemRoleApproval(){ - ExternalSystemRoleApproval externalSystemRoleApproval = new ExternalSystemRoleApproval(); - externalSystemRoleApproval.setRoleName("test"); - - return externalSystemRoleApproval; - } - - @Test - public void externalSystemRoleApprovalTest(){ - ExternalSystemRoleApproval externalSystemRoleApproval = mockExternalSystemRoleApproval(); - - assertEquals(externalSystemRoleApproval.getRoleName(), "test"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/FunctionalMenuItemWithAppIDTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/FunctionalMenuItemWithAppIDTest.java deleted file mode 100644 index abec873b..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/FunctionalMenuItemWithAppIDTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.FunctionalMenuItemWithAppID; - -public class FunctionalMenuItemWithAppIDTest { - - public FunctionalMenuItemWithAppID mockFunctionalMenuItemWithAppID(){ - FunctionalMenuItemWithAppID functionalMenuItemWithAppID = new FunctionalMenuItemWithAppID(); - - functionalMenuItemWithAppID.setRestrictedApp(false); - functionalMenuItemWithAppID.setUrl("test"); - - - return functionalMenuItemWithAppID; - } - - @Test - public void functionalMenuItemWithAppIDTest(){ - FunctionalMenuItemWithAppID functionalMenuItemWithAppID = mockFunctionalMenuItemWithAppID(); - - assertEquals(functionalMenuItemWithAppID.toString(), "FunctionalMenuItem [menuId=null, column=null, text=null, parentMenuId=null, url=test, active_yn=null, appid=null, roles=null, restrictedApp=false]"); - - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/GetAccessResultIdTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/GetAccessResultIdTest.java deleted file mode 100644 index 90a65eb8..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/GetAccessResultIdTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.GetAccessResultId; - -public class GetAccessResultIdTest { - - public GetAccessResultId mockGetAccessResultId(){ - - GetAccessResultId getAccessResultIdObj = new GetAccessResultId(); - getAccessResultIdObj.setEcompFunction("test"); - getAccessResultIdObj.setAppName("test"); - getAccessResultIdObj.setRoleName("test"); - - return getAccessResultIdObj; - } - - @Test - public void getAccessResultIdObjTest(){ - GetAccessResultId getAccessResultIdObj = mockGetAccessResultId(); - - assertEquals(getAccessResultIdObj.getEcompFunction(), "test"); - assertEquals(getAccessResultIdObj.getAppName(), "test"); - assertEquals(getAccessResultIdObj.getRoleName(), "test"); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceDataTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceDataTest.java deleted file mode 100644 index d7e4ca29..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceDataTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import java.util.ArrayList; -import java.util.List; -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.MicroserviceData; -import org.openecomp.portalapp.portal.domain.MicroserviceParameter; - -public class MicroserviceDataTest { - - public MicroserviceData mockMicroserviceData(){ - - MicroserviceData microserviceData= new MicroserviceData(); - - List<MicroserviceParameter> parameterList = new ArrayList<MicroserviceParameter>(); - - MicroserviceParameter microserviceParameter = new MicroserviceParameter(); - microserviceParameter.setId((long)1); - microserviceParameter.setServiceId((long)1); - microserviceParameter.setPara_key("test"); - microserviceParameter.setPara_value("test"); - parameterList.add(microserviceParameter); - - microserviceData.setId((long)1); - microserviceData.setName("test"); - microserviceData.setActive("test"); - microserviceData.setDesc("test"); - microserviceData.setAppId((long)1); - microserviceData.setUrl("test"); - microserviceData.setSecurityType("test"); - microserviceData.setUsername("test"); - microserviceData.setPassword("test"); - - - return microserviceData; - } - - @Test - public void microserviceDataTest(){ - MicroserviceData microserviceData= mockMicroserviceData(); - - assertEquals(microserviceData.getId(), new Long(1)); - assertEquals(microserviceData.getName(), "test"); - assertEquals(microserviceData.getActive(), "test"); - assertEquals(microserviceData.getDesc(), "test"); - // assertEquals(microserviceData.getAppId(), new long(1)); - assertEquals(microserviceData.getUrl(), "test"); - assertEquals(microserviceData.getSecurityType(), "test"); - assertEquals(microserviceData.getUsername(), "test"); - assertEquals(microserviceData.getPassword(), "test"); - - assertEquals(microserviceData.toString(), "MicroserviceData [id=1, name=test, desc=test, appId=1, " - + "url=test, securityType=test, username=test, password=test, parameterList=null]"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceParameterTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceParameterTest.java deleted file mode 100644 index e15f2267..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/MicroserviceParameterTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.MicroserviceParameter; - -public class MicroserviceParameterTest { - - public MicroserviceParameter mockMicroserviceParameter(){ - MicroserviceParameter microserviceParameter = new MicroserviceParameter(); - - microserviceParameter.setId((long)1); - microserviceParameter.setServiceId((long)1); - microserviceParameter.setPara_key("test"); - microserviceParameter.setPara_value("test"); - - return microserviceParameter; - } - - @Test - public void microserviceParameterTest(){ - MicroserviceParameter microserviceParameter = mockMicroserviceParameter(); - assertEquals(microserviceParameter.getId(), new Long(1)); - assertEquals(microserviceParameter.getServiceId(),(long)1); - assertEquals(microserviceParameter.getPara_key(), "test"); - assertEquals(microserviceParameter.getPara_value(), "test"); - - assertEquals(microserviceParameter.toString(), "MicroserviceParameter [id=1, serviceId=1, para_key=test, para_value=test]"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserAppSelectionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserAppSelectionTest.java deleted file mode 100644 index 7f4bdc1b..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserAppSelectionTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.PersUserAppSelection; - -public class PersUserAppSelectionTest { - - public PersUserAppSelection mockPersUserAppSelection(){ - - PersUserAppSelection persUserAppSelection = new PersUserAppSelection(); - persUserAppSelection.setUserId((long)1); - persUserAppSelection.setAppId((long)1); - persUserAppSelection.setStatusCode("test"); - - return persUserAppSelection; - } - - @Test - public void persUserAppSelectionTest(){ - - PersUserAppSelection persUserAppSelection1 = new PersUserAppSelection((long)1, (long)1, (long)1,"test"); - - PersUserAppSelection persUserAppSelection = mockPersUserAppSelection(); - - assertEquals(persUserAppSelection.getUserId(), new Long(1)); - assertEquals(persUserAppSelection.getAppId(), new Long(1)); - assertEquals(persUserAppSelection.getStatusCode(), "test"); - assertEquals(persUserAppSelection1.hashCode(), new PersUserAppSelection((long)1, (long)1, (long)1,"test").hashCode()); - assertEquals(persUserAppSelection1, new PersUserAppSelection((long)1, (long)1, (long)1,"test")); - assertTrue(persUserAppSelection1.equals(new PersUserAppSelection((long)1, (long)1, (long)1,"test"))); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserWidgetSelectionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserWidgetSelectionTest.java deleted file mode 100644 index 55e1bd64..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/PersUserWidgetSelectionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.PersUserWidgetSelection; - -public class PersUserWidgetSelectionTest { - - public PersUserWidgetSelection mockPersUserWidgetSelection(){ - - PersUserWidgetSelection persUserWidgetSelection = new PersUserWidgetSelection(); - - persUserWidgetSelection.setUserId((long)1); - persUserWidgetSelection.setWidgetId((long)1); - persUserWidgetSelection.setStatusCode("test"); - - return persUserWidgetSelection; - } - - @Test - public void persUserWidgetSelectionTest(){ - PersUserWidgetSelection persUserWidgetSelection = mockPersUserWidgetSelection(); - - PersUserWidgetSelection persUserWidgetSelection1 = new PersUserWidgetSelection((long)1, (long)1, (long)1, "test"); - - assertEquals(persUserWidgetSelection.getUserId(), new Long(1)); - assertEquals(persUserWidgetSelection.getWidgetId(), new Long(1)); - assertEquals(persUserWidgetSelection.getStatusCode(), "test"); - assertEquals(persUserWidgetSelection1, new PersUserWidgetSelection((long)1, (long)1, (long)1, "test")); - assertTrue(persUserWidgetSelection1.equals(new PersUserWidgetSelection((long)1, (long)1, (long)1,"test"))); - assertEquals(persUserWidgetSelection.hashCode(), persUserWidgetSelection1.hashCode()); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ResultTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ResultTest.java deleted file mode 100644 index 6763cc0b..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/ResultTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.model.Result; - -public class ResultTest { - - public Result mockResult(){ - - Result result= new Result("test"); - - result.setResult("test"); - return result; - } - - @Test - public void resultTest(){ - - Result result = mockResult(); - result.setResult("test"); - - assertEquals(result.getResult(), "test"); - - } - - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/SharedContextTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/SharedContextTest.java deleted file mode 100644 index 239080d2..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/SharedContextTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.SharedContext; - -public class SharedContextTest { - - public SharedContext mockSharedContext(){ - - SharedContext sharedContext = new SharedContext(); - sharedContext.setId((long)1); - sharedContext.setCreate_time(new Date()); - sharedContext.setContext_id("test"); - sharedContext.setCkey("test"); - sharedContext.setCvalue("test"); - - return sharedContext; - } - - @Test - public void sharedContextTest(){ - SharedContext sharedContext = mockSharedContext(); - - assertEquals(sharedContext.getId(), new Long(1)); - // assertEquals(sharedContext.getCreate_time(), new Date()); - assertEquals(sharedContext.getContext_id(), "test"); - assertEquals(sharedContext.getCkey(), "test"); - assertEquals(sharedContext.getCvalue(), "test"); - - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/UserIdRoleIdTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/UserIdRoleIdTest.java deleted file mode 100644 index 169d8798..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/UserIdRoleIdTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.UserIdRoleId; - -public class UserIdRoleIdTest { - - public UserIdRoleId mockUserIdRoleId(){ - UserIdRoleId userIdRoleId = new UserIdRoleId(); - userIdRoleId.setUser_Id("test"); - userIdRoleId.setRoleId("test"); - userIdRoleId.setOrgUserId("test"); - userIdRoleId.setAppId("test"); - - return userIdRoleId; - } - - @Test - public void userIdRoleIdTest(){ - UserIdRoleId userIdRoleId = mockUserIdRoleId(); - - assertEquals(userIdRoleId.getUser_Id(), "test"); - assertEquals(userIdRoleId.getRoleId(), "test"); - assertEquals(userIdRoleId.getOrgUserId(), "test"); - assertEquals(userIdRoleId.getAppId(), "test"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogParameterTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogParameterTest.java deleted file mode 100644 index fe525d7b..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogParameterTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.WidgetCatalogParameter; - -public class WidgetCatalogParameterTest { - - public WidgetCatalogParameter mockWidgetCatalogParameter(){ - WidgetCatalogParameter widgetCatalogParameter = new WidgetCatalogParameter(); - - widgetCatalogParameter.setId((long)1); - widgetCatalogParameter.setWidgetId((long)1); - widgetCatalogParameter.setUserId((long)1); - widgetCatalogParameter.setParamId((long)1); - widgetCatalogParameter.setUser_value("test"); - - return widgetCatalogParameter; - } - - @Test - public void widgetCatalogParameterTest(){ - WidgetCatalogParameter widgetCatalogParameter = mockWidgetCatalogParameter(); - - assertEquals(widgetCatalogParameter.getId(), new Long(1)); - assertEquals(widgetCatalogParameter.getWidgetId(), new Long(1)); - assertEquals(widgetCatalogParameter.getUserId(), new Long(1)); - assertEquals(widgetCatalogParameter.getParamId(), new Long(1)); - assertEquals(widgetCatalogParameter.getUser_value(), "test"); - assertEquals(widgetCatalogParameter.toString(), "WidgetCatalogParameter [id=1, widgetId=1, userId=1, paramId=1, user_value=test]"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogTest.java deleted file mode 100644 index 3b7aa764..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetCatalogTest.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.*; -import static org.junit.Assert.assertEquals; - -import java.util.HashSet; -import java.util.Set; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.App; -import org.openecomp.portalapp.portal.domain.RoleApp; -import org.openecomp.portalapp.portal.domain.WidgetCatalog; - -public class WidgetCatalogTest { - - public WidgetCatalog mockWidgetCatalog() { - - WidgetCatalog widgetCatalog = new WidgetCatalog(); - - Set<RoleApp> roleAppSet = new HashSet<RoleApp>(); - // App - App app = new App(); - app.setAppId((long) 1); - app.setAppName("test"); - - // RoleApp - RoleApp roleApp = new RoleApp(); - roleApp.setRoleId((long) 1); - roleApp.setRoleName("test"); - roleApp.setApp(app); - roleApp.setWidgets(null); - - roleAppSet.add(roleApp); - - widgetCatalog.setId((long) 1); - widgetCatalog.setName("test"); - widgetCatalog.setDesc("test"); - widgetCatalog.setFileLocation("test"); - widgetCatalog.setAllowAllUser("test"); - widgetCatalog.setServiceId((long) 1); - widgetCatalog.setSortOrder("test"); - widgetCatalog.setStatusCode("test"); - - widgetCatalog.setWidgetRoles(roleAppSet); - - return widgetCatalog; - - } - - @Test - public void widgetCatalogTest() { - - // App - App app = new App(); - app.setAppId((long) 1); - app.setAppName("test"); - - Set<RoleApp> roleAppSet = new HashSet<RoleApp>(); - // RoleApp - RoleApp roleApp = new RoleApp(); - roleApp.setRoleId((long) 1); - roleApp.setRoleName("test"); - roleApp.setApp(app); - roleApp.setWidgets(null); - - roleAppSet.add(roleApp); - - WidgetCatalog widgetCatalog = mockWidgetCatalog(); - - - assertEquals(widgetCatalog.getId(), (long)1); - assertEquals(widgetCatalog.getName(), "test"); - assertEquals(widgetCatalog.getDesc(), "test"); - assertEquals(widgetCatalog.getFileLocation(), "test"); - assertEquals(widgetCatalog.getAllowAllUser(), "test"); - assertEquals(widgetCatalog.getServiceId(), new Long (1)); - assertEquals(widgetCatalog.getSortOrder(), "test"); - assertEquals(widgetCatalog.getStatusCode(), "test"); - assertEquals(widgetCatalog.getWidgetRoles().size(),1); - - assertEquals("WidgetCatalog [id=1, name=test, desc=test, fileLocation=test, allowAllUser=test]", widgetCatalog.toString()); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetParameterResultTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetParameterResultTest.java deleted file mode 100644 index 75b3d606..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetParameterResultTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.WidgetParameterResult; - -public class WidgetParameterResultTest { - - public WidgetParameterResult mockWidgetParameterResult(){ - - WidgetParameterResult widgetParameterResult = new WidgetParameterResult(); - widgetParameterResult.setParam_id((long)1); - widgetParameterResult.setParam_key("test"); - widgetParameterResult.setUser_value("test"); - widgetParameterResult.setDefault_value("test"); - - return widgetParameterResult; - } - - @Test - public void widgetParameterResultTest(){ - - WidgetParameterResult widgetParameterResult = mockWidgetParameterResult(); - - assertEquals(widgetParameterResult.getParam_key(), "test"); - assertEquals(widgetParameterResult.getParam_id(), new Long(1)); - assertEquals(widgetParameterResult.getUser_value(), "test"); - assertEquals(widgetParameterResult.getDefault_value(), "test"); - - assertEquals("WidgetParameterResult [param_id=1, param_key=test, user_value=test, default_value=test]", widgetParameterResult.toString()); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetTest.java deleted file mode 100644 index a7597982..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/domain/WidgetTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.openecomp.portalapp.portal.test.domain; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.Widget; - -public class WidgetTest { - - public Widget mockWidget(){ - - Widget widget = new Widget(); - widget.setName("test"); - widget.setWidth(100); - widget.setHeight(100); - widget.setUrl("test"); - widget.setAppId((long)1); - - return widget; - } - - @Test - public void widgetTest(){ - Widget widget = mockWidget(); - - assertEquals(widget.getName(), "test"); - assertTrue(widget.getWidth() == 100); - assertTrue(widget.getHeight() == 100); - assertEquals(widget.getUrl(), "test"); - assertEquals(widget.getAppId(), new Long(1)); - - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/ApplicationCommonContextTestSuite.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/ApplicationCommonContextTestSuite.java deleted file mode 100644 index d7930c14..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/ApplicationCommonContextTestSuite.java +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.framework; - -import java.io.IOException; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.openecomp.portalsdk.core.conf.AppConfig; -//import org.openecomp.portalapp.conf.ExternalAppConfig; -//import org.openecomp.portalapp.conf.HibernateMappingLocations; -import org.openecomp.portalsdk.core.conf.HibernateConfiguration; -import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable; -import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; -import org.openecomp.portalsdk.core.util.CacheManager; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.FilterType; -import org.springframework.context.annotation.Profile; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.transaction.TransactionConfiguration; -import org.springframework.test.context.web.AnnotationConfigWebContextLoader; -import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; - -/** - * - * In order to write a unit test, 1. inherit this class 2. place the "war" - * folder on your test class's classpath 3. run the test with the following VM - * argument; This is important because when starting the application from - * Container, the System Properties file (SystemProperties.java) can have the - * direct path but, when running from the Mock Junit container, the path should - * be prefixed with "classpath" to enable the mock container to search for the - * file in the classpath -Dcontainer.classpath="classpath:" - */ - -@SuppressWarnings("deprecation") -@RunWith(SpringJUnit4ClassRunner.class) -@WebAppConfiguration -@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { MockAppConfig.class }) -@ActiveProfiles(value = "test") -public class ApplicationCommonContextTestSuite { - - @Autowired - public WebApplicationContext wac; - - private MockMvc mockMvc; - - @Before - public void setup() { - if (mockMvc == null) { - this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); - - } - } - - public Object getBean(String name) { - return this.wac.getBean(name); - } - - public MockMvc getMockMvc() { - return mockMvc; - } - - public void setMockMvc(MockMvc mockMvc) { - this.mockMvc = mockMvc; - } - - public WebApplicationContext getWebApplicationContext() { - return wac; - } - -} - -@Configuration -@ComponentScan(basePackages = "org.openecomp", excludeFilters = { - // the following source configurations should not be scanned; instead of - // using Exclusion filter, we can use the @Profile annotation to exclude - // them - @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.LogoutController*"), - @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.SDKLoginController*"), - @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalapp.conf.ExternalAppConfig*"), - @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.*.*InitUebHandler*") }) -@Profile("test") -class MockAppConfig extends AppConfig { - - @Bean - HibernateMappingLocatable locatable() { - return new MockHibernateMappingLocations(); - } - - @Bean - HibernateConfiguration hibConfiguration() { - return new HibernateConfiguration(); - } - - @Bean - public SystemProperties systemProperties() { - return new MockSystemProperties(); - } - - @Bean - public AbstractCacheManager cacheManager() { - return new CacheManager() { - - public void configure() throws IOException { - - } - }; - } - - public String[] tileDefinitions() { - return new String[] { "classpath:/WEB-INF/fusion/defs/definitions.xml", - "classpath:/WEB-INF/defs/definitions.xml" }; - } - - public void addInterceptors(InterceptorRegistry registry) { - // registry.addInterceptor(new - // SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout()); - // registry.addInterceptor(resourceInterceptor()); - } - - public static class MockSystemProperties extends SystemProperties { - - public MockSystemProperties() { - } - - } - -} - -@Profile("test") -class MockHibernateMappingLocations implements HibernateMappingLocatable { - - public Resource[] getMappingLocations() { - return new Resource[] { new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"), - new ClassPathResource("WEB-INF/fusion/orm/EP.hbm.xml"), - new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml") }; - - } - - public String[] getPackagesToScan() { - return new String[] { "org.openecomp", "src" }; - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/MockitoTestSuite.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/MockitoTestSuite.java deleted file mode 100644 index 44019aa6..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/framework/MockitoTestSuite.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.framework; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class MockitoTestSuite { - - - public MockHttpServletRequestWrapper mockedRequest = new MockHttpServletRequestWrapper( - Mockito.mock(HttpServletRequest.class)); - public HttpServletResponse mockedResponse = Mockito.mock(HttpServletResponse.class); - - public MockHttpServletRequestWrapper getMockedRequest() { - return mockedRequest; - } - - public HttpServletResponse getMockedResponse() { - return mockedResponse; - } - - public class MockHttpServletRequestWrapper extends HttpServletRequestWrapper { - - HttpSession session = Mockito.mock(HttpSession.class); - - public MockHttpServletRequestWrapper(HttpServletRequest request) { - super(request); - - } - - @Override - public HttpSession getSession() { - - return session; - } - - @Override - public HttpSession getSession(boolean create) { - - return session; - } - - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/AppContactUsServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/AppContactUsServiceImplTest.java deleted file mode 100644 index bb74cc6a..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/AppContactUsServiceImplTest.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.openecomp.portalapp.portal.test.service; - -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.HashMap; -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.openecomp.portalapp.portal.domain.AppContactUs; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.ecomp.model.AppCategoryFunctionsItem; -import org.openecomp.portalapp.portal.ecomp.model.AppContactUsItem; -import org.openecomp.portalapp.portal.service.AppContactUsService; -import org.openecomp.portalapp.portal.service.AppContactUsServiceImpl; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.service.DataAccessServiceImpl; - -public class AppContactUsServiceImplTest { - - - @Mock - DataAccessService dataAccessService = new DataAccessServiceImpl(); - - @Mock - AppContactUsService AppContactUsService = new AppContactUsServiceImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - @InjectMocks - AppContactUsServiceImpl appContactUsServiceImpl = new AppContactUsServiceImpl(); - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - - public EPApp getApp() { - EPApp app = new EPApp(); - app.setName("Test"); - app.setImageUrl("test"); - app.setDescription("test"); - app.setNotes("test"); - app.setUrl("test"); - app.setId((long) 1); - app.setAppRestEndpoint("test"); - app.setAlternateUrl("test"); - app.setName("test"); - app.setMlAppName("test"); - app.setMlAppAdminId("test"); - app.setUsername("test"); - app.setAppPassword("test"); - app.setOpen(true); - app.setEnabled(false); - app.setUebKey("test"); - app.setUebSecret("test"); - app.setUebTopicName("test"); - app.setAppType(1); - return app; - } - @Test - public void getAppContactUsTest() throws Exception - { - - List<AppContactUsItem> contactUsItemList = new ArrayList<>(); - AppContactUsItem appContactUsItem= new AppContactUsItem(); - appContactUsItem.setAppName("testNew"); - contactUsItemList.add(appContactUsItem); - AppContactUsItem appContactUsItem1= new AppContactUsItem(); - appContactUsItem1.setAppName("test"); - contactUsItemList.add(appContactUsItem1); - Mockito.when(dataAccessService.executeNamedQuery("getAppContactUsItems", null, null)).thenReturn(contactUsItemList); - List<AppContactUsItem> expectedcontactUsItemList = appContactUsServiceImpl.getAppContactUs(); - assertEquals(expectedcontactUsItemList, contactUsItemList); - } - - @Test - public void getAppsAndContactsTest() throws Exception - { - List<AppContactUsItem> contactUsItemList = new ArrayList<>(); - AppContactUsItem appContactUsItem= new AppContactUsItem(); - appContactUsItem.setAppName("testNew"); - contactUsItemList.add(appContactUsItem); - AppContactUsItem appContactUsItem1= new AppContactUsItem(); - appContactUsItem1.setAppName("test"); - contactUsItemList.add(appContactUsItem1); - Mockito.when(dataAccessService.executeNamedQuery("getAppsAndContacts", null, null)).thenReturn(contactUsItemList); - List<AppContactUsItem> expectedcontactUsItemList = appContactUsServiceImpl.getAppsAndContacts(); - assertEquals(expectedcontactUsItemList, contactUsItemList); - } - - @Test - public void getAppCategoryFunctionsTest() throws Exception - { - List<AppCategoryFunctionsItem> list = new ArrayList<>(); - Mockito.when(dataAccessService.executeNamedQuery("getAppCategoryFunctions", null, null)).thenReturn(list); - List<AppCategoryFunctionsItem> expectedlist = appContactUsServiceImpl.getAppCategoryFunctions(); - assertEquals(list, expectedlist); - } - - @Test(expected = java.lang.Exception.class) - public void saveAppContactUsTest() throws Exception - { - HashMap<String, Object> map = new HashMap<String, Object>(); - List<AppContactUsItem> contactUsModelList = new ArrayList<>(); - AppContactUsItem appContactUsItem= new AppContactUsItem(); - appContactUsItem.setAppId((long) 1); - contactUsModelList.add(appContactUsItem); - AppContactUs appContact = new AppContactUs(); - Mockito.when(dataAccessService.getDomainObject(AppContactUs.class, 1, map)).thenReturn(appContact); - EPApp app = getApp(); - Mockito.when(dataAccessService.getDomainObject(EPApp.class, 1, new HashMap<String, Object>())).thenReturn(app); - AppContactUs contactUs = new AppContactUs(); - contactUs.setApp(app); - contactUs.setDescription(appContactUsItem.getDescription()); - contactUs.setContactName(appContactUsItem.getContactName()); - contactUs.setContactEmail(appContactUsItem.getContactEmail()); - contactUs.setActiveYN(appContactUsItem.getActiveYN()); - contactUs.setUrl(appContactUsItem.getUrl()); - Mockito.doNothing().when(dataAccessService).saveDomainObject(contactUs,map); - appContactUsServiceImpl.saveAppContactUs(contactUsModelList); - } - - @Test(expected = java.lang.NullPointerException.class) - public void deleteContactUsTest() throws Exception - { - HashMap<String, Object> map = new HashMap<String, Object>(); - AppContactUs contactUs = new AppContactUs(); - Mockito.when((AppContactUs) dataAccessService.getDomainObject(AppContactUs.class, 1, map)).thenReturn(contactUs); - appContactUsServiceImpl.deleteContactUs((long) 1); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/DashboardSearchServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/DashboardSearchServiceImplTest.java deleted file mode 100644 index ab380ba5..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/DashboardSearchServiceImplTest.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.openecomp.portalapp.portal.test.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -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.openecomp.portalapp.portal.ecomp.model.SearchResultItem; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.CommonWidget; -import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.service.DataAccessService; - -public class DashboardSearchServiceImplTest { - - @Mock - DataAccessService dataAccessService; - - @InjectMocks - DashboardSearchServiceImpl dashboardSearchServiceImpl = new DashboardSearchServiceImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - NullPointerException nullPointerException = new NullPointerException(); - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - MockEPUser mockUser = new MockEPUser(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - - @Test - public void searchResultsTest() - { - Map<String, String> params = new HashMap<>(); - params.put("userId", "guestT"); - params.put("searchQuery", "test"); - - List<SearchResultItem> list = new ArrayList<>(); - SearchResultItem searchResultItem= new SearchResultItem(); - searchResultItem.setCategory("test"); - list.add(searchResultItem); - Mockito.when(dataAccessService.executeNamedQuery("searchPortal", params, null)).thenReturn(list); - Map<String, List<SearchResultItem>> result = dashboardSearchServiceImpl.searchResults("guestT", "test"); - assertTrue(result.keySet().contains("test")); - } - - @Test - public void getRelatedUsersTest() - { - List<String> activeUsers = new ArrayList<>(); - Map<String, String> params = new HashMap<>(); - params.put("userId", "guestT"); - Mockito.when(dataAccessService.executeNamedQuery("relatedUsers", params, null)).thenReturn(activeUsers); - List<String> expectedActiveUsers = dashboardSearchServiceImpl.getRelatedUsers("guestT"); - assertEquals(expectedActiveUsers,activeUsers); - } - @Test - public void getWidgetDataTest() - { - CommonWidgetMeta CommonWidgetMeta = null; - Map<String, String> params = new HashMap<>(); - params.put("cat", "test"); - @SuppressWarnings("unchecked") - List<CommonWidget> widgetItems = new ArrayList<>(); - CommonWidget commonWidget = new CommonWidget(); - widgetItems.add(commonWidget); - Mockito.when(dataAccessService.executeNamedQuery("getCommonWidgetItem", params, null)).thenReturn(widgetItems); - CommonWidgetMeta expectedCommonWidgetMeta =dashboardSearchServiceImpl.getWidgetData("test"); - assertEquals(expectedCommonWidgetMeta.getCategory(), "test"); - } - - @Test - public void saveWidgetDataBulkTest() - { - CommonWidgetMeta CommonWidgetMeta = new CommonWidgetMeta(); - List<CommonWidget> widgetList = new ArrayList<>(); - CommonWidget commonWidget = new CommonWidget(); - widgetList.add(commonWidget); - CommonWidgetMeta.setItems(widgetList); - Mockito.doNothing().when(dataAccessService).saveDomainObject(commonWidget, null); - assertEquals(dashboardSearchServiceImpl.saveWidgetDataBulk(CommonWidgetMeta), "success"); - } - - @Test - public void saveWidgetDataTest() - { - CommonWidget commonWidget = new CommonWidget(); - Mockito.doNothing().when(dataAccessService).saveDomainObject(commonWidget, null); - assertEquals(dashboardSearchServiceImpl.saveWidgetData(commonWidget), "success"); - } - - @Test - public void deleteWidgetDataTest() - { - CommonWidget commonWidget = new CommonWidget(); - Mockito.doNothing().when(dataAccessService).deleteDomainObject(commonWidget, null); - assertEquals(dashboardSearchServiceImpl.deleteWidgetData(commonWidget), "success"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceCentralizedImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceCentralizedImplTest.java deleted file mode 100644 index 7db06a52..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceCentralizedImplTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.openecomp.portalapp.portal.test.service; - -import static org.junit.Assert.*; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -import org.hibernate.SessionFactory; -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.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceCentralizedImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(SystemProperties.class) -public class EPRoleFunctionServiceCentralizedImplTest { - - - @Mock - DataAccessService dataAccessService; - - @Mock - SessionFactory sessionFactory; - - @InjectMocks - EPRoleFunctionServiceCentralizedImpl ePRoleFunctionServiceCentralizedImpl = new EPRoleFunctionServiceCentralizedImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - NullPointerException nullPointerException = new NullPointerException(); - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - MockEPUser mockUser = new MockEPUser(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - - @Test - public void getRoleFunctions() - { - List<CentralRoleFunction> getRoleFuncList = new ArrayList<>(); - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - getRoleFuncList.add(centralRoleFunction); - List<RoleFunction> getRoleFuncListOfPortal = new ArrayList<>(); - RoleFunction roleFunction = new RoleFunction(); - getRoleFuncListOfPortal.add(roleFunction); - final Map<String, Long> params = new HashMap<>(); - params.put("appId", (long) 1); - Mockito.when(dataAccessService.executeNamedQuery("getAllRoleFunctions", params, null)).thenReturn(getRoleFuncList); - List<RoleFunction> expectedGetRoleFuncListOfPortal = ePRoleFunctionServiceCentralizedImpl.getRoleFunctions(); - assertEquals(expectedGetRoleFuncListOfPortal.size(),getRoleFuncListOfPortal.size()); - } - - @Test - public void getRoleFunctionsNewTest() - { - HttpSession session = mockedRequest.getSession(); - EPUser user = mockUser.mockEPUser(); - user.setId((long) 1); - String userId = user.getId().toString(); - final Map<String, String> params = new HashMap<>(); - params.put("userId", userId); - @SuppressWarnings("unused") - List getRoleFuncListOfPortal = new ArrayList<>(); - Mockito.when(dataAccessService.executeNamedQuery("getRoleFunctionsOfUser", params, null)).thenReturn(getRoleFuncListOfPortal); - Set<String> getRoleFuncListOfPortalSet = ePRoleFunctionServiceCentralizedImpl.getRoleFunctions(mockedRequest, user); - assertTrue(getRoleFuncListOfPortalSet.size() == 0); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceImplTest.java deleted file mode 100644 index c8cd8d28..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleFunctionServiceImplTest.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.openecomp.portalapp.portal.test.service; - -import static org.junit.Assert.*; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import javax.servlet.http.HttpServletRequest; -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.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.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, EPUserUtils.class }) -public class EPRoleFunctionServiceImplTest { - - @Mock - DataAccessService dataAccessService; - - @InjectMocks - EPRoleFunctionServiceImpl ePRoleFunctionServiceImpl = new EPRoleFunctionServiceImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - NullPointerException nullPointerException = new NullPointerException(); - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - MockEPUser mockUser = new MockEPUser(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - - @Test - public void getRoleFunctionsTest() { - List<RoleFunction> functions = new ArrayList<>(); - Mockito.when(dataAccessService.getList(RoleFunction.class, null)).thenReturn(functions); - List<RoleFunction> expectedFunctions = ePRoleFunctionServiceImpl.getRoleFunctions(); - assertEquals(expectedFunctions, functions); - } - - @Test - public void getRoleFunctionsRequestTest() { - EPUser user = mockUser.mockEPUser(); - HashSet roleFunctions = new HashSet<>(); - PowerMockito.mockStatic(SystemProperties.class); - HttpSession session = mockedRequest.getSession(); - Mockito.when(session.getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME))) - .thenReturn(roleFunctions); - HashSet expectedRoleFunctions = (HashSet) ePRoleFunctionServiceImpl.getRoleFunctions(mockedRequest, user); - assertEquals(expectedRoleFunctions, roleFunctions); - } - - @SuppressWarnings("unchecked") - @Test - public void getRoleFunctionsRequestIfNullTest() { - EPUser user = mockUser.mockEPUser(); - HashSet roleFunctions = null; - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(EPUserUtils.class); - HttpSession session = mockedRequest.getSession(); - Mockito.when(session.getAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME))) - .thenReturn(roleFunctions); - HashMap roles = new HashMap<>(); - EPRole role = new EPRole(); - SortedSet<RoleFunction> roleFunctionSet = new TreeSet<RoleFunction>(); - RoleFunction rolefun = new RoleFunction(); - roleFunctionSet.add(rolefun); - role.setRoleFunctions(roleFunctionSet); - roles.put((long) 1, role); - Mockito.when(EPUserUtils.getRoles(mockedRequest)).thenReturn(roles); - HashSet expectedRoleFunctions = (HashSet) ePRoleFunctionServiceImpl.getRoleFunctions(mockedRequest, user); - assertTrue(expectedRoleFunctions.size() == 1); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleServiceImplTest.java deleted file mode 100644 index 10060350..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/EPRoleServiceImplTest.java +++ /dev/null @@ -1,208 +0,0 @@ -package org.openecomp.portalapp.portal.test.service; - -import static org.junit.Assert.*; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -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.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.service.EPRoleServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.domain.RoleFunction; -import org.openecomp.portalsdk.core.service.DataAccessService; - -public class EPRoleServiceImplTest { - - @Mock - DataAccessService dataAccessService; - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - @InjectMocks - EPRoleServiceImpl ePRoleServiceImpl = new EPRoleServiceImpl(); - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - MockEPUser mockUser = new MockEPUser(); - - @Test - public void getRoleFunctionsTest() { - List<RoleFunction> roleFunctionList = new ArrayList<>(); - Mockito.when(dataAccessService.getList(RoleFunction.class, null)).thenReturn(roleFunctionList); - List<RoleFunction> expectedRoleFunctionList = ePRoleServiceImpl.getRoleFunctions(); - assertEquals(roleFunctionList, expectedRoleFunctionList); - } - - @Test - public void getAvailableChildRolesIfRoleIdIsNullTest() { - List<EPRole> roleList = new ArrayList<>(); - EPRole role = new EPRole(); - EPRole role1 = new EPRole(); - role.addChildRole(role1); - roleList.add(role); - Mockito.when(dataAccessService.getList(EPRole.class, null)).thenReturn(roleList); - List<EPRole> expectedRoleList = ePRoleServiceImpl.getAvailableChildRoles(null); - assertEquals(roleList, expectedRoleList); - } - - // @Test - // public void getAvailableChildRolesIfRoleIdNotNullTest() - // { - // List<EPRole> roleList = new ArrayList<>(); - // EPRole role = new EPRole(); - // EPRole role1= new EPRole(); - // role.addChildRole(role1); - // roleList.add(role); - // Mockito.when(dataAccessService.getDomainObject(EPRole.class, 1, - // null)).thenReturn(role); - // Mockito.when(dataAccessService.getList(EPRole.class, - // null)).thenReturn(roleList); - // - // List<EPRole> expectedRoleList = - // ePRoleServiceImpl.getAvailableChildRoles((long) 1); - // System.out.println(expectedRoleList); - // assertEquals(roleList,expectedRoleList); - // } - // - @Test - public void getRoleFunctionTest() { - RoleFunction roleFunction = new RoleFunction(); - Mockito.when(dataAccessService.getDomainObject(RoleFunction.class, "test", null)).thenReturn(roleFunction); - RoleFunction expectedRoleFunction = ePRoleServiceImpl.getRoleFunction("test"); - assertEquals(expectedRoleFunction, roleFunction); - } - - @Test - public void saveRoleFunctionTest() { - EPRole role = new EPRole(); - Mockito.doNothing().when(dataAccessService).saveDomainObject(role, null); - ePRoleServiceImpl.saveRole(role); - } - - @Test - public void deleteRoleFunctionTest() { - RoleFunction roleFunction = new RoleFunction(); - Mockito.doNothing().when(dataAccessService).deleteDomainObject(roleFunction, null); - ePRoleServiceImpl.deleteRoleFunction(roleFunction); - } - - @Test - public void getRoleTest() { - EPRole role = null; - Mockito.when(dataAccessService.getDomainObject(EPRole.class, 1, null)).thenReturn(role); - EPRole expectedRole = ePRoleServiceImpl.getRole((long) 1); - assertEquals(expectedRole, role); - } - - @Test - public void getRoleIfappIdNullTest() { - assertNull(ePRoleServiceImpl.getRole(null, null)); - - } - - @Test - public void getRoleIfappIdNotNullTest() { - List<EPRole> roles = new ArrayList<>(); - EPRole role = new EPRole(); - roles.add(role); - String sql = "SELECT * FROM fn_role where APP_ID = 1 AND APP_ROLE_ID = 1"; - Mockito.when(dataAccessService.executeSQLQuery(sql, EPRole.class, null)).thenReturn(roles); - EPRole expectedRole = ePRoleServiceImpl.getRole((long) 1, (long) 1); - assertEquals(expectedRole, role); - - } - - @Test - public void getRoleIfListSizeIsMoreThan1Test() { - List<EPRole> roles = new ArrayList<>(); - EPRole role = new EPRole(); - EPRole role1 = new EPRole(); - roles.add(role); - roles.add(role1); - String sql = "SELECT * FROM fn_role where APP_ID = 1 AND APP_ROLE_ID = 1"; - Mockito.when(dataAccessService.executeSQLQuery(sql, EPRole.class, null)).thenReturn(roles); - EPRole expectedRole = ePRoleServiceImpl.getRole((long) 1, (long) 1); - assertEquals(expectedRole, role); - - } - - @Test - public void getRoleIfListSizeIsEmptyTest() { - List<EPRole> roles = new ArrayList<>(); - String sql = "SELECT * FROM fn_role where APP_ID = 1 AND APP_ROLE_ID = 1"; - Mockito.when(dataAccessService.executeSQLQuery(sql, EPRole.class, null)).thenReturn(roles); - assertNull(ePRoleServiceImpl.getRole((long) 1, (long) 1)); - - } - - @Test - public void saveRoleTest() { - EPRole role = new EPRole(); - Mockito.doNothing().when(dataAccessService).saveDomainObject(role, null); - ePRoleServiceImpl.saveRole(role); - } - - @Test - public void deleteRoleTest() { - EPRole role = new EPRole(); - Mockito.doNothing().when(dataAccessService).deleteDomainObject(role, null); - ePRoleServiceImpl.deleteRole(role); - } - - @Test - public void getAvailableRolesTest() { - List<EPRole> roleList = new ArrayList<>(); - Mockito.when(dataAccessService.getList(EPRole.class, null)).thenReturn(roleList); - List<EPRole> expectedRoleList = ePRoleServiceImpl.getAvailableRoles(); - assertEquals(expectedRoleList, roleList); - } - - @Test - public void getAppRolesTest() { - final Map<String, String> portalParams = null; - List<EPRole> roleList = new ArrayList<>(); - Mockito.when(dataAccessService.executeNamedQuery("getPortalAppRoles", portalParams, null)).thenReturn(roleList); - assertNull(ePRoleServiceImpl.getAppRole("test", (long) 1)); - - } - - @SuppressWarnings("unchecked") - @Test - public void getAppRolesIfNotPortalTest() { - final Map<String, String> params = null; - List<EPRole> roleList = new ArrayList<>(); - EPRole role = new EPRole(); - EPRole role1 = new EPRole(); - roleList.add(role); - roleList.add(role1); - Mockito.when((List<EPRole>) dataAccessService.executeNamedQuery("getAppRoles", params, null)) - .thenReturn(roleList); - List<EPRole> expectedRoleList = (List<EPRole>) ePRoleServiceImpl.getAppRole("test", (long) 10); - System.out.println(expectedRoleList); - - } - - @Test - public void saveRoleFunction() { - RoleFunction domainRoleFunction = new RoleFunction(); - Mockito.doNothing().when(dataAccessService).saveDomainObject(domainRoleFunction, null); - ePRoleServiceImpl.saveRoleFunction(domainRoleFunction); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ExternalAccessRolesServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ExternalAccessRolesServiceImplTest.java deleted file mode 100644 index d8cd6425..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ExternalAccessRolesServiceImplTest.java +++ /dev/null @@ -1,346 +0,0 @@ -package org.openecomp.portalapp.portal.test.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -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.Matchers; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPAppRoleFunction; -import org.openecomp.portalapp.portal.domain.EPRole; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.ExternalAccessRolesServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.ExternalAccessPerms; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.domain.Role; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.service.DataAccessServiceImpl; -import org.openecomp.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.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({ EcompPortalUtils.class, SystemProperties.class, EPCommonSystemProperties.class }) -public class ExternalAccessRolesServiceImplTest { - @Mock - DataAccessService dataAccessService1 = new DataAccessServiceImpl(); - - @Mock - RestTemplate template = new RestTemplate(); - - @InjectMocks - ExternalAccessRolesServiceImpl externalAccessRolesServiceImpl = new ExternalAccessRolesServiceImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - MockEPUser mockUser = new MockEPUser(); - - public EPApp mockApp() { - EPApp app = new EPApp(); - app.setName("Test"); - app.setImageUrl("test"); - app.setDescription("test"); - app.setNotes("test"); - app.setUrl("test"); - app.setId((long) 10); - app.setAppRestEndpoint("test"); - app.setAlternateUrl("test"); - app.setName("test"); - app.setMlAppName("test"); - app.setMlAppAdminId("test"); - app.setUsername("test"); - app.setAppPassword("test"); - app.setOpen(false); - app.setEnabled(false); - app.setUebKey("test"); - app.setUebSecret("test"); - app.setUebTopicName("test"); - app.setAppType(1); - return app; - } - - @Test - public void getAppRolesIfAppIsPortalTest() throws Exception { - List<EPRole> applicationRoles = new ArrayList<>(); - Mockito.when(dataAccessService1.getList(EPRole.class, "test", null, null)).thenReturn(applicationRoles); - List<EPRole> expectedApplicationRoles = externalAccessRolesServiceImpl.getAppRoles((long) 1); - assertEquals(expectedApplicationRoles, applicationRoles); - } - - @Test - public void getAppRolesTest() throws Exception { - List<EPRole> applicationRoles = new ArrayList<>(); - Mockito.when(dataAccessService1.getList(EPRole.class, "test", null, null)).thenReturn(applicationRoles); - List<EPRole> expectedApplicationRoles = externalAccessRolesServiceImpl.getAppRoles((long) 10); - assertEquals(expectedApplicationRoles, applicationRoles); - } - - // @SuppressWarnings("null") - // @Test(expected = java.lang.Exception.class) - // public void getAppRolesExceptionTest() throws Exception{ - // List<EPRole> applicationRoles = new ArrayList<>(); - // DataAccessService dataAccessService = null ; - // Mockito.when(dataAccessService.getList(EPRole.class, "where app_id = 10", - // null, null)).thenThrow(nullPointerException); - // List<EPRole> expectedApplicationRoles = - // externalAccessRolesServiceImpl.getAppRoles((long) 10); - // assertEquals(expectedApplicationRoles,applicationRoles); - // } - - @Test(expected = java.lang.Exception.class) - public void getAppExceptionTest() throws Exception { - List<EPApp> app = new ArrayList<>(); - String uebKey = "test-ueb-key"; - Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null)) - .thenReturn(app); - List<EPApp> expectedapp = externalAccessRolesServiceImpl.getApp(uebKey); - assertEquals(app, expectedapp); - } - - @Test(expected = java.lang.Exception.class) - public void getAppTest() throws Exception { - List<EPApp> appList = new ArrayList<>(); - EPApp app = mockApp(); - appList.add(app); - String uebKey = "test-ueb-key"; - Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null)) - .thenReturn(appList); - List<EPApp> expectedapp = externalAccessRolesServiceImpl.getApp(uebKey); - } - - @Test - public void getAppErrorTest() throws Exception { - List<EPApp> appList = new ArrayList<>(); - EPApp app = mockApp(); - app.setId((long) 1); - appList.add(app); - String uebKey = "test-ueb-key"; - Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null)) - .thenReturn(appList); - List<EPApp> expectedapp = externalAccessRolesServiceImpl.getApp(uebKey); - assertEquals(appList, expectedapp); - } - - @Test - public void addRoleTest() throws Exception { - HttpHeaders headers = new HttpHeaders(); - PowerMockito.mockStatic(EcompPortalUtils.class); - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - String uebKey = "test-ueb-key"; - Role role = new Role(); - role.setId((long) 25); - EPApp app = mockApp(); - app.setEnabled(true); - app.setId((long) 10); - app.setNameSpace("test_namesapce"); - Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers); - List<EPApp> appList = new ArrayList<>(); - appList.add(app); - List<EPRole> roleList = new ArrayList<>(); - EPRole ePRole = new EPRole(); - role.setName("Test Role"); - roleList.add(ePRole); - Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null)) - .thenReturn(appList); - Mockito.when(dataAccessService1.getList(EPRole.class, " where app_role_id = " + role.getId(), null, null)) - .thenReturn(roleList); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)) - .thenReturn("Testurl"); - ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.CREATED); - Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST), - Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addResponse); - - assertTrue(externalAccessRolesServiceImpl.addRole(role, uebKey)); - } - - @Test - public void addRoleMethodNotAllowedTest() throws Exception { - HttpHeaders headers = new HttpHeaders(); - PowerMockito.mockStatic(EcompPortalUtils.class); - PowerMockito.mockStatic(SystemProperties.class); - PowerMockito.mockStatic(EPCommonSystemProperties.class); - String uebKey = "test-ueb-key"; - Role role = new Role(); - role.setId((long) 25); - EPApp app = mockApp(); - app.setEnabled(true); - app.setId((long) 10); - app.setNameSpace("test_namesapce"); - Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers); - List<EPApp> appList = new ArrayList<>(); - appList.add(app); - List<EPRole> roleList = new ArrayList<>(); - EPRole ePRole = new EPRole(); - role.setName("Test Role"); - roleList.add(ePRole); - Mockito.when(dataAccessService1.getList(EPApp.class, " where ueb_key = '" + uebKey + "'", null, null)) - .thenReturn(appList); - Mockito.when(dataAccessService1.getList(EPRole.class, " where app_role_id = " + role.getId(), null, null)) - .thenReturn(roleList); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)) - .thenReturn("Testurl"); - ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.METHOD_NOT_ALLOWED); - Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST), - Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addResponse); - - assertFalse(externalAccessRolesServiceImpl.addRole(role, uebKey)); - } - - public EPApp getApp() { - EPApp app = new EPApp(); - app.setName("Test"); - app.setImageUrl("test"); - app.setDescription("test"); - app.setNotes("test"); - app.setUrl("test"); - app.setId((long) 1); - app.setAppRestEndpoint("test"); - app.setAlternateUrl("test"); - app.setName("test"); - app.setMlAppName("test"); - app.setMlAppAdminId("test"); - app.setUsername("test"); - app.setAppPassword("test"); - app.setOpen(true); - app.setEnabled(false); - app.setUebKey("test"); - app.setUebSecret("test"); - app.setUebTopicName("test"); - app.setAppType(1); - return app; - } - - @Test - public void deleteCentralRoleFunctionTest() throws Exception { - final Map<String, String> params = new HashMap<>(); - EPApp app = mockApp(); - params.put("functionCd", "menu_fun_code"); - params.put("appId", String.valueOf(10)); - List<CentralRoleFunction> centralRoleFunctionList = new ArrayList<>(); - CentralRoleFunction domainCentralRoleFunction = new CentralRoleFunction(); - domainCentralRoleFunction.setCode("menu_fun_code"); - centralRoleFunctionList.add(domainCentralRoleFunction); - Mockito.when(dataAccessService1.executeNamedQuery("getAppFunctionDetails", params, null)) - .thenReturn(centralRoleFunctionList); - ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.OK); - Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.DELETE), - Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addResponse); - HttpHeaders headers = new HttpHeaders(); - PowerMockito.mockStatic(EcompPortalUtils.class); - Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers); - - Mockito.doNothing().when(dataAccessService1).deleteDomainObjects(EPAppRoleFunction.class, - "app_id = " + app.getId() + " and function_cd = '" + "menu_fun_code" + "'", null); - - assertTrue(externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app)); - } - - @Test - public void deleteCentralRoleFunctionFailTest() throws Exception { - final Map<String, String> params = new HashMap<>(); - EPApp app = mockApp(); - params.put("functionCd", "menu_fun_code"); - params.put("appId", String.valueOf(10)); - List<CentralRoleFunction> centralRoleFunctionList = new ArrayList<>(); - CentralRoleFunction domainCentralRoleFunction = new CentralRoleFunction(); - domainCentralRoleFunction.setCode("menu_fun_code"); - centralRoleFunctionList.add(domainCentralRoleFunction); - HttpClientErrorException httpClientErrorException = new HttpClientErrorException(HttpStatus.NOT_FOUND); - Mockito.when(dataAccessService1.executeNamedQuery("getAppFunctionDetails", params, null)) - .thenReturn(centralRoleFunctionList); - ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.NOT_FOUND); - Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.DELETE), - Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenThrow(httpClientErrorException); - HttpHeaders headers = new HttpHeaders(); - PowerMockito.mockStatic(EcompPortalUtils.class); - Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers); - - Mockito.doNothing().when(dataAccessService1).deleteDomainObjects(EPAppRoleFunction.class, - "app_id = " + app.getId() + " and function_cd = '" + "menu_fun_code" + "'", null); - - assertTrue(externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app)); - } - - @Test - public void deleteCentralRoleFunctionExceptionTest() { - final Map<String, String> params = new HashMap<>(); - EPApp app = mockApp(); - params.put("functionCd", "menu_fun_code"); - params.put("appId", String.valueOf(10)); - List<CentralRoleFunction> centralRoleFunctionList = new ArrayList<>(); - CentralRoleFunction domainCentralRoleFunction = new CentralRoleFunction(); - domainCentralRoleFunction.setCode("menu_fun_code"); - centralRoleFunctionList.add(domainCentralRoleFunction); - Mockito.when(dataAccessService1.executeNamedQuery("getAppFunctionDetails", params, null)) - .thenThrow(nullPointerException); - assertFalse(externalAccessRolesServiceImpl.deleteCentralRoleFunction("menu_fun_code", app)); - } - - @Test - public void getUserTest() { - List<EPUser> userList = new ArrayList<>(); - EPUser user = mockUser.mockEPUser(); - userList.add(user); - Mockito.when(dataAccessService1.getList(EPUser.class, " where org_user_id = '" + "guestT" + "'", null, null)) - .thenReturn(userList); - List<EPUser> expectedUserList = externalAccessRolesServiceImpl.getUser("guestT"); - assertEquals(expectedUserList, userList); - } - - public void saveCentralRoleFunctionTest() throws Exception { - CentralRoleFunction centralRoleFunction = new CentralRoleFunction(); - centralRoleFunction.setCode("menu_test"); - EPApp app = mockApp(); - app.setId((long) 1); - final Map<String, String> params = new HashMap<>(); - params.put("functionCd", "menu_test"); - params.put("appId", String.valueOf(1)); - ExternalAccessPerms extPerms = new ExternalAccessPerms(); - PowerMockito.mockStatic(EcompPortalUtils.class); - HttpHeaders headers = new HttpHeaders(); - Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers); - List<CentralRoleFunction> appRoleFunc = new ArrayList<>(); - appRoleFunc.add(centralRoleFunction); - Mockito.when(dataAccessService1.executeNamedQuery("getAppFunctionDetails", params, - null)).thenReturn(appRoleFunc); - ResponseEntity<String> addResponse = new ResponseEntity<>(HttpStatus.OK); - Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), - Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addResponse); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuMockServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuMockServiceImplTest.java deleted file mode 100644 index 51802c13..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuMockServiceImplTest.java +++ /dev/null @@ -1,205 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.service; - -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -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.openecomp.portalapp.portal.domain.FunctionalMenuItemWithAppID; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.service.FunctionalMenuServiceImpl; -import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.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, EPCommonSystemProperties.class}) -public class FunctionalMenuMockServiceImplTest extends ApplicationCommonContextTestSuite { - - @Mock - FunctionalMenuService functionalMenuService; - - @Mock - DataAccessService dataAccessService; - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - @InjectMocks - FunctionalMenuServiceImpl functionalMenuServiceImpl= new FunctionalMenuServiceImpl(); - - @Test - public void assignHelpURLsTest(){ - List<FunctionalMenuItem> menuItems = new ArrayList<FunctionalMenuItem>(); - FunctionalMenuItem functionalMenuItem1 = new FunctionalMenuItem(); - functionalMenuItem1.text = "Contact Us"; - FunctionalMenuItem functionalMenuItem2 = new FunctionalMenuItem(); - functionalMenuItem2.text = "Get Access"; - FunctionalMenuItem functionalMenuItem3 = new FunctionalMenuItem(); - functionalMenuItem3.text = "User Guide"; - menuItems.add(functionalMenuItem1); - menuItems.add(functionalMenuItem2); - menuItems.add(functionalMenuItem3); - - PowerMockito.mockStatic(SystemProperties.class); - Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.USER_GUIDE_URL)).thenReturn("http://todo_enter_user_guide_link"); -// Mockito.doNothing().when(functionalMenuServiceImpl).assignHelpURLs(menuItems); - functionalMenuServiceImpl.assignHelpURLs(menuItems); - } - - @Test - public void getFunctionalMenuItemsTest(){ - String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id FROM fn_menu_functional m, " - + "fn_menu_functional_roles r WHERE m.menu_id = r.menu_id AND UPPER(m.active_yn) = 'Y' AND r.role_id != '900' " - + "UNION SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn,-1 app_id FROM fn_menu_functional m " - + "WHERE m.url='' AND UPPER(m.active_yn) = 'Y'"; - List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>(); - List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>(); - - Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult); - - actualResult = functionalMenuServiceImpl.getFunctionalMenuItems(true); - assertEquals(actualResult, expectedResult); - } - - @Test - public void getFunctionalMenuItemsNegativeTest(){ - String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id FROM fn_menu_functional m, " - + "fn_menu_functional_roles r WHERE m.menu_id = r.menu_id AND UPPER(m.active_yn) = 'Y' AND r.role_id != '900' " - + "UNION SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn,-1 app_id FROM fn_menu_functional m " - + "WHERE m.url='' AND UPPER(m.active_yn) = 'Y'"; - List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>(); - List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>(); - - Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult); - - actualResult = functionalMenuServiceImpl.getFunctionalMenuItems(false); - assertEquals(actualResult, expectedResult); - } - - @Test - public void getFunctionalMenuItemsForNotificationTreeTest(){ - String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id FROM fn_menu_functional m, fn_menu_functional_roles r " - + "WHERE m.menu_id = r.menu_id AND UPPER(m.active_yn) = 'Y' AND r.role_id != '900' UNION SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id," - + " m.url, m.active_yn,-1 app_id FROM fn_menu_functional m WHERE m.url='' AND UPPER(m.active_yn) = 'Y'"; - List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>(); - List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>(); - - Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult); - - actualResult = functionalMenuServiceImpl.getFunctionalMenuItemsForNotificationTree(true); - assertEquals(actualResult, expectedResult); - - } - - @Test - public void getFunctionalMenuItemsForNotificationNegativeTreeTest(){ - String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id FROM fn_menu_functional m, fn_menu_functional_roles r " - + "WHERE m.menu_id = r.menu_id AND UPPER(m.active_yn) = 'Y' AND r.role_id != '900' UNION SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id," - + " m.url, m.active_yn,-1 app_id FROM fn_menu_functional m WHERE m.url='' AND UPPER(m.active_yn) = 'Y'"; - List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>(); - List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>(); - - Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult); - - actualResult = functionalMenuServiceImpl.getFunctionalMenuItemsForNotificationTree(false); - assertEquals(actualResult, expectedResult); - } - - @Test - public void getFunctionalMenuItemsForAppTest(){ - String sql = "SELECT DISTINCT m1.menu_id, m1.column_num, m1.text, m1.parent_menu_id, m1.url, m.active_yn " - + "FROM fn_menu_functional m, fn_menu_functional m1, fn_menu_functional_ancestors a, fn_menu_functional_roles mr " - + "WHERE mr.app_id='1' AND mr.menu_id = m.menu_id AND UPPER(m.active_yn) = 'Y' AND UPPER(m1.active_yn) ='Y' AND a.menu_id = m.menu_id " - + "AND a.ancestor_menu_id = m1.menu_id"; - Integer appId = 1; - List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>(); - List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>(); - - Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult); - - actualResult = functionalMenuServiceImpl.getFunctionalMenuItemsForApp(appId); - assertEquals(actualResult, expectedResult); - } - - @Test - public void getFunctionalMenuItemsForUserTest(){ - String orgUserId = "test"; - String sql = "SELECT DISTINCT m1.menu_id, m1.column_num, m1.text, m1.parent_menu_id, m1.url, m.active_yn " - + "FROM fn_menu_functional m, fn_menu_functional m1, fn_menu_functional_ancestors a, fn_menu_functional_roles mr, fn_user u , fn_user_role ur " - + "WHERE u.org_user_id='test' AND u.user_id = ur.user_id AND ur.app_id = mr.app_id AND (ur.role_id = mr.role_id OR ur.role_id = '999') " - + "AND m.menu_id = mr.menu_id AND UPPER(m.active_yn) = 'Y' AND UPPER(m1.active_yn) ='Y' AND a.menu_id = m.menu_id " - + "AND a.ancestor_menu_id = m1.menu_id UNION select m1.menu_id, m1.column_num, m1.text, m1.parent_menu_id, m1.url, m1.active_yn " - + "FROM fn_menu_functional m, fn_menu_functional_roles mr, fn_menu_functional m1, fn_menu_functional_ancestors a where a.menu_id = m.menu_id AND a.ancestor_menu_id = m1.menu_id AND m.menu_id != m1.menu_id AND m.menu_id = mr.menu_id AND mr.role_id = '900' AND UPPER(m.active_yn) = 'Y' AND UPPER(m1.active_yn) ='Y' UNION SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn FROM fn_menu_functional m WHERE m.text in ('Favorites','Get Access','Contact Us','Support','User Guide','Help')"; - List<FunctionalMenuItem> actualResult = new ArrayList<FunctionalMenuItem>(); - List<FunctionalMenuItem> expectedResult = new ArrayList<FunctionalMenuItem>(); - - Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(expectedResult); - - actualResult = functionalMenuServiceImpl.getFunctionalMenuItemsForUser(orgUserId); - assertEquals(actualResult, expectedResult); - } - - @Test - public void getFunctionalMenuItemDetailsTest(){ - Integer menuid = 1; - String sql = "SELECT * FROM fn_menu_functional_roles WHERE menu_id = '1'"; - FunctionalMenuItem actualResult = null; - FunctionalMenuItem expectedResult = null; - List<FunctionalMenuRole> roleItems = new ArrayList<FunctionalMenuRole>(); - Mockito.when(dataAccessService.executeSQLQuery(sql, FunctionalMenuItemWithAppID.class, null)).thenReturn(roleItems); - - actualResult = functionalMenuServiceImpl.getFunctionalMenuItemDetails(menuid); - assertEquals(actualResult, expectedResult); - } - - @Test - public void getFavoriteItemsTest(){ - Long userId = (long)1; - String sql = "SELECT DISTINCT f.user_id,f.menu_id,m.text,m.url " - + "FROM fn_menu_favorites f, fn_menu_functional m, fn_menu_functional_roles mr " - + "WHERE f.user_id='1' AND f.menu_id = m.menu_id AND f.menu_id = mr.menu_id AND mr.role_id != '900' "; - List<FavoritesFunctionalMenuItemJson> actualResult = new ArrayList<FavoritesFunctionalMenuItemJson>(); - List<FavoritesFunctionalMenuItemJson> expectedResult = new ArrayList<FavoritesFunctionalMenuItemJson>(); - - Mockito.when(dataAccessService.executeSQLQuery(sql, FavoritesFunctionalMenuItemJson.class, null)).thenReturn(expectedResult); - - actualResult = functionalMenuServiceImpl.getFavoriteItems(userId); - assertEquals(actualResult, expectedResult); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuServiceImplTest.java deleted file mode 100644 index 2ca02ba6..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/FunctionalMenuServiceImplTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.portal.test.service; - -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Test; -import org.openecomp.portalapp.portal.service.FunctionalMenuService; -import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; -import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite; -import org.springframework.beans.factory.annotation.Autowired; - -public class FunctionalMenuServiceImplTest extends ApplicationCommonContextTestSuite { - - @Autowired - FunctionalMenuService functionalMenuService; - - @Test - public void getAppListTestService() throws Exception { - - String userId = "guestT"; - List<BusinessCardApplicationRole> userAppRolesActualResult = null; - - List<BusinessCardApplicationRole> userAppRolesExpectedResult = new ArrayList<BusinessCardApplicationRole>(); - BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole(); - businessCardApplicationRole.setAppName("ECOMP Portal"); - businessCardApplicationRole.setRoleName("System Administrator"); - userAppRolesExpectedResult.add(businessCardApplicationRole); - Map<String, String> params = new HashMap<String, String>(); - params.put("userId", userId); - userAppRolesActualResult = functionalMenuService.getUserAppRolesList(userId); - assertTrue(userAppRolesActualResult.contains(businessCardApplicationRole)); - - } - - @Test - public void getFunctionalMenuRoleTest() throws Exception { - - FunctionalMenuRole expectedFunctionalMenuRole = new FunctionalMenuRole(); - expectedFunctionalMenuRole.setId(new Integer(-1)); - - expectedFunctionalMenuRole.setMenuId((long) 137); - expectedFunctionalMenuRole.setAppId(new Integer(456)); - expectedFunctionalMenuRole.setRoleId(new Integer(6214)); - List<FunctionalMenuRole> actualFunctionalMenuRoleList = null; - actualFunctionalMenuRoleList = functionalMenuService.getFunctionalMenuRole(); - assertTrue(actualFunctionalMenuRoleList.contains(expectedFunctionalMenuRole)); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/GetAccessServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/GetAccessServiceImplTest.java deleted file mode 100644 index e689fab7..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/GetAccessServiceImplTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.openecomp.portalapp.portal.test.service; - -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.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.GetAccessResult; -import org.openecomp.portalapp.portal.service.GetAccessServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.service.DataAccessServiceImpl; - -public class GetAccessServiceImplTest { - - - @Mock - DataAccessService dataAccessService = new DataAccessServiceImpl(); - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - @InjectMocks - GetAccessServiceImpl getAccessServiceImpl = new GetAccessServiceImpl(); - - MockEPUser mockUser = new MockEPUser(); - - @Test - public void getAppAccessListTest() - { - EPUser user = mockUser.mockEPUser(); - Map<String, Long> params = new HashMap<>(); - params.put("userId", user.getId()); - List<GetAccessResult> appAccessList = new ArrayList<>(); - Mockito.when(dataAccessService.executeNamedQuery("getAppAccessFunctionRole", params, null)).thenReturn(appAccessList); - - List<GetAccessResult> expectedAppAccessList = getAccessServiceImpl.getAppAccessList(user); - assertEquals(expectedAppAccessList, appAccessList); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/LicenseableClassImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/LicenseableClassImplTest.java deleted file mode 100644 index 5c4cb5b4..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/LicenseableClassImplTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.openecomp.portalapp.portal.test.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.io.IOException; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.lm.LicenseableClassImpl; - -public class LicenseableClassImplTest { - - @InjectMocks - LicenseableClassImpl licenseableClassImpl= new LicenseableClassImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - @Test - public void getApplicationNameTest() - { - assertEquals(licenseableClassImpl.getApplicationName(), ""); - } - @Test - public void getPublicKeystoreAsInputStreamTest() throws IOException - { - assertNull(licenseableClassImpl.getPublicKeystoreAsInputStream()); - } - @Test - public void getAliasTest() - { - assertEquals(licenseableClassImpl.getAlias(), ""); - } - @Test - public void getKeyPasswdTest() - { - assertEquals(licenseableClassImpl.getKeyPasswd(), ""); - } - @Test - public void getPublicKeystorePasswordTest() - { - assertEquals(licenseableClassImpl.getPublicKeystorePassword(), ""); - } - @Test - public void getCipherParamPasswordTest() - { - assertEquals(licenseableClassImpl.getPublicKeystorePassword(), ""); - } - @Test - public void getClassToLicenseTest() - { - assertEquals(licenseableClassImpl.getClassToLicense(), LicenseableClassImpl.class); - } - - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ManifestServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ManifestServiceImplTest.java deleted file mode 100644 index f2b6036e..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/ManifestServiceImplTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.openecomp.portalapp.portal.test.service; - -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.jar.Attributes; - -import javax.servlet.ServletContext; - -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.openecomp.portalapp.portal.service.ManifestServiceImpl; - -public class ManifestServiceImplTest { - - @Mock - ServletContext context; - - @Mock - ServletContext context1 = null; - - @InjectMocks - ManifestServiceImpl manifestServiceImpl = new ManifestServiceImpl(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - NullPointerException nullPointerException = new NullPointerException(); - - @Test - public void getWebappManifestTest() throws IOException { - final String MANIFEST_RESOURCE_PATH = "/META-INF/MANIFEST.MF"; - InputStream inputStream = new ByteArrayInputStream("test data".getBytes()); - Mockito.when(context.getResourceAsStream(MANIFEST_RESOURCE_PATH)).thenReturn(inputStream); - Attributes attributes = manifestServiceImpl.getWebappManifest(); - assertTrue(attributes.size() == 0); - } - - @Test(expected = java.lang.NullPointerException.class) - public void getWebappManifestExceptionTest() throws IOException { - final String MANIFEST_RESOURCE_PATH = "/META-INF/MANIFEST.MF"; - InputStream inputStream = new ByteArrayInputStream("test data".getBytes()); - Mockito.when(context1.getResourceAsStream(MANIFEST_RESOURCE_PATH)).thenThrow(nullPointerException); - Attributes attributes = manifestServiceImpl.getWebappManifest(); - assertTrue(attributes.size() == 0); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/PersUserAppServiceImplTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/PersUserAppServiceImplTest.java deleted file mode 100644 index bdd6cbd1..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/service/PersUserAppServiceImplTest.java +++ /dev/null @@ -1,181 +0,0 @@ -package org.openecomp.portalapp.portal.test.service; - -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.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.domain.EPUserApp; -import org.openecomp.portalapp.portal.domain.PersUserAppSelection; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.PersUserAppServiceImpl; -import org.openecomp.portalapp.portal.service.UserRolesService; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalsdk.core.service.DataAccessService; - -public class PersUserAppServiceImplTest { - - @Mock - DataAccessService dataAccessService; - @Mock - AdminRolesService adminRolesService; - @Mock - UserRolesService userRolesService; - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - @InjectMocks - PersUserAppServiceImpl persUserAppServiceImpl = new PersUserAppServiceImpl(); - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - MockEPUser mockUser = new MockEPUser(); - - public EPApp getApp() { - EPApp app = new EPApp(); - app.setName("Test"); - app.setImageUrl("test"); - app.setDescription("test"); - app.setNotes("test"); - app.setUrl("test"); - app.setId((long) 1); - app.setAppRestEndpoint("test"); - app.setAlternateUrl("test"); - app.setName("test"); - app.setMlAppName("test"); - app.setMlAppAdminId("test"); - app.setUsername("test"); - app.setAppPassword("test"); - app.setOpen(true); - app.setEnabled(false); - app.setUebKey("test"); - app.setUebSecret("test"); - app.setUebTopicName("test"); - app.setAppType(1); - return app; - } - - @Test(expected = IllegalArgumentException.class) - public void setPersUserAppValueIfUserNull() { - persUserAppServiceImpl.setPersUserAppValue(null, null, false, false); - } - - @Test - public void setPersUserAppValueTest() { - EPApp app = getApp(); - EPUser user = mockUser.mockEPUser(); - List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>(); - PersUserAppSelection persUserAppSelection = new PersUserAppSelection(); - persUserAppSelection.setId((long) 1); - persUserAppSelectionList.add(persUserAppSelection); - Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null)) - .thenReturn(persUserAppSelectionList); - Mockito.doNothing().when(dataAccessService).deleteDomainObject(persUserAppSelection, null); - persUserAppServiceImpl.setPersUserAppValue(user, app, false, true); - } - - @Test - public void setPersUserAppValueIfSelectTest() { - EPApp app = getApp(); - EPUser user = mockUser.mockEPUser(); - List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>(); - PersUserAppSelection persUserAppSelection = new PersUserAppSelection(); - persUserAppSelection.setId((long) 1); - persUserAppSelectionList.add(persUserAppSelection); - Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null)) - .thenReturn(persUserAppSelectionList); - Mockito.doNothing().when(dataAccessService).saveDomainObject(persUserAppSelection, null); - persUserAppServiceImpl.setPersUserAppValue(user, app, true, true); - } - - @Test - public void setPersUserAppValueIfOpenTest() { - EPApp app = getApp(); - app.setOpen(false); - EPUser user = mockUser.mockEPUser(); - List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>(); - PersUserAppSelection persUserAppSelection = new PersUserAppSelection(); - persUserAppSelection.setId((long) 1); - persUserAppSelectionList.add(persUserAppSelection); - Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null)) - .thenReturn(persUserAppSelectionList); - Mockito.doNothing().when(dataAccessService).saveDomainObject(persUserAppSelection, null); - persUserAppServiceImpl.setPersUserAppValue(user, app, true, true); - } - - @Test - public void setPersUserAppValueIfAppNotOpenTest() { - EPApp app = getApp(); - app.setOpen(false); - EPUser user = mockUser.mockEPUser(); - List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>(); - PersUserAppSelection persUserAppSelection = new PersUserAppSelection(); - persUserAppSelection.setId((long) 1); - persUserAppSelectionList.add(persUserAppSelection); - Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null)) - .thenReturn(persUserAppSelectionList); - Mockito.doNothing().when(dataAccessService).saveDomainObject(persUserAppSelection, null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - List<EPUserApp> roles = new ArrayList<>(); - EPUserApp epUserApp = new EPUserApp(); - roles.add(epUserApp); - Mockito.when(userRolesService.getCachedAppRolesForUser(app.getId(), user.getId())).thenReturn(roles); - persUserAppServiceImpl.setPersUserAppValue(user, app, true, false); - } - - @Test - public void setPersUserAppValueIfNotPortalAdminTest() { - EPApp app = getApp(); - app.setOpen(false); - EPUser user = mockUser.mockEPUser(); - List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>(); - PersUserAppSelection persUserAppSelection = new PersUserAppSelection(); - persUserAppSelection.setId((long) 1); - persUserAppSelectionList.add(persUserAppSelection); - Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null)) - .thenReturn(persUserAppSelectionList); - Mockito.doNothing().when(dataAccessService).deleteDomainObject(persUserAppSelection, null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - List<EPUserApp> roles = new ArrayList<>(); - EPUserApp epUserApp = new EPUserApp(); - roles.add(epUserApp); - Mockito.when(userRolesService.getCachedAppRolesForUser(app.getId(), user.getId())).thenReturn(roles); - persUserAppServiceImpl.setPersUserAppValue(user, app, true, false); - } - - @Test - public void setPersUserAppValueNewTest() { - EPApp app = getApp(); - app.setOpen(false); - EPUser user = mockUser.mockEPUser(); - List<PersUserAppSelection> persUserAppSelectionList = new ArrayList<>(); - PersUserAppSelection persUserAppSelection = new PersUserAppSelection(); - persUserAppSelection.setId((long) 1); - persUserAppSelectionList.add(persUserAppSelection); - Mockito.when(dataAccessService.getList(PersUserAppSelection.class, "test", null, null)) - .thenReturn(persUserAppSelectionList); - Mockito.doNothing().when(dataAccessService).saveDomainObject(persUserAppSelection, null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - List<EPUserApp> roles = new ArrayList<>(); - EPUserApp epUserApp = new EPUserApp(); - roles.add(epUserApp); - Mockito.when(userRolesService.getCachedAppRolesForUser(app.getId(), user.getId())).thenReturn(roles); - persUserAppServiceImpl.setPersUserAppValue(user, app, false, false); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java deleted file mode 100644 index 7fd3c03f..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.Analytics; - -public class AnalyticsTest { - - public Analytics mockAnalytics(){ - Analytics analytics = new Analytics(); - - analytics.setAction("test"); - analytics.setPage("test"); - analytics.setFunction("test"); - analytics.setUserid("test"); - analytics.setType("test"); - - return analytics; - } - - @Test - public void analyticsTest(){ - Analytics analytics = mockAnalytics(); - - assertEquals(analytics.getAction(), "test"); - assertEquals(analytics.getPage(), "test"); - assertEquals(analytics.getFunction(), "test"); - assertEquals(analytics.getUserid(), "test"); - assertEquals(analytics.getType(), "test"); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java deleted file mode 100644 index c583c9cd..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class AppCatalogPersonalizationTest { - - public AppCatalogPersonalization mockAppCatalogPersonalization(){ - AppCatalogPersonalization appCatalogPersonalization = new AppCatalogPersonalization(); - - return appCatalogPersonalization; - } - - @Test - public void appCatalogPersonalizationTest(){ - AppCatalogPersonalization appCatalogPersonalization = mockAppCatalogPersonalization(); - - AppCatalogPersonalization appCatalogPersonalization1 = new AppCatalogPersonalization(); - - assertEquals(appCatalogPersonalization.hashCode(), appCatalogPersonalization1.hashCode()); - assertTrue(appCatalogPersonalization.equals(appCatalogPersonalization1)); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java deleted file mode 100644 index a1dffd28..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin; - -public class AppNameIdIsAdminTest { - - public AppNameIdIsAdmin mockAppNameIdIsAdmin(){ - AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin(); - appNameIdIsAdmin.setId((long)1); - appNameIdIsAdmin.setAppName("test"); - appNameIdIsAdmin.setRestrictedApp(false); - appNameIdIsAdmin.setIsAdmin(false); - return appNameIdIsAdmin; - } - - @Test - public void appNameIdIsAdminTest(){ - AppNameIdIsAdmin appNameIdIsAdmin = mockAppNameIdIsAdmin(); - - AppNameIdIsAdmin appNameIdIsAdmin1 = new AppNameIdIsAdmin(); - appNameIdIsAdmin1.setId((long)1); - appNameIdIsAdmin1.setAppName("test"); - appNameIdIsAdmin1.setRestrictedApp(false); - appNameIdIsAdmin1.setIsAdmin(false); - - assertEquals(appNameIdIsAdmin.getId(), new Long(1)); - assertEquals(appNameIdIsAdmin.getAppName(), "test"); - assertEquals(appNameIdIsAdmin.getRestrictedApp(), false); - assertEquals(appNameIdIsAdmin.getIsAdmin(), false); - - assertEquals(appNameIdIsAdmin.toString(), "AppNameIdIsAdmin [id=1, appName=test, isAdmin=false, restrictedApp=false]"); - assertEquals(appNameIdIsAdmin.hashCode(), appNameIdIsAdmin1.hashCode()); - assertTrue(appNameIdIsAdmin.equals(appNameIdIsAdmin1)); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java deleted file mode 100644 index 2a7c343c..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import org.openecomp.portalapp.portal.transport.AppWithRolesForUser; - -public class AppWithRolesForUserTest { - - public AppWithRolesForUser mockAppWithRolesForUser(){ - AppWithRolesForUser appWithRolesForUser = new AppWithRolesForUser(); - - // List<RoleInAppForUser> appRoles = new ArrayList<RoleInAppForUser>(); - - appWithRolesForUser.setOrgUserId("test"); - appWithRolesForUser.setAppId((long)1); - appWithRolesForUser.setAppName("test"); - appWithRolesForUser.setAppRoles(null); - - return appWithRolesForUser; - } - - @Test - public void roleInAppForUserTest(){ - AppWithRolesForUser appWithRolesForUser = mockAppWithRolesForUser(); - - assertEquals(appWithRolesForUser.getOrgUserId(), "test"); - assertEquals(appWithRolesForUser.getAppId(), new Long(1)); - assertEquals(appWithRolesForUser.getAppName(), "test"); - assertEquals(appWithRolesForUser.getAppRoles(), null); - assertEquals(appWithRolesForUser.toString(), "AppWithRolesForUser [orgUserId=test, appId=1, appName=test, appRoles=null]"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java deleted file mode 100644 index 2c601d3c..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import java.util.ArrayList; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin; -import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole; - -public class AppsListWithAdminRoleTest { - - public AppsListWithAdminRole mockAppsListWithAdminRole(){ - AppsListWithAdminRole appsListWithAdminRole = new AppsListWithAdminRole(); - - ArrayList<AppNameIdIsAdmin> appsRoles = new ArrayList<AppNameIdIsAdmin>(); - AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin(); - appsRoles.add(appNameIdIsAdmin); - - appsListWithAdminRole.setOrgUserId("test"); - appsListWithAdminRole.setAppsRoles(appsRoles); - - return appsListWithAdminRole; - } - - @Test - public void appsListWithAdminRoleTest(){ - AppsListWithAdminRole appsListWithAdminRole = mockAppsListWithAdminRole(); - - AppsListWithAdminRole appsListWithAdminRole1 = new AppsListWithAdminRole(); - - ArrayList<AppNameIdIsAdmin> appsRoles = new ArrayList<AppNameIdIsAdmin>(); - AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin(); - appsRoles.add(appNameIdIsAdmin); - - appsListWithAdminRole1.setOrgUserId("test"); - appsListWithAdminRole1.setAppsRoles(appsRoles); - - assertEquals(appsListWithAdminRole.getOrgUserId(), "test"); - assertEquals(appsListWithAdminRole.getAppsRoles(), appsRoles); - - assertTrue(appsListWithAdminRole.equals(appsListWithAdminRole1)); - assertEquals(appsListWithAdminRole.hashCode(), appsListWithAdminRole1.hashCode()); - assertEquals(appsListWithAdminRole.toString(), "AppsListWithAdminRole [orgUserId=test, appsRoles=[AppNameIdIsAdmin [id=null, appName=null, isAdmin=null, restrictedApp=null]]]"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java deleted file mode 100644 index 854afccc..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.BulkUploadRoleFunction; - -public class BulkUploadRoleFunctionTest { - - public BulkUploadRoleFunction mockBulkUploadRoleFunction(){ - - BulkUploadRoleFunction bulkUploadRoleFunction = new BulkUploadRoleFunction(); - - bulkUploadRoleFunction.setFunctionName("test"); - bulkUploadRoleFunction.setFunctionCd("test"); - - return bulkUploadRoleFunction; - } - - @Test - public void bulkUploadRoleFunctionTest(){ - BulkUploadRoleFunction bulkUploadRoleFunction = mockBulkUploadRoleFunction(); - - BulkUploadRoleFunction bulkUploadRoleFunction1 = new BulkUploadRoleFunction(); - - bulkUploadRoleFunction1.setFunctionName("test"); - bulkUploadRoleFunction1.setFunctionCd("test"); - - assertEquals(bulkUploadRoleFunction.getFunctionCd(), "test"); - assertEquals(bulkUploadRoleFunction.getFunctionName(), "test"); - assertEquals(bulkUploadRoleFunction.hashCode(), bulkUploadRoleFunction1.hashCode()); - assertTrue(bulkUploadRoleFunction.equals(bulkUploadRoleFunction1)); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java deleted file mode 100644 index b2bbba68..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.BulkUploadUserRoles; - -public class BulkUploadUserRolesTest { - - public BulkUploadUserRoles mockBulkUploadUserRoles(){ - BulkUploadUserRoles bulkUploadUserRoles = new BulkUploadUserRoles(); - - bulkUploadUserRoles.setRoleName("test"); - bulkUploadUserRoles.setOrgUserId("test"); - bulkUploadUserRoles.setAppNameSpace("test"); - - return bulkUploadUserRoles; - } - - @Test - public void bulkUploadUserRolesTest(){ - BulkUploadUserRoles bulkUploadUserRoles = mockBulkUploadUserRoles(); - - BulkUploadUserRoles bulkUploadUserRoles1 = new BulkUploadUserRoles(); - - bulkUploadUserRoles1.setRoleName("test"); - bulkUploadUserRoles1.setOrgUserId("test"); - bulkUploadUserRoles1.setAppNameSpace("test"); - - assertEquals(bulkUploadUserRoles.getRoleName(), "test"); - assertEquals(bulkUploadUserRoles.getOrgUserId(), "test"); - assertEquals(bulkUploadUserRoles.getAppNameSpace(), "test"); - - assertEquals(bulkUploadUserRoles.hashCode(), bulkUploadUserRoles1.hashCode()); - assertTrue(bulkUploadUserRoles.equals(bulkUploadUserRoles1)); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java deleted file mode 100644 index 0ed06b12..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class BusinessCardApplicationRoleTest { - - public BusinessCardApplicationRole mockBusinessCardApplicationRole(){ - BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole(); - - return businessCardApplicationRole; - } - - @Test - public void businessCardApplicationRoleTest(){ - BusinessCardApplicationRole businessCardApplicationRole = mockBusinessCardApplicationRole(); - - BusinessCardApplicationRole businessCardApplicationRole1 = new BusinessCardApplicationRole(); - - assertEquals(businessCardApplicationRole.hashCode(), businessCardApplicationRole1.hashCode()); - assertTrue(businessCardApplicationRole.equals(businessCardApplicationRole1)); - assertEquals(businessCardApplicationRole.toString(), "BusinessCardUserApplicationRoles [appName=null, roleName=null]"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java deleted file mode 100644 index 9f5e6785..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class BusinessCardApplicationRolesListTest { - - public BusinessCardApplicationRolesList mockBusinessCardApplicationRolesList(){ - BusinessCardApplicationRolesList businessCardApplicationRolesList = new BusinessCardApplicationRolesList(); - - return businessCardApplicationRolesList; - } - - @Test - public void businessCardApplicationRolesListTest(){ - BusinessCardApplicationRolesList businessCardApplicationRolesList = mockBusinessCardApplicationRolesList(); - - BusinessCardApplicationRolesList businessCardApplicationRolesList1 = new BusinessCardApplicationRolesList(); - - assertEquals(businessCardApplicationRolesList.hashCode(), businessCardApplicationRolesList1.hashCode()); - assertTrue(businessCardApplicationRolesList.equals(businessCardApplicationRolesList1)); - assertEquals(businessCardApplicationRolesList.toString(), "BusinessCardUserAppRoles [appName=null, roleNames=null]"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java deleted file mode 100644 index 97c9c59f..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.CentralApp; - -public class CentralAppTest { - - public CentralApp mockCentralApp(){ - CentralApp centralApp = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", - "test", "test", "test", "test", null, "test", "test", "test", "test"); - - - /* public CentralApp(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, String name, - String imageUrl, String description, String notes, String url, String alternateUrl, String restEndpoint, - String mlAppName, String mlAppAdminId, String motsId, String appPassword, String open, String enabled, - byte[] thumbnail, String username, String uebKey, String uebSecret, String uebTopicName)*/ - - centralApp.setId((long)1); - centralApp.setCreatedId((long)1); - centralApp.setModifiedId((long)1); - centralApp.setRowNum((long)1); - centralApp.setName("test"); - centralApp.setImageUrl("test"); - centralApp.setDescription("test"); - centralApp.setNotes("test"); - centralApp.setUrl("test"); - centralApp.setAlternateUrl("test"); - centralApp.setRestEndpoint("test"); - centralApp.setMlAppName("test"); - centralApp.setMlAppAdminId("test"); - centralApp.setMotsId("test"); - centralApp.setAppPassword("test"); - centralApp.setOpen("test"); - centralApp.setEnabled("test"); - centralApp.setUsername("test"); - centralApp.setUebKey("test"); - centralApp.setUebSecret("test"); - centralApp.setUebTopicName("test"); - - return centralApp; - } - - @Test - public void centralAppTest(){ - CentralApp centralApp = mockCentralApp(); - - CentralApp centralApp1 = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", - "test", "test", "test", "test", null, "test", "test", "test", "test"); - - /*centralApp1.setId((long)1); - centralApp1.setCreatedId((long)1); - centralApp1.setModifiedId((long)1); - centralApp1.setRowNum((long)1); - centralApp1.setName("test"); - centralApp1.setImageUrl("test"); - centralApp1.setDescription("test"); - centralApp1.setNotes("test"); - centralApp1.setUrl("test"); - centralApp1.setAlternateUrl("test"); - centralApp1.setRestEndpoint("test"); - centralApp1.setMlAppName("test"); - centralApp1.setMlAppAdminId("test"); - centralApp1.setMotsId("test"); - centralApp1.setAppPassword("test"); - centralApp1.setOpen("test"); - centralApp1.setEnabled("test"); - centralApp1.setUsername("test"); - centralApp1.setUebKey("test"); - centralApp1.setUebSecret("test"); - centralApp1.setUebTopicName("test");*/ - - assertEquals(centralApp.getId(), new Long(1)); - assertEquals(centralApp.getCreatedId(), new Long(1)); - assertEquals(centralApp.getModifiedId(), new Long(1)); - assertEquals(centralApp.getRowNum(), new Long(1)); - assertEquals(centralApp.getName(), "test"); - assertEquals(centralApp.getImageUrl(), "test"); - assertEquals(centralApp.getDescription(), "test"); - assertEquals(centralApp.getNotes(), "test"); - assertEquals(centralApp.getUrl(), "test"); - assertEquals(centralApp.getAlternateUrl(), "test"); - assertEquals(centralApp.getRestEndpoint(), "test"); - assertEquals(centralApp.getMlAppName(), "test"); - assertEquals(centralApp.getMlAppAdminId(), "test"); - assertEquals(centralApp.getMotsId(), "test"); - assertEquals(centralApp.getAppPassword(), "test"); - assertEquals(centralApp.getOpen(), "test"); - assertEquals(centralApp.getEnabled(), "test"); - assertEquals(centralApp.getUsername(), "test"); - assertEquals(centralApp.getUebKey(), "test"); - assertEquals(centralApp.getUebSecret(), "test"); - assertEquals(centralApp.getUebTopicName(), "test"); - - assertTrue(centralApp.equals(centralApp1)); - assertEquals(centralApp.hashCode(), centralApp1.hashCode()); - /* assertTrue(centralApp.equals(new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", - "test", "test", "test", "test", null, "test", "test", "test", "test")));*/ - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java deleted file mode 100644 index 6ba0a444..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import java.util.Date; -import java.util.SortedSet; - -import org.junit.Test; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.transport.CentralRole; - -public class CentralRoleTest { - - public CentralRole mockCentralRole(){ - CentralRole centralRole = new CentralRole((long)1, null, null, (long)1, (long)1, (long)1, - "test", false, 1, null, null, null); - - centralRole.setId((long)1); - centralRole.setCreatedId((long)1); - centralRole.setModifiedId((long)1); - centralRole.setRowNum((long)1); - centralRole.setName("test"); - centralRole.setActive(false); - centralRole.setPriority(1); - - centralRole.setCreated(null); - centralRole.setModified(null); - centralRole.setRoleFunctions(null); - centralRole.setChildRoles(null); - centralRole.setParentRoles(null); - - return centralRole; - } - - @Test - public void centralRoleTest(){ - CentralRole centralRole = mockCentralRole(); - - CentralRole centralRole1 = new CentralRole((long)1, null, null, (long)1, (long)1, (long)1, - "test", false, 1, null, null, null); - - CentralRole centralRole2 = new CentralRole((long)1, "test"); - - assertEquals(centralRole.getId(), new Long(1)); - assertEquals(centralRole.getCreatedId(), new Long(1)); - assertEquals(centralRole.getModifiedId(), new Long(1)); - assertEquals(centralRole.getRowNum(), new Long(1)); - assertEquals(centralRole.getName(), "test"); - assertEquals(centralRole.isActive(), false); - assertEquals(centralRole.getCreated(), null); - assertEquals(centralRole.getModified(), null); - assertEquals(centralRole.getRoleFunctions(), null); - assertEquals(centralRole.getChildRoles(), null); - assertEquals(centralRole.getParentRoles(), null); - assertEquals(centralRole.getPriority().toString(), "1"); - assertEquals(centralRole.hashCode(), centralRole1.hashCode()); - assertTrue(centralRole.equals(centralRole1)); - assertEquals(centralRole, centralRole1); - assertEquals(centralRole2, new CentralRole((long)1, "test")); - } - - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java deleted file mode 100644 index f3582647..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.CentralApp; -import org.openecomp.portalapp.portal.transport.CentralRole; -import org.openecomp.portalapp.portal.transport.CentralUserApp; - -public class CentralUserAppTest { - - public CentralUserApp mockCentralUserApp(){ - CentralUserApp centralUserApp = new CentralUserApp(); - - CentralApp app = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", - "test", "test", "test", "test", null, "test", "test", "test", "test"); - - CentralRole role = new CentralRole(); - - centralUserApp.setUserId((long)1); - centralUserApp.setApp(app); - centralUserApp.setRole(role); - centralUserApp.setPriority((short) 123); - - return centralUserApp; - } - - @Test - public void centralUserAppTest(){ - CentralUserApp centralUserApp = mockCentralUserApp(); - - CentralApp app1 = new CentralApp((long)1, null, null, (long)1, (long)1, (long)1, "test", "test", "test", "test", "test", "test", "test", "test", "test", - "test", "test", "test", "test", null, "test", "test", "test", "test"); - - CentralRole role1 = new CentralRole(); - - assertEquals(centralUserApp.getUserId(), new Long(1)); - assertEquals(centralUserApp.getPriority(), new Short((short) 123)); - assertEquals(centralUserApp.getApp(), app1); - assertEquals(centralUserApp.getRole(), role1); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java deleted file mode 100644 index 9df86bc9..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import java.util.HashSet; -import java.util.Set; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.CentralRole; -import org.openecomp.portalapp.portal.transport.CentralUser; -import org.openecomp.portalapp.portal.transport.CentralUserApp; - -public class CentralUserTest { - - public CentralUser mockCentralUser(){ - Set<CentralUserApp> userApps = new HashSet<CentralUserApp>(); - Set<CentralRole> pseudoRoles = new HashSet<CentralRole>(); - CentralUser centralUser = new CentralUser((long)1, null, null, (long)1, (long)1, (long)1, (long)1, - (long)1, "test", "test", "test", "test", "test", - "test", "test", (long)1, "test", "test", "test", - "test", "test", "test", "test", "test", "test", "test", - "test", "test", "test", "test", - "test", "test", "test", "test", "test", - "test", "test", "test", "test", "test", - "test", "test", "test", "test", null, - false, false, (long)1, (long)1, false, "test", userApps, pseudoRoles); - - return centralUser; - } - - @Test - public void centralRoleTest(){ - CentralUser centralUser = mockCentralUser(); - - Set<CentralUserApp> userApps = new HashSet<CentralUserApp>(); - Set<CentralRole> pseudoRoles = new HashSet<CentralRole>(); - CentralUser centralUser1 = new CentralUser((long)1, null, null, (long)1, (long)1, (long)1, (long)1, - (long)1, "test", "test", "test", "test", "test", - "test", "test", (long)1, "test", "test", "test", - "test", "test", "test", "test", "test", "test", "test", - "test", "test", "test", "test", - "test", "test", "test", "test", "test", - "test", "test", "test", "test", "test", - "test", "test", "test", "test", null, - false, false, (long)1, (long)1, false, "test", userApps, pseudoRoles); - - - assertEquals(centralUser, centralUser1); - assertEquals(centralUser.hashCode(), centralUser1.hashCode()); - assertTrue(centralUser.equals(centralUser1)); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java deleted file mode 100644 index 6e8b4018..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EPAppsManualPreference; - -public class EPAppsManualPreferenceTest { - - public EPAppsManualPreference mockEPAppsManualPreference(){ - EPAppsManualPreference epAppsManualPreference = new EPAppsManualPreference(); - - epAppsManualPreference.setAppid((long)1); - epAppsManualPreference.setCol(1); - epAppsManualPreference.setHeaderText("test"); - epAppsManualPreference.setImageLink("test"); - epAppsManualPreference.setOrder(1); - epAppsManualPreference.setRestrictedApp(false); - epAppsManualPreference.setRow(1); - epAppsManualPreference.setSizeX(1); - epAppsManualPreference.setSizeY(1); - epAppsManualPreference.setSubHeaderText("test"); - epAppsManualPreference.setUrl("test"); - epAppsManualPreference.setAddRemoveApps(false); - - return epAppsManualPreference; - } - - @Test - public void epAppsManualPreferenceTest(){ - - EPAppsManualPreference epAppsManualPreference = mockEPAppsManualPreference(); - - assertEquals(epAppsManualPreference.getAppid(), new Long(1)); - assertEquals(epAppsManualPreference.getCol(), 1); - assertEquals(epAppsManualPreference.getHeaderText(), "test"); - assertEquals(epAppsManualPreference.getImageLink(), "test"); - assertEquals(epAppsManualPreference.getOrder(), 1); - assertEquals(epAppsManualPreference.isRestrictedApp(), false); - assertEquals(epAppsManualPreference.getRow(), 1); - assertEquals(epAppsManualPreference.getSizeX(), 1); - assertEquals(epAppsManualPreference.getSizeY(), 1); - assertEquals(epAppsManualPreference.getSubHeaderText(), "test"); - assertEquals(epAppsManualPreference.getUrl(), "test"); - assertEquals(epAppsManualPreference.isAddRemoveApps(), false); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java deleted file mode 100644 index 6c67424a..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EPAppsSortPreference; - -public class EPAppsSortPreferenceTest { - - public EPAppsSortPreference mockEPAppsSortPreference(){ - EPAppsSortPreference epAppsSortPreference = new EPAppsSortPreference(); - - epAppsSortPreference.setIndex(1); - epAppsSortPreference.setValue("test"); - epAppsSortPreference.setTitle("test"); - - return epAppsSortPreference; - } - - @Test - public void epAppsSortPreferenceTest(){ - EPAppsSortPreference epAppsSortPreference = mockEPAppsSortPreference(); - - assertEquals(epAppsSortPreference.getIndex(), 1); - assertEquals(epAppsSortPreference.getValue(), "test"); - assertEquals(epAppsSortPreference.getTitle(), "test"); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java deleted file mode 100644 index 78bb8474..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EPDeleteAppsManualSortPref; - -public class EPDeleteAppsManualSortPrefTest { - - public EPDeleteAppsManualSortPref mockEPDeleteAppsManualSortPref(){ - EPDeleteAppsManualSortPref epDeleteAppsManualSortPref = new EPDeleteAppsManualSortPref(); - - epDeleteAppsManualSortPref.setAppId((long)1); - epDeleteAppsManualSortPref.setSelect(false); - epDeleteAppsManualSortPref.setPending(false); - - return epDeleteAppsManualSortPref; - } - - @Test - public void epDeleteAppsManualSortPrefTest(){ - EPDeleteAppsManualSortPref epDeleteAppsManualSortPref = mockEPDeleteAppsManualSortPref(); - - assertEquals(epDeleteAppsManualSortPref.getAppId(), new Long(1)); - assertEquals(epDeleteAppsManualSortPref.isSelect(), false); - assertEquals(epDeleteAppsManualSortPref.isPending(), false); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java deleted file mode 100644 index 9c82ad37..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EPUserAppCurrentRoles; - -public class EPUserAppCurrentRolesTest { - - public EPUserAppCurrentRoles mockEPUserAppCurrentRoles(){ - EPUserAppCurrentRoles epUserAppCurrentRoles = new EPUserAppCurrentRoles(); - - epUserAppCurrentRoles.setRoleName("test"); - epUserAppCurrentRoles.setUserId((long)1); - epUserAppCurrentRoles.setPriority("test"); - epUserAppCurrentRoles.setRoleId((long)1); - - return epUserAppCurrentRoles; - } - - @Test - public void epUserAppCurrentRolesTest(){ - EPUserAppCurrentRoles epUserAppCurrentRoles = mockEPUserAppCurrentRoles(); - - EPUserAppCurrentRoles epUserAppCurrentRoles1 = new EPUserAppCurrentRoles(); - - epUserAppCurrentRoles1.setRoleName("test"); - epUserAppCurrentRoles1.setUserId((long)1); - epUserAppCurrentRoles1.setPriority("test"); - epUserAppCurrentRoles1.setRoleId((long)1); - - assertEquals(epUserAppCurrentRoles.getRoleName(), "test"); - assertEquals(epUserAppCurrentRoles.getUserId(), new Long(1)); - assertEquals(epUserAppCurrentRoles.getRoleId(), new Long(1)); - assertEquals(epUserAppCurrentRoles.getPriority(), "test"); - assertEquals(epUserAppCurrentRoles.hashCode(), epUserAppCurrentRoles1.hashCode()); - assertTrue(epUserAppCurrentRoles.equals(epUserAppCurrentRoles1)); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java deleted file mode 100644 index d466d91c..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EPWidgetsSortPreference; - -public class EPWidgetsSortPreferenceTest { - - public EPWidgetsSortPreference mockEPWidgetsSortPreference(){ - EPWidgetsSortPreference epWidgetsSortPreference = new EPWidgetsSortPreference(); - - epWidgetsSortPreference.setSizeX(1); - epWidgetsSortPreference.setSizeY(1); - epWidgetsSortPreference.setHeaderText("test"); - epWidgetsSortPreference.setUrl("test"); - epWidgetsSortPreference.setWidgetid((long)1); - epWidgetsSortPreference.setWidgetIdentifier("test"); - epWidgetsSortPreference.setRow(1); - epWidgetsSortPreference.setCol(1); - - return epWidgetsSortPreference; - } - - @Test - public void epWidgetsSortPreferenceTest(){ - EPWidgetsSortPreference epWidgetsSortPreference = mockEPWidgetsSortPreference(); - - assertEquals(epWidgetsSortPreference.getSizeX(), 1); - assertEquals(epWidgetsSortPreference.getSizeY(), 1); - assertEquals(epWidgetsSortPreference.getHeaderText(), "test"); - assertEquals(epWidgetsSortPreference.getUrl(), "test"); - assertEquals(epWidgetsSortPreference.getWidgetid(), new Long(1)); - assertEquals(epWidgetsSortPreference.getWidgetIdentifier(), "test"); - assertEquals(epWidgetsSortPreference.getRow(), 1); - assertEquals(epWidgetsSortPreference.getRow(), 1); - - } - - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java deleted file mode 100644 index 928c3737..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EcompUserAppRoles; - -public class EcompUserAppRolesTest { - - public EcompUserAppRoles mockEcompUserAppRoles(){ - EcompUserAppRoles ecompUserAppRoles = new EcompUserAppRoles(); - - ecompUserAppRoles.setAppId("test"); - ecompUserAppRoles.setUserId((long)1); - ecompUserAppRoles.setPriority("test"); - ecompUserAppRoles.setRoleId((long)1); - ecompUserAppRoles.setRoleName("test"); - - return ecompUserAppRoles; - } - - @Test - public void ecompUserAppRolesTest(){ - - EcompUserAppRoles ecompUserAppRoles = mockEcompUserAppRoles(); - - assertEquals(ecompUserAppRoles.getAppId(), "test"); - assertEquals(ecompUserAppRoles.getPriority(), "test"); - assertEquals(ecompUserAppRoles.getRoleName(), "test"); - assertEquals(ecompUserAppRoles.getUserId(), new Long(1)); - assertEquals(ecompUserAppRoles.getRoleId(), new Long(1)); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java deleted file mode 100644 index 11fe2cf7..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EpNotificationItemExtVO; - -public class EpNotificationItemExtVOTest { - - public EpNotificationItemExtVO mockEpNotificationItemExtVO(){ - EpNotificationItemExtVO epNotificationItemExtVO = new EpNotificationItemExtVO(); - - //epNotificationItemExtVO.setActiveYn("abc"); - epNotificationItemExtVO.setMsgHeader("test"); - epNotificationItemExtVO.setMsgDescription("test"); - epNotificationItemExtVO.setPriority(1); - epNotificationItemExtVO.setCreatorId(1); - epNotificationItemExtVO.setLoginId("test"); - - return epNotificationItemExtVO; - } - - @Test - public void epNotificationItemExtVOTest(){ - EpNotificationItemExtVO epNotificationItemExtVO = mockEpNotificationItemExtVO(); - - assertEquals(epNotificationItemExtVO.getMsgHeader(), "test"); - assertEquals(epNotificationItemExtVO.getMsgDescription(), "test"); - assertEquals(epNotificationItemExtVO.getPriority().toString(), "1"); - assertEquals(epNotificationItemExtVO.getCreatorId().toString(), "1"); - assertEquals(epNotificationItemExtVO.getLoginId(), "test"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java deleted file mode 100644 index 6e1e48c6..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EpNotificationItem; - -public class EpNotificationItemTest { - - public EpNotificationItem mockEpNotificationItem(){ - EpNotificationItem epNotificationItem = new EpNotificationItem(); - - epNotificationItem.setNotificationId((long)1); - epNotificationItem.setIsForOnlineUsers("test"); - epNotificationItem.setIsForAllRoles("test"); - epNotificationItem.setActiveYn("test"); - epNotificationItem.setMsgHeader("test"); - epNotificationItem.setMsgDescription("test"); - epNotificationItem.setMsgSource("test"); - - epNotificationItem.setPriority((long)1); - epNotificationItem.setCreatedId((long)1); - epNotificationItem.setNotificationHyperlink("test"); - - return epNotificationItem; - } - - @Test - public void epNotificationItemTest(){ - EpNotificationItem epNotificationItem = mockEpNotificationItem(); - - EpNotificationItem epNotificationItem1 = new EpNotificationItem(); - epNotificationItem1.setNotificationId((long)1); - epNotificationItem1.setIsForOnlineUsers("test"); - epNotificationItem1.setIsForAllRoles("test"); - epNotificationItem1.setActiveYn("test"); - epNotificationItem1.setMsgHeader("test"); - epNotificationItem1.setMsgDescription("test"); - epNotificationItem1.setMsgSource("test"); - - epNotificationItem1.setPriority((long)1); - epNotificationItem1.setCreatedId((long)1); - epNotificationItem1.setNotificationHyperlink("test"); - - assertEquals(epNotificationItem.getNotificationId(), new Long(1)); - assertEquals(epNotificationItem.getIsForOnlineUsers(), "test"); - assertEquals(epNotificationItem.getIsForAllRoles(), "test"); - assertEquals(epNotificationItem.getActiveYn(), "test"); - assertEquals(epNotificationItem.getMsgHeader(), "test"); - assertEquals(epNotificationItem.getMsgDescription(), "test"); - assertEquals(epNotificationItem.getMsgSource(), "test"); - assertEquals(epNotificationItem.getPriority(), new Long(1)); - assertEquals(epNotificationItem.getCreatedId(), new Long(1)); - assertEquals(epNotificationItem.getNotificationHyperlink(), "test"); - - assertEquals(epNotificationItem.toString(), "EpNotificationItem [notificationId=1, isForOnlineUsers=test, isForAllRoles=test, activeYn=test, msgHeader=test, msgDescription=test, msgSource=test, startTime=null, endTime=null, priority=1, creatorId=null, createdDate=null, roles=null, roleIds=null]"); - assertEquals(epNotificationItem.hashCode(), epNotificationItem1.hashCode()); - assertTrue(epNotificationItem.equals(epNotificationItem1)); - - } - -} - - diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java deleted file mode 100644 index 35a11833..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import java.util.Date; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EpNotificationItemVO; - -public class EpNotificationItemVOTest { - - public EpNotificationItemVO mockEpNotificationItemVO(){ - EpNotificationItemVO epNotificationItemVO = new EpNotificationItemVO(); - - epNotificationItemVO.setNotificationId(1); - epNotificationItemVO.setIsForOnlineUsers('a'); - epNotificationItemVO.setIsForAllRoles('a'); - epNotificationItemVO.setActiveYn('a'); - epNotificationItemVO.setMsgHeader("test"); - epNotificationItemVO.setMsgDescription("test"); - epNotificationItemVO.setMsgSource("test"); - epNotificationItemVO.setPriority(1); - epNotificationItemVO.setCreatorId(1); - epNotificationItemVO.setLoginId("test"); - epNotificationItemVO.setNotificationHyperlink("test"); - - return epNotificationItemVO; - } - - @Test - public void epNotificationItemVOTest(){ - EpNotificationItemVO epNotificationItemVO = mockEpNotificationItemVO(); - - assertEquals(epNotificationItemVO.getNotificationId().toString(), "1"); - /*assertEquals(epNotificationItemVO.getIsForOnlineUsers(), 'a'); - assertEquals(epNotificationItemVO.getIsForAllRoles(), 'a'); - assertEquals(epNotificationItemVO.getActiveYn(), 'a');*/ - assertEquals(epNotificationItemVO.getMsgHeader(), "test"); - assertEquals(epNotificationItemVO.getMsgDescription(), "test"); - assertEquals(epNotificationItemVO.getMsgSource(), "test"); - assertEquals(epNotificationItemVO.getPriority().toString(), "1"); - assertEquals(epNotificationItemVO.getCreatorId().toString(), "1"); - assertEquals(epNotificationItemVO.getLoginId(), "test"); - assertEquals(epNotificationItemVO.getNotificationHyperlink(), "test"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java deleted file mode 100644 index beb67ba9..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EpRoleNotificationItem; - -public class EpRoleNotificationItemTest { - - public EpRoleNotificationItem mockEpRoleNotificationItem(){ - EpRoleNotificationItem epRoleNotificationItem = new EpRoleNotificationItem(); - - epRoleNotificationItem.setId((long)1); - epRoleNotificationItem.setNotificationId((long)1); - epRoleNotificationItem.setRoleId(1); - epRoleNotificationItem.setRecvUserId(1); - - return epRoleNotificationItem; - } - - @Test - public void epRoleNotificationItemTest(){ - EpRoleNotificationItem epRoleNotificationItem = mockEpRoleNotificationItem(); - - assertEquals(epRoleNotificationItem.getId(), new Long(1)); - assertEquals(epRoleNotificationItem.getNotificationId(), new Long(1)); - assertEquals(epRoleNotificationItem.getRoleId().toString(), "1"); - assertEquals(epRoleNotificationItem.getRecvUserId().toString(), "1"); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java deleted file mode 100644 index f490973a..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessPermsDetail; - -public class ExternalAccessPermsDetailTest { - - public ExternalAccessPermsDetail mockExternalAccessPermsDetail(){ - ExternalAccessPermsDetail externalAccessPermsDetail = new ExternalAccessPermsDetail(); - - List<String> roles = new ArrayList<String>(); - - externalAccessPermsDetail.setType("test"); - externalAccessPermsDetail.setInstance("test"); - externalAccessPermsDetail.setAction("test"); - externalAccessPermsDetail.setDescription("test"); - externalAccessPermsDetail.setRoles(roles); - - return externalAccessPermsDetail; - } - - @Test - public void externalAccessPermsDetailTest(){ - ExternalAccessPermsDetail externalAccessPermsDetail = mockExternalAccessPermsDetail(); - - List<String> roles = new ArrayList<String>(); - - assertEquals(externalAccessPermsDetail.getType(), "test"); - assertEquals(externalAccessPermsDetail.getInstance(), "test"); - assertEquals(externalAccessPermsDetail.getAction(), "test"); - assertEquals(externalAccessPermsDetail.getDescription(), "test"); - assertEquals(externalAccessPermsDetail.getRoles(), roles); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java deleted file mode 100644 index dfae6042..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessPerms; - -public class ExternalAccessPermsTest { - - public ExternalAccessPerms mockExternalAccessPerms(){ - ExternalAccessPerms externalAccessPerms = new ExternalAccessPerms(); - - externalAccessPerms.setType("test"); - externalAccessPerms.setInstance("test"); - externalAccessPerms.setAction("test"); - externalAccessPerms.setDescription("test"); - - return externalAccessPerms; - } - - @Test - public void externalAccessPermsTest(){ - ExternalAccessPerms externalAccessPerms = mockExternalAccessPerms(); - - ExternalAccessPerms externalAccessPerms1 = new ExternalAccessPerms("test", "test", "test"); - ExternalAccessPerms externalAccessPerms2 = new ExternalAccessPerms("test", "test", "test", "test"); - ExternalAccessPerms externalAccessPerms3 = new ExternalAccessPerms(); - externalAccessPerms3.setType("test"); - externalAccessPerms3.setInstance("test"); - externalAccessPerms3.setAction("test"); - externalAccessPerms3.setDescription("test"); - - assertEquals(externalAccessPerms.getType(), "test"); - assertEquals(externalAccessPerms.getInstance(), "test"); - assertEquals(externalAccessPerms.getAction(), "test"); - assertEquals(externalAccessPerms.getDescription(), "test"); - assertEquals(externalAccessPerms.hashCode(), externalAccessPerms3.hashCode()); - - assertTrue(externalAccessPerms1.equals(new ExternalAccessPerms("test", "test", "test"))); - assertTrue(externalAccessPerms2.equals(new ExternalAccessPerms("test", "test", "test", "test"))); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java deleted file mode 100644 index 4e736eba..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessPerms; -import org.openecomp.portalapp.portal.transport.ExternalAccessRolePerms; - -public class ExternalAccessRolePermsTest { - - public ExternalAccessRolePerms mockExternalAccessRolePerms(){ - ExternalAccessPerms externalAccessPerms = new ExternalAccessPerms(); - externalAccessPerms.setAction("test"); - externalAccessPerms.setDescription("test"); - externalAccessPerms.setInstance("test"); - externalAccessPerms.setType("test"); - ExternalAccessRolePerms ExternalAccessRolePerms = new ExternalAccessRolePerms(externalAccessPerms, "test"); - - return ExternalAccessRolePerms; - } - - @Test - public void externalAccessRolePermsTest(){ - ExternalAccessPerms externalAccessPerms = new ExternalAccessPerms(); - externalAccessPerms.setAction("test"); - externalAccessPerms.setDescription("test"); - externalAccessPerms.setInstance("test"); - externalAccessPerms.setType("test"); - - ExternalAccessRolePerms ExternalAccessRolePerms = mockExternalAccessRolePerms(); - - assertEquals(ExternalAccessRolePerms.getRole(), "test"); - assertEquals(ExternalAccessRolePerms.getPerm(), externalAccessPerms); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java deleted file mode 100644 index 19dee193..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessRole; - -public class ExternalAccessRoleTest { - - public ExternalAccessRole mockExternalAccessRole(){ - ExternalAccessRole externalAccessRole = new ExternalAccessRole(); - - externalAccessRole.setName("test"); - externalAccessRole.setDescription("test"); - - return externalAccessRole; - } - - @Test - public void externalAccessRoleTest(){ - ExternalAccessRole externalAccessRole = mockExternalAccessRole(); - - assertEquals(externalAccessRole.getName(), "test"); - assertEquals(externalAccessRole.getDescription(), "test"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java deleted file mode 100644 index 6ffab981..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessUserRoleDetail; -import org.openecomp.portalapp.portal.transport.ExternalRoleDescription; - -public class ExternalAccessUserRoleDetailTest { - - public ExternalAccessUserRoleDetail mockExternalAccessUserRoleDetail(){ - - ExternalRoleDescription externalRoleDescription = new ExternalRoleDescription(); - externalRoleDescription.setId("test"); - externalRoleDescription.setName("test"); - externalRoleDescription.setActive("test"); - externalRoleDescription.setPriority("test"); - externalRoleDescription.setAppId("test"); - externalRoleDescription.setAppRoleId("test"); - - ExternalAccessUserRoleDetail externalAccessUserRoleDetail = new ExternalAccessUserRoleDetail("test", externalRoleDescription); - - externalAccessUserRoleDetail.setName("test"); - externalAccessUserRoleDetail.setDescription(externalRoleDescription); - return externalAccessUserRoleDetail; - } - - @Test - public void externalAccessUserRoleDetailTest(){ - ExternalAccessUserRoleDetail externalAccessUserRoleDetail = mockExternalAccessUserRoleDetail(); - - ExternalRoleDescription externalRoleDescription1 = new ExternalRoleDescription(); - externalRoleDescription1.setId("test"); - externalRoleDescription1.setName("test"); - externalRoleDescription1.setActive("test"); - externalRoleDescription1.setPriority("test"); - externalRoleDescription1.setAppId("test"); - externalRoleDescription1.setAppRoleId("test"); - - ExternalAccessUserRoleDetail externalAccessUserRoleDetail1 = new ExternalAccessUserRoleDetail("test", externalRoleDescription1); - - assertEquals(externalAccessUserRoleDetail.getName(), externalAccessUserRoleDetail1.getName()); - assertEquals(externalAccessUserRoleDetail.getDescription(), externalAccessUserRoleDetail1.getDescription()); - assertEquals(externalAccessUserRoleDetail.hashCode(), externalAccessUserRoleDetail1.hashCode()); - assertTrue(externalAccessUserRoleDetail.equals(externalAccessUserRoleDetail1)); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java deleted file mode 100644 index d2be97b1..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalAccessUser; - -public class ExternalAccessUserTest { - - public ExternalAccessUser mockExternalAccessUser(){ - ExternalAccessUser externalAccessUser = new ExternalAccessUser("test", "test"); - - return externalAccessUser; - } - - @Test - public void externalAccessUserTest(){ - ExternalAccessUser externalAccessUser = mockExternalAccessUser(); - - assertEquals(externalAccessUser.getRole(), "test"); - assertEquals(externalAccessUser.getUser(), "test"); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java deleted file mode 100644 index 5b6fe825..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.ExternalRoleDescription; - -public class ExternalRoleDescriptionTest { - - public ExternalRoleDescription mockExternalRoleDescription(){ - - ExternalRoleDescription externalRoleDescription = new ExternalRoleDescription(); - - externalRoleDescription.setId("test"); - externalRoleDescription.setName("test"); - externalRoleDescription.setActive("test"); - externalRoleDescription.setPriority("test"); - externalRoleDescription.setAppId("test"); - externalRoleDescription.setAppRoleId("test"); - - return externalRoleDescription; - } - - @Test - public void externalRoleDescriptionTest(){ - ExternalRoleDescription externalRoleDescription = mockExternalRoleDescription(); - - assertEquals(externalRoleDescription.getId(), "test"); - assertEquals(externalRoleDescription.getName(), "test"); - assertEquals(externalRoleDescription.getActive(), "test"); - assertEquals(externalRoleDescription.getPriority(), "test"); - assertEquals(externalRoleDescription.getAppId(), "test"); - assertEquals(externalRoleDescription.getAppRoleId(), "test"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java deleted file mode 100644 index 7d4b96e5..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; - -public class FunctionalMenuItemTest { - - public FunctionalMenuItem mockFunctionalMenuItem(){ - FunctionalMenuItem functionalMenuItem = new FunctionalMenuItem(); - - List<Integer> roles = new ArrayList<Integer>(); - - functionalMenuItem.setRestrictedApp(false); - functionalMenuItem.setUrl("test"); - functionalMenuItem.setRoles(roles); - - return functionalMenuItem; - } - - @Test - public void functionalMenuItemTest(){ - FunctionalMenuItem functionalMenuItem = mockFunctionalMenuItem(); - - FunctionalMenuItem functionalMenuItem1 = mockFunctionalMenuItem(); - - List<Integer> roles = new ArrayList<Integer>(); - - functionalMenuItem1.setRestrictedApp(false); - functionalMenuItem1.setUrl("test"); - functionalMenuItem1.setRoles(roles); - - assertEquals(functionalMenuItem.getRoles(), functionalMenuItem1.getRoles()); - assertEquals(functionalMenuItem.toString(), "FunctionalMenuItem [menuId=null, column=null, text=null, parentMenuId=null, url=test, active_yn=null, appid=null, roles=[], restrictedApp=false]"); - // assertTrue(functionalMenuItem.normalize(), functionalMenuItem1.normalize()); - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java deleted file mode 100644 index 09f4bc67..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; - -public class FunctionalMenuRoleTest { - - public FunctionalMenuRole mockFunctionalMenuRole(){ - FunctionalMenuRole functionalMenuRole = new FunctionalMenuRole(); - - functionalMenuRole.setId(1); - functionalMenuRole.setMenuId((long)1); - functionalMenuRole.setAppId(1); - functionalMenuRole.setRoleId(1); - - return functionalMenuRole; - } - - @Test - public void functionalMenuRoleTest(){ - FunctionalMenuRole functionalMenuRole = mockFunctionalMenuRole(); - - FunctionalMenuRole functionalMenuRole1 = new FunctionalMenuRole(); - functionalMenuRole1.setId(1); - functionalMenuRole1.setMenuId((long)1); - functionalMenuRole1.setAppId(1); - functionalMenuRole1.setRoleId(1); - - assertEquals(functionalMenuRole.getId().toString(), "1"); - assertEquals(functionalMenuRole.getMenuId(), new Long(1)); - assertEquals(functionalMenuRole.getAppId().toString(), "1"); - assertEquals(functionalMenuRole.getRoleId().toString(), "1"); - assertEquals(functionalMenuRole.toString(), "FunctionalMenuRole [id=1, menuId=1, appId=1, roleId=1]"); - assertTrue(functionalMenuRole.equals(functionalMenuRole1)); - assertEquals(functionalMenuRole.hashCode(), functionalMenuRole1.hashCode()); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java deleted file mode 100644 index ef926f6a..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.RemoteRole; -import org.openecomp.portalapp.portal.transport.RemoteUserWithRoles; - -public class RemoteUserWithRolesTest { - - public RemoteUserWithRoles mockRemoteUserWithRoles(){ - RemoteUserWithRoles remoteUserWithRoles = new RemoteUserWithRoles(); - - List<RemoteRole> roles = new ArrayList<RemoteRole>(); - RemoteRole remoteRole = new RemoteRole(); - remoteRole.setId((long)1); - remoteRole.setName("test"); - roles.add(remoteRole); - - remoteUserWithRoles.setOrgId((long)1); - remoteUserWithRoles.setManagerId((long)1); - remoteUserWithRoles.setFirstName("test"); - remoteUserWithRoles.setMiddleInitial("test"); - remoteUserWithRoles.setLastName("test"); - remoteUserWithRoles.setPhone("test"); - remoteUserWithRoles.setEmail("test"); - remoteUserWithRoles.setHrid("test"); - remoteUserWithRoles.setOrgUserId("test"); - remoteUserWithRoles.setOrgCode("test"); - remoteUserWithRoles.setOrgManagerUserId("test"); - remoteUserWithRoles.setJobTitle("test"); - remoteUserWithRoles.setLoginId("test"); - remoteUserWithRoles.setActive(false); - remoteUserWithRoles.setRoles(roles); - - return remoteUserWithRoles; - } - - @Test - public void remoteUserWithRolesTest(){ - RemoteUserWithRoles remoteUserWithRoles = mockRemoteUserWithRoles(); - - assertEquals(remoteUserWithRoles.getOrgId(), new Long(1)); - assertEquals(remoteUserWithRoles.getManagerId(), new Long(1)); - assertEquals(remoteUserWithRoles.getFirstName(), "test"); - assertEquals(remoteUserWithRoles.getMiddleInitial(), "test"); - assertEquals(remoteUserWithRoles.getLastName(), "test"); - assertEquals(remoteUserWithRoles.getPhone(), "test"); - assertEquals(remoteUserWithRoles.getEmail(), "test"); - assertEquals(remoteUserWithRoles.getHrid(), "test"); - assertEquals(remoteUserWithRoles.getOrgUserId(), "test"); - assertEquals(remoteUserWithRoles.getOrgCode(), "test"); - assertEquals(remoteUserWithRoles.getOrgManagerUserId(), "test"); - assertEquals(remoteUserWithRoles.getJobTitle(), "test"); - assertEquals(remoteUserWithRoles.getLoginId(), "test"); - assertEquals(remoteUserWithRoles.getActive(), false); - assertEquals(remoteUserWithRoles.getRoles().size(), 1); - assertEquals(remoteUserWithRoles.toString(), "RemoteUserWithRoles [orgId=1, managerId=1, firstName=test, middleInitial=test, lastName=test, phone=test, " - + "email=test, hrid=test, orgUserId=test, orgCode=test, orgManagerUserId=test, jobTitle=test, loginId=test, active=false, roles=[RemoteRole [id=1, name=test]]]"); - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java deleted file mode 100644 index 66624c2a..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.RoleInAppForUser; - -public class RoleInAppForUserTest { - - public RoleInAppForUser mockRoleInAppForUser(){ - RoleInAppForUser roleInAppForUser = new RoleInAppForUser((long)1 , "test"); - roleInAppForUser.setRoleId((long)1); - roleInAppForUser.setRoleName("test"); - roleInAppForUser.setIsApplied(false); - - return roleInAppForUser; - } - - @Test - public void roleInAppForUserTest(){ - RoleInAppForUser roleInAppForUser = mockRoleInAppForUser(); - - RoleInAppForUser roleInAppForUser1 = new RoleInAppForUser((long)1 , "test"); - roleInAppForUser1.setRoleId((long)1); - roleInAppForUser1.setRoleName("test"); - roleInAppForUser1.setIsApplied(false); - - assertEquals(roleInAppForUser.getRoleId(), new Long(1)); - assertEquals(roleInAppForUser.getRoleName(), "test"); - assertEquals(roleInAppForUser.getIsApplied(), false); - - assertEquals(roleInAppForUser.toString(), "RoleInAppForUser [roleId=1, roleName=test, isApplied=false]"); - assertTrue(roleInAppForUser.equals(roleInAppForUser1)); - assertEquals(roleInAppForUser.hashCode(), roleInAppForUser1.hashCode()); - //constructor - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java deleted file mode 100644 index 632eeb4f..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.RemoteRole; -import org.openecomp.portalapp.portal.transport.UserApplicationRoles; - -public class UserApplicationRolesTest { - - public UserApplicationRoles mockUserApplicationRoles(){ - UserApplicationRoles userApplicationRoles = new UserApplicationRoles(); - - List<RemoteRole> roles = new ArrayList<RemoteRole>(); - RemoteRole remoteRole = new RemoteRole(); - remoteRole.setId((long)1); - remoteRole.setName("test"); - roles.add(remoteRole); - - userApplicationRoles.setAppId((long)1); - userApplicationRoles.setOrgUserId("test"); - userApplicationRoles.setFirstName("test"); - userApplicationRoles.setLastName("test"); - userApplicationRoles.setRoles(roles); - - return userApplicationRoles; - } - - @Test - public void userApplicationRolesTest(){ - UserApplicationRoles userApplicationRoles = mockUserApplicationRoles(); - - UserApplicationRoles userApplicationRoles1 = new UserApplicationRoles(); - - List<RemoteRole> roles = new ArrayList<RemoteRole>(); - RemoteRole remoteRole = new RemoteRole(); - remoteRole.setId((long)1); - remoteRole.setName("test"); - roles.add(remoteRole); - - userApplicationRoles1.setAppId((long)1); - userApplicationRoles1.setOrgUserId("test"); - userApplicationRoles1.setFirstName("test"); - userApplicationRoles1.setLastName("test"); - userApplicationRoles1.setRoles(roles); - - assertEquals(userApplicationRoles.getAppId(), userApplicationRoles1.getAppId()); - assertEquals(userApplicationRoles.getOrgUserId(), userApplicationRoles1.getOrgUserId()); - assertEquals(userApplicationRoles.getFirstName(), userApplicationRoles1.getFirstName()); - assertEquals(userApplicationRoles.getLastName(), userApplicationRoles1.getLastName()); - assertEquals(userApplicationRoles.getRoles(), userApplicationRoles1.getRoles()); - - - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java deleted file mode 100644 index 7267dcde..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.UserWithNameSurnameTitle; - -public class UserWithNameSurnameTitleTest { - - @Test - public void userWithNameSurnameTitleTest(){ - - UserWithNameSurnameTitle userWithNameSurnameTitle = new UserWithNameSurnameTitle("test", "test", "test", "test"); - - assertEquals(userWithNameSurnameTitle, new UserWithNameSurnameTitle("test", "test", "test", "test")); - assertEquals(userWithNameSurnameTitle.hashCode(), new UserWithNameSurnameTitle("test", "test", "test", "test").hashCode()); - assertTrue(userWithNameSurnameTitle.equals(new UserWithNameSurnameTitle("test", "test", "test", "test"))); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java deleted file mode 100644 index 6681d0a4..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.openecomp.portalapp.portal.transport; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.transport.WidgetCatalogPersonalization; - -public class WidgetCatalogPersonalizationTest { - - public WidgetCatalogPersonalization mockWidgetCatalogPersonalization(){ - WidgetCatalogPersonalization widgetCatalogPersonalization = new WidgetCatalogPersonalization(); - - widgetCatalogPersonalization.setWidgetId((long)1); - widgetCatalogPersonalization.setSelect(false); - return widgetCatalogPersonalization; - } - - @Test - public void widgetCatalogPersonalizationTest(){ - WidgetCatalogPersonalization widgetCatalogPersonalization = mockWidgetCatalogPersonalization(); - - assertEquals(widgetCatalogPersonalization.getWidgetId(), new Long(1)); - assertEquals(widgetCatalogPersonalization.getSelect(), false); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/exceptions/NoHealthyServiceExceptionTest.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/exceptions/NoHealthyServiceExceptionTest.java deleted file mode 100644 index 33389fbc..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/exceptions/NoHealthyServiceExceptionTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.openecomp.portalapp.test.exceptions; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.portalapp.portal.exceptions.NoHealthyServiceException; - -public class NoHealthyServiceExceptionTest { - - public NoHealthyServiceException mockNoHealthyServiceException(){ - NoHealthyServiceException noHealthyServiceException = new NoHealthyServiceException("test"); - - return noHealthyServiceException; - } - - @Test - public void noHealthyServiceExceptionTest(){ - NoHealthyServiceException noHealthyServiceException = mockNoHealthyServiceException(); - - // assertEquals(noHealthyServiceException, new NoHealthyServiceException("test")); - assertEquals(noHealthyServiceException.toString(), "NoHealthyServiceException [] test"); - } -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/ApplicationCommonContextTestSuite.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/ApplicationCommonContextTestSuite.java deleted file mode 100644 index cba7c57b..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/ApplicationCommonContextTestSuite.java +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.test.framework; - -import java.io.IOException; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.openecomp.portalsdk.core.conf.AppConfig; -//import org.openecomp.portalapp.conf.ExternalAppConfig; -//import org.openecomp.portalapp.conf.HibernateMappingLocations; -import org.openecomp.portalsdk.core.conf.HibernateConfiguration; -import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable; -import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; -import org.openecomp.portalsdk.core.util.CacheManager; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.FilterType; -import org.springframework.context.annotation.Profile; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.transaction.TransactionConfiguration; -import org.springframework.test.context.web.AnnotationConfigWebContextLoader; -import org.springframework.test.context.web.WebAppConfiguration; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; - -/** - * - * In order to write a unit test, 1. inherit this class 2. place the "war" - * folder on your test class's classpath 3. run the test with the following VM - * argument; This is important because when starting the application from - * Container, the System Properties file (SystemProperties.java) can have the - * direct path but, when running from the Mock Junit container, the path should - * be prefixed with "classpath" to enable the mock container to search for the - * file in the classpath -Dcontainer.classpath="classpath:" - */ - -@SuppressWarnings("deprecation") -@RunWith(SpringJUnit4ClassRunner.class) -@WebAppConfiguration -@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { MockAppConfig.class }) -@ActiveProfiles(value = "test") -public class ApplicationCommonContextTestSuite { - - @Autowired - public WebApplicationContext wac; - - private MockMvc mockMvc; - - @Before - public void setup() { - if (mockMvc == null) { - this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); - - } - } - - public Object getBean(String name) { - return this.wac.getBean(name); - } - - public MockMvc getMockMvc() { - return mockMvc; - } - - public void setMockMvc(MockMvc mockMvc) { - this.mockMvc = mockMvc; - } - - public WebApplicationContext getWebApplicationContext() { - return wac; - } - -} - -@Configuration -@ComponentScan(basePackages = "org.openecomp", excludeFilters = { - // the following source configurations should not be scanned; instead of - // using Exclusion filter, we can use the @Profile annotation to exclude - // them - @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.LogoutController*"), - @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.SDKLoginController*"), - @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalapp.conf.ExternalAppConfig*"), - @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.*.*InitUebHandler*") }) -@Profile("test") -class MockAppConfig extends AppConfig { - - @Bean - HibernateMappingLocatable locatable() { - return new MockHibernateMappingLocations(); - } - - @Bean - HibernateConfiguration hibConfiguration() { - return new HibernateConfiguration(); - } - - @Bean - public SystemProperties systemProperties() { - return new MockSystemProperties(); - } - - @Bean - public AbstractCacheManager cacheManager() { - return new CacheManager() { - - public void configure() throws IOException { - - } - }; - } - - public String[] tileDefinitions() { - return new String[] { "classpath:/WEB-INF/fusion/defs/definitions.xml", - "classpath:/WEB-INF/defs/definitions.xml" }; - } - - public void addInterceptors(InterceptorRegistry registry) { - // registry.addInterceptor(new - // SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout()); - // registry.addInterceptor(resourceInterceptor()); - } - - public static class MockSystemProperties extends SystemProperties { - - public MockSystemProperties() { - } - - } - -} - -@Profile("test") -class MockHibernateMappingLocations implements HibernateMappingLocatable { - - public Resource[] getMappingLocations() { - return new Resource[] { new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"), - new ClassPathResource("WEB-INF/fusion/orm/EP.hbm.xml"), - new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml") }; - - } - - public String[] getPackagesToScan() { - return new String[] { "org.openecomp", "src" }; - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/MockitoTestSuite.java b/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/MockitoTestSuite.java deleted file mode 100644 index 8c5d3d21..00000000 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/test/framework/MockitoTestSuite.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalapp.test.framework; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class MockitoTestSuite { - - - public MockHttpServletRequestWrapper mockedRequest = new MockHttpServletRequestWrapper( - Mockito.mock(HttpServletRequest.class)); - public HttpServletResponse mockedResponse = Mockito.mock(HttpServletResponse.class); - - public MockHttpServletRequestWrapper getMockedRequest() { - return mockedRequest; - } - - public HttpServletResponse getMockedResponse() { - return mockedResponse; - } - - public class MockHttpServletRequestWrapper extends HttpServletRequestWrapper { - - HttpSession session = Mockito.mock(HttpSession.class); - - public MockHttpServletRequestWrapper(HttpServletRequest request) { - super(request); - - } - - @Override - public HttpSession getSession() { - - return session; - } - - @Override - public HttpSession getSession(boolean create) { - - return session; - } - - } - -} diff --git a/ecomp-portal-BE-common-test/src/main/resources/PopulateTestData.sql b/ecomp-portal-BE-common-test/src/main/resources/PopulateTestData.sql deleted file mode 100644 index 5d1977b4..00000000 --- a/ecomp-portal-BE-common-test/src/main/resources/PopulateTestData.sql +++ /dev/null @@ -1,32 +0,0 @@ ---- --- ================================================================================ --- ECOMP Portal --- ================================================================================ --- Copyright (C) 2017 AT&T Intellectual Property --- ================================================================================ --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- ================================================================================ ---- -insert into fn_user values(-1,null,null,'test',null,'test',null,null,null,null,null,null,null,'guestT',null,null,null,null,true,null,null,null,null,false,null,null,null, -null,null,null,null,null,null,null,null,null,null,null,null,null,null,null); -insert into fn_user_role values(-1,1, null,1); -insert into fn_user_role values(-1,16, null,1); -insert into fn_user_role values(-1,999, null,1); -insert into fn_user_role values(-1,1010, null,1); -insert into fn_menu_functional values(-1,3,'Network Analytics',5,'http://test.portal.onap.org:8080/welcome.htm','Y',null); -insert into fn_menu_functional_roles values(-1, 137,456, 6214); -insert into fn_menu_favorites values(-1, 141); -insert into ep_web_analytics_source values(-1,1,'test_url','test'); -INSERT INTO ep_notification (notification_ID, is_for_online_users, is_for_all_roles, active_YN, msg_header, msg_description,msg_source,start_time,end_time,priority,creator_ID,created_date) -VALUES ('-1', 'Y', 'N', 'Y', 'CISCO_1921C1_ISR_G2', '{}','aotstm','2017-03-26 12:18:55.0','2017-04-25 12:18:55.0','2',NULL,'2017-04-25 21:18:11.0'); -INSERT INTO ep_role_notification (ID,notification_ID,role_ID,recv_user_id ) VALUES (0,-1,NULL,10) diff --git a/ecomp-portal-BE-common-test/src/main/resources/RemoveTestData.sql b/ecomp-portal-BE-common-test/src/main/resources/RemoveTestData.sql deleted file mode 100644 index 5a3000a4..00000000 --- a/ecomp-portal-BE-common-test/src/main/resources/RemoveTestData.sql +++ /dev/null @@ -1,31 +0,0 @@ ---- --- ================================================================================ --- ECOMP Portal --- ================================================================================ --- Copyright (C) 2017 AT&T Intellectual Property --- ================================================================================ --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- ================================================================================ ---- -delete from fn_user_role where user_id =-1; -delete from ep_user_notification where user_id=-1; -delete from fn_audit_log where user_id=-1; -delete from fn_menu_favorites where user_id=-1 and menu_id=141; -delete from fn_user where user_id=-1; -delete from fn_menu_functional_roles where id=-1; -delete from fn_menu_functional_ancestors where menu_id=-1; -delete from fn_menu_functional where menu_id=-1; -delete from fn_menu_favorites where user_id=-1 and menu_id=141; -delete from ep_web_analytics_source where resource_id=-1; -delete from ep_role_notification where notification_ID='-1'; -delete from ep_notification where notification_ID='-1'; diff --git a/ecomp-portal-BE-common/.gitignore b/ecomp-portal-BE-common/.gitignore index 0580e087..ae81c23b 100644 --- a/ecomp-portal-BE-common/.gitignore +++ b/ecomp-portal-BE-common/.gitignore @@ -3,3 +3,5 @@ .classpath .project .settings/ +/logs +/debug-logs diff --git a/ecomp-portal-BE-common/pom.xml b/ecomp-portal-BE-common/pom.xml index 6e5e5ee0..9d349147 100644 --- a/ecomp-portal-BE-common/pom.xml +++ b/ecomp-portal-BE-common/pom.xml @@ -1,139 +1,92 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.onap.portal</groupId> + <parent> + <groupId>org.onap.portal</groupId> + <artifactId>onap-portal-parent</artifactId> + <version>1.3.0-SNAPSHOT</version> + </parent> + <artifactId>ecompportal-be-common</artifactId> <packaging>war</packaging> - <!-- Version number is managed manually; no Jenkins build.number --> - <version>1.3.0-SNAPSHOT</version> <properties> - <springframework.version>4.2.0.RELEASE</springframework.version> - <hibernate.version>4.3.11.Final</hibernate.version> - <eelf.version>1.0.0</eelf.version> - <fasterxml.version>2.7.4</fasterxml.version> - <epsdk.version>1.3.0</epsdk.version> - <encoding>UTF-8</encoding> - <!-- Tests usually require some setup that maven cannot do, so skip. --> <skipTests>false</skipTests> - <nexusproxy>https://nexus.onap.org</nexusproxy> - <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath> - <stagingNexusPath>content/repositories/staging/</stagingNexusPath> - <releaseNexusPath>/content/repositories/releases/</releaseNexusPath> </properties> - <repositories> - <repository> - <id>onap-releases</id> - <name>ONAP - Release Repository</name> - <url>${nexusproxy}/${releaseNexusPath}</url> - </repository> - <repository> - <id>onap-staging</id> - <name>ONAP - Staging Repository</name> - <url>${nexusproxy}/${stagingNexusPath}</url> - </repository> - <repository> - <id>onap-snapshots</id> - <name>ONAP - Snapshot Repository</name> - <url>${nexusproxy}/${snapshotNexusPath}</url> - </repository> - </repositories> - - <profiles> - <!-- disable doclint, a new feature in Java 8, when generating javadoc --> - <profile> - <id>doclint-java8-disable</id> - <activation> - <jdk>[1.8,)</jdk> - </activation> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <configuration> - <additionalparam>-Xdoclint:none</additionalparam> - </configuration> - </plugin> - </plugins> - </build> - </profile> - - </profiles> - <build> <!-- The war file name carries no version number --> <finalName>${project.artifactId}</finalName> <plugins> <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>0.7.6.201602180812</version> - <inherited>True</inherited> - <executions> - <!-- Unit-Tests --> - <execution> - <id>prepare-agent</id> - <goals> - <goal>prepare-agent</goal> - </goals> - <configuration> - <destFile>${sonar.jacoco.reportPath}</destFile> - </configuration> - </execution> - <execution> - <id>report</id> - <goals> - <goal>report</goal> - </goals> - <configuration> - <dataFile>${sonar.jacoco.reportPath}</dataFile> - <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory> - </configuration> - </execution> - <!-- Will see build errors while running the test cases because of dual - instrumentation --> - <execution> - <id>default-instrument</id> - <goals> - <goal>instrument</goal> - </goals> - </execution> - <execution> - <id>default-restore-instrumented-classes</id> - <goals> - <goal>restore-instrumented-classes</goal> - </goals> - </execution> - <!-- Integration Tests (Only report goal) --> - <execution> - <id>report-integration</id> - <goals> - <goal>report-integration</goal> - </goals> - <configuration> - <dataFile>${sonar.jacoco.itReportPath}</dataFile> - <outputDirectory>${project.basedir}/target/site/it-jacoco</outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.6.201602180812</version> + <inherited>True</inherited> + <executions> + <!-- Unit-Tests --> + <execution> + <id>prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + <configuration> + <skipTests>false</skipTests> + <destFile>${sonar.jacoco.reportPath}</destFile> + </configuration> + </execution> + <execution> + <id>default-instrument</id> + <goals> + <goal>instrument</goal> + </goals> + <configuration> + <skipTests>false</skipTests> + </configuration> + </execution> + <execution> + <id>default-restore-instrumented-classes</id> + <phase>test</phase> + <goals> + <goal>restore-instrumented-classes</goal> + </goals> + <configuration> + <skipTests>false</skipTests> + </configuration> + </execution> + <execution> + <id>post-unit-test</id> + <phase>test</phase> + <goals> + <goal>report</goal> + </goals> + <configuration> + <skipTests>false</skipTests> + <dataFile>${sonar.jacoco.reportPath}</dataFile> + <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory> + </configuration> + </execution> + <execution> + <id>report-integration</id> + <phase>test</phase> + <goals> + <goal>report-integration</goal> + </goals> + <configuration> + <skipTests>false</skipTests> + <dataFile>${sonar.jacoco.itReportPath}</dataFile> + <outputDirectory>${project.basedir}/target/site/it-jacoco</outputDirectory> + </configuration> + </execution> + </executions> </plugin> <!-- Generate javadoc jar; see profile for Java 8 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.3</version> + <version>3.0.0-M1</version> <executions> <execution> <id>attach-javadocs</id> @@ -170,7 +123,7 @@ <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes> </configuration> </plugin> - + <!-- No deployment step for this project --> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -275,7 +228,6 @@ </exclusion> </exclusions> </dependency> - <!-- Hibernate --> <dependency> @@ -346,11 +298,8 @@ </dependency> <!-- Oracle JDBC driver --> -<!-- <dependency> - <groupId>com.oracle</groupId> - <artifactId>ojdbc6</artifactId> - <version>11.2.0.4</version> - </dependency> --> + <!-- <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> + <version>11.2.0.4</version> </dependency> --> <!-- Apache Tiles --> <dependency> <groupId>org.apache.tiles</groupId> @@ -648,9 +597,9 @@ <version>1.8.5</version> </dependency> <dependency> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>0.7.6.201602180812</version> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.6.201602180812</version> </dependency> <dependency> @@ -680,38 +629,37 @@ <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> - <version>2.5.0</version> + <version>2.7.0</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> - <version>2.5.0</version> + <version>2.7.0</version> </dependency> - + <!-- Schedulers required Libraries --> - - <dependency> - <groupId>com.googlecode.json-simple</groupId> - <artifactId>json-simple</artifactId> - <version>1.1.1</version> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.core</groupId> - <artifactId>jersey-client</artifactId> - <version>2.23.1</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-json-provider</artifactId> - <version>2.6.3</version> - </dependency> - <dependency> - <groupId>org.glassfish.jersey.connectors</groupId> - <artifactId>jersey-jetty-connector</artifactId> - <version>2.23.1</version> - </dependency> + + <dependency> + <groupId>com.googlecode.json-simple</groupId> + <artifactId>json-simple</artifactId> + <version>1.1.1</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-client</artifactId> + <version>2.23.1</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.jaxrs</groupId> + <artifactId>jackson-jaxrs-json-provider</artifactId> + <version>2.6.3</version> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.connectors</groupId> + <artifactId>jersey-jetty-connector</artifactId> + <version>2.23.1</version> + </dependency> </dependencies> - <!-- No deployment descriptor. --> diff --git a/ecomp-portal-BE-common/src/main/java/jarutil/ExtractJar.java b/ecomp-portal-BE-common/src/main/java/jarutil/ExtractJar.java index e8f828f0..9721a904 100644 --- a/ecomp-portal-BE-common/src/main/java/jarutil/ExtractJar.java +++ b/ecomp-portal-BE-common/src/main/java/jarutil/ExtractJar.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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 jarutil; @@ -28,21 +46,16 @@ import java.io.OutputStream; import java.io.Reader; import java.io.Writer; import java.net.URL; -import java.util.ArrayList; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; public class ExtractJar { - /** - * @param args - */ - public static int bufferSize = 8192; public static String JARFILE = "raptor_upgrade.jar"; - + public static void main(String[] args) throws Exception { - if(args.length > 0 && args[0]!=null && args[0].length()>0) + if (args.length > 0 && args[0] != null && args[0].length() > 0) extractFilesFromJar(args[0]); else { System.out.println("Current Directory is taken as webapp path"); @@ -50,155 +63,151 @@ public class ExtractJar { extractFilesFromJar(currentDir); } } - - public static void readJar(File jarFile) throws Exception{ - JarInputStream in = new JarInputStream(new FileInputStream(jarFile)); - ArrayList entries = new ArrayList( ); - JarEntry je; - while((je=in.getNextJarEntry( ))!=null){ - if( je.isDirectory() == false ) { - if(je.getName().startsWith("att/raptor/config/")) { - //while((je=in.getNextJarEntry( ))!=null) { - System.out.println(je.getName() + " " + je.getTime()); - //} - - } - } - } - in.close( ); - } - - public static void extractFilesFromJar(String directory) throws IOException{ - //JarFile jar = new JarFile(jarFile); - Class clazz = ExtractJar.class; + + public static void readJar(File jarFile) throws Exception { + JarInputStream in = new JarInputStream(new FileInputStream(jarFile)); + JarEntry je; + while ((je = in.getNextJarEntry()) != null) { + if (je.isDirectory() == false) { + if (je.getName().startsWith("att/raptor/config/")) { + // while((je=in.getNextJarEntry( ))!=null) { + System.out.println(je.getName() + " " + je.getTime()); + // } + + } + } + } + in.close(); + } + + public static void extractFilesFromJar(String directory) throws IOException { + // JarFile jar = new JarFile(jarFile); + Class clazz = ExtractJar.class; String classContainer = clazz.getProtectionDomain().getCodeSource().getLocation().toString(); - //System.out.println("classContainer ---------> " + classContainer); - URL jarUrl = clazz.getProtectionDomain().getCodeSource().getLocation(); - - JarInputStream entryStream = new JarInputStream(jarUrl.openStream()); - JarEntry entry; - while(true) { - entry = entryStream.getNextJarEntry(); - if(entry == null) - break; - if(entry.getName().indexOf("jarutil") < 0) { - System.out.println(entry.getName()); - File file=new File(directory,entry.getName()); - if(entry.isDirectory()) { - if (!file.exists()) - file.mkdirs(); - } else { - // make directory (some jars don't list dirs) - File dir = new File(file.getParent()); - if (!dir.exists()) - dir.mkdirs(); - if(file.exists()) file.delete(); - // Make file - FileOutputStream fout = new FileOutputStream(file); - copy(entryStream,fout); - fout.close(); - - // touch the file. - if (entry.getTime()>=0) - file.setLastModified(entry.getTime()); - } - - } - entryStream.closeEntry(); - } - entryStream.close(); - System.out.println("************************************************"); - System.out.println("* *"); - System.out.println("* *"); - System.out.println("* RAPTOR SETUP COMPLETE. *"); - System.out.println("* *"); - System.out.println("* Thank you for upgrading. *"); - System.out.println("* *"); - System.out.println("************************************************"); - } - - - public static void copy(InputStream in, OutputStream out, long byteCount) - throws IOException { - byte buffer[] = new byte[bufferSize]; - int len=bufferSize; - if (byteCount>=0) { - while (byteCount>0) { - if (byteCount<bufferSize) - len=in.read(buffer,0,(int)byteCount); - else - len=in.read(buffer,0,bufferSize); - if (len==-1) - break; - - byteCount -= len; - out.write(buffer,0,len); - } - } else { - while (true) { - len=in.read(buffer,0,bufferSize); - if (len<0 ) - break; - out.write(buffer,0,len); - } - } - } - -/* ------------------------------------------------------------------- */ -/** Copy Reader to Writer for byteCount bytes or until EOF or exception. -*/ - public static void copy(Reader in, Writer out, long byteCount) - throws IOException { - char buffer[] = new char[bufferSize]; - int len=bufferSize; - if (byteCount>=0) { - while (byteCount>0) { - if (byteCount<bufferSize) - len=in.read(buffer,0,(int)byteCount); - else - len=in.read(buffer,0,bufferSize); - - if (len==-1) - break; - byteCount -= len; - out.write(buffer,0,len); - } - } else { - while (true) { - len=in.read(buffer,0,bufferSize); - if (len==-1) - break; - out.write(buffer,0,len); - } - } - } - - /* ------------------------------------------------------------------- */ - /** Copy Stream in to Stream out until EOF or exception. - */ - public static void copy(InputStream in, OutputStream out) - throws IOException - { - copy(in,out,-1); - } - - // Deletes all files and subdirectories under dir. - // Returns true if all deletions were successful. - // If a deletion fails, the method stops attempting to delete and returns false. - public static boolean deleteDir(File dir) { - if (dir.isDirectory()) { - String[] children = dir.list(); - for (int i=0; i<children.length; i++) { - boolean success = deleteDir(new File(dir, children[i])); - if (!success) { - return false; - } - } - } - - // The directory is now empty so delete it - return dir.delete(); - } - - + // System.out.println("classContainer ---------> " + classContainer); + URL jarUrl = clazz.getProtectionDomain().getCodeSource().getLocation(); + + JarInputStream entryStream = new JarInputStream(jarUrl.openStream()); + JarEntry entry; + while (true) { + entry = entryStream.getNextJarEntry(); + if (entry == null) + break; + if (entry.getName().indexOf("jarutil") < 0) { + System.out.println(entry.getName()); + File file = new File(directory, entry.getName()); + if (entry.isDirectory()) { + if (!file.exists()) + file.mkdirs(); + } else { + // make directory (some jars don't list dirs) + File dir = new File(file.getParent()); + if (!dir.exists()) + dir.mkdirs(); + if (file.exists()) + file.delete(); + // Make file + FileOutputStream fout = new FileOutputStream(file); + copy(entryStream, fout); + fout.close(); + + // touch the file. + if (entry.getTime() >= 0) + file.setLastModified(entry.getTime()); + } + + } + entryStream.closeEntry(); + } + entryStream.close(); + System.out.println("************************************************"); + System.out.println("* *"); + System.out.println("* *"); + System.out.println("* RAPTOR SETUP COMPLETE. *"); + System.out.println("* *"); + System.out.println("* Thank you for upgrading. *"); + System.out.println("* *"); + System.out.println("************************************************"); + } + + public static void copy(InputStream in, OutputStream out, long byteCount) throws IOException { + byte buffer[] = new byte[bufferSize]; + int len = bufferSize; + if (byteCount >= 0) { + while (byteCount > 0) { + if (byteCount < bufferSize) + len = in.read(buffer, 0, (int) byteCount); + else + len = in.read(buffer, 0, bufferSize); + if (len == -1) + break; + + byteCount -= len; + out.write(buffer, 0, len); + } + } else { + while (true) { + len = in.read(buffer, 0, bufferSize); + if (len < 0) + break; + out.write(buffer, 0, len); + } + } + } + + /* ------------------------------------------------------------------- */ + /** + * Copy Reader to Writer for byteCount bytes or until EOF or exception. + */ + public static void copy(Reader in, Writer out, long byteCount) throws IOException { + char buffer[] = new char[bufferSize]; + int len = bufferSize; + if (byteCount >= 0) { + while (byteCount > 0) { + if (byteCount < bufferSize) + len = in.read(buffer, 0, (int) byteCount); + else + len = in.read(buffer, 0, bufferSize); + + if (len == -1) + break; + byteCount -= len; + out.write(buffer, 0, len); + } + } else { + while (true) { + len = in.read(buffer, 0, bufferSize); + if (len == -1) + break; + out.write(buffer, 0, len); + } + } + } + + /* ------------------------------------------------------------------- */ + /** + * Copy Stream in to Stream out until EOF or exception. + */ + public static void copy(InputStream in, OutputStream out) throws IOException { + copy(in, out, -1); + } + + // Deletes all files and subdirectories under dir. + // Returns true if all deletions were successful. + // If a deletion fails, the method stops attempting to delete and returns false. + public static boolean deleteDir(File dir) { + if (dir.isDirectory()) { + String[] children = dir.list(); + for (int i = 0; i < children.length; i++) { + boolean success = deleteDir(new File(dir, children[i])); + if (!success) { + return false; + } + } + } + + // The directory is now empty so delete it + return dir.delete(); + } + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/EPLoginBean.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/EPLoginBean.java index 97c2fd8c..54a17fc2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/EPLoginBean.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/EPLoginBean.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.command; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/PostSearchBean.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/PostSearchBean.java index 9861554a..38aae80f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/PostSearchBean.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/command/PostSearchBean.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.command; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanup.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanup.java index d525d9bc..2c11824a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanup.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanup.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.config; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanupConfig.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanupConfig.java index 90e5ecf8..016a55e0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanupConfig.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/NotificationCleanupConfig.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.config; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/PortalCentralAccessConfiguration.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/PortalCentralAccessConfiguration.java index 4ee4be20..0b701a29 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/PortalCentralAccessConfiguration.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/PortalCentralAccessConfiguration.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.config; import org.openecomp.portalapp.portal.service.EPRoleFunctionService; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerConfig.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerConfig.java index 7d2c0503..94659d71 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerConfig.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerConfig.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.config; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerMVCConfig.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerMVCConfig.java index ff59d42a..399d5863 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerMVCConfig.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/config/SwaggerMVCConfig.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.config; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPFusionBaseController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPFusionBaseController.java index dfea5fef..fb84bf62 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPFusionBaseController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPFusionBaseController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; @@ -29,7 +47,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalapp.util.EPUserUtils; import org.openecomp.portalsdk.core.controller.FusionBaseController; import org.openecomp.portalsdk.core.domain.MenuData; @@ -42,9 +59,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Controller public abstract class EPFusionBaseController extends FusionBaseController { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPFusionBaseController.class); - + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPFusionBaseController.class); @Override public boolean isAccessible() { @@ -68,7 +84,7 @@ public abstract class EPFusionBaseController extends FusionBaseController { try { model = setMenu(menuResult); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "messages failed", e); } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedBaseController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedBaseController.java index b3bef781..0d81b50b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedBaseController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedBaseController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedRESTfulBaseController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedRESTfulBaseController.java index 7b1be46c..af88055b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedRESTfulBaseController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPRestrictedRESTfulBaseController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPUnRestrictedBaseController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPUnRestrictedBaseController.java index f16c1b94..f6ba65c9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPUnRestrictedBaseController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/EPUnRestrictedBaseController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/sessionmgt/SessionCommunicationController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/sessionmgt/SessionCommunicationController.java index eda094b5..4ce72b0b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/sessionmgt/SessionCommunicationController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/controller/sessionmgt/SessionCommunicationController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller.sessionmgt; @@ -44,7 +62,7 @@ import io.swagger.annotations.ApiOperation; @EnableAspectJAutoProxy @EPAuditLog public class SessionCommunicationController extends EPRestrictedRESTfulBaseController { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SessionCommunicationController.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SessionCommunicationController.class); @Autowired private ManageService manageService; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemRoleApproval.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemRoleApproval.java index 72d67379..9309dbe5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemRoleApproval.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemRoleApproval.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.externalsystemapproval.model; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemUser.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemUser.java index 38787b53..660af6a4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/externalsystemapproval/model/ExternalSystemUser.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.externalsystemapproval.model; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImpl.java index 8979b3f1..1bba3c2f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/FusionLicenseManagerImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.lm; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImpl.java index 91fe7870..1cb882eb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/lm/LicenseableClassImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.lm; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/model/Result.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/model/Result.java index 21c9c450..55d55996 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/model/Result.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/model/Result.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.model; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java index 5260a47d..35390b19 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java index 7e781049..611e1bb0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java index 2c1da820..e9a1a951 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -65,7 +83,7 @@ import org.springframework.web.bind.annotation.RestController; @EnableAspectJAutoProxy @EPAuditLog public class AppsController extends EPRestrictedBaseController { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppsController.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppsController.class); @Autowired private AdminRolesService adminRolesService; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java index 00cf627e..d7295041 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java index 14ba94f2..aa8d7bfd 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -52,17 +70,21 @@ public class AuditLogController extends EPRestrictedBaseController { * Store audit log of the specified access type. * * @param request + * HttpServletRequest * @param affectedAppId + * App ID * @param type + * Access type * @param comment + * Comment */ @RequestMapping(value = "/store", method = RequestMethod.GET, produces = "application/json") public void auditLog(HttpServletRequest request, @RequestParam String affectedAppId, @RequestParam String type, @RequestParam String comment) { - logger.debug(EELFLoggerDelegate.debugLogger, "auditLog: appId {}, type {], comment {}", - affectedAppId, type, comment); + logger.debug(EELFLoggerDelegate.debugLogger, "auditLog: appId {}, type {], comment {}", affectedAppId, type, + comment); String cd_type = null; - try { + try { EPUser user = EPUserUtils.getUserSession(request); /* Check type of Activity CD */ if (type.equals("app")) { @@ -74,15 +96,15 @@ public class AuditLogController extends EPRestrictedBaseController { } else if (type.equals("leftMenu")) { cd_type = AuditLog.CD_ACTIVITY_LEFT_MENU_ACCESS; } else { - logger.error(EELFLoggerDelegate.errorLogger, "Storing auditLog failed! Activity CD type is not correct."); + logger.error(EELFLoggerDelegate.errorLogger, + "Storing auditLog failed! Activity CD type is not correct."); } /* Store the audit log only if it contains valid Activity CD */ if (cd_type != null) { AuditLog auditLog = new AuditLog(); auditLog.setActivityCode(cd_type); /* - * Check affectedAppId and comment and see if these two values are - * valid + * Check affectedAppId and comment and see if these two values are valid */ if (comment != null && !comment.equals("") && !comment.equals("undefined")) auditLog.setComments(EcompPortalUtils.truncateString(comment, PortalConstants.AUDIT_LOG_COMMENT_SIZE)); @@ -93,10 +115,10 @@ public class AuditLogController extends EPRestrictedBaseController { auditService.logActivity(auditLog, null); // Log file - MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,EPEELFLoggerAdvice.getCurrentDateTimeUTC()); - MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP,EPEELFLoggerAdvice.getCurrentDateTimeUTC()); - logger.info(EELFLoggerDelegate.auditLogger, EPLogUtil.formatAuditLogMessage("AuditLogController.auditLog", - cd_type, user.getOrgUserId(), affectedAppId, comment)); + MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + logger.info(EELFLoggerDelegate.auditLogger, EPLogUtil.formatAuditLogMessage( + "AuditLogController.auditLog", cd_type, user.getOrgUserId(), affectedAppId, comment)); MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP); MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP); } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java index 5be6614c..2d8fd182 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java index c16fa78f..6004d698 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import java.util.ArrayList; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java index 874edad0..ad0829f3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java index 7faea5d9..9d046cb4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java @@ -1,21 +1,39 @@ /* - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java index 808220c5..e1b39f38 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java index 1c22576d..aaeea44c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java index fe31066d..313ae683 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java index 1e9c83e7..5770d163 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java @@ -1,6 +1,42 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; - import java.util.ArrayList; import java.util.List; @@ -53,7 +89,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl @Autowired private AuditService auditService; - + private static final String UEBKEY = "uebkey"; private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAccessRolesController.class); @@ -61,34 +97,33 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl @Autowired private ExternalAccessRolesService externalAccessRolesService; - @ApiOperation(value = "Gets user role for an application.", response = String.class, responseContainer="List") - @RequestMapping(value = { - "/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json") - public String getUser(HttpServletRequest request, HttpServletResponse response, @PathVariable("loginId") String loginId) throws Exception { - + @ApiOperation(value = "Gets user role for an application.", response = String.class, responseContainer = "List") + @RequestMapping(value = { "/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json") + public String getUser(HttpServletRequest request, HttpServletResponse response, + @PathVariable("loginId") String loginId) throws Exception { + String answer = null; try { answer = externalAccessRolesService.getUserWithRoles(loginId, request.getHeader(UEBKEY)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getUser failed", e); } - return answer; + return answer; } - - @ApiOperation(value = "Gets roles for an application.", response = CentralRole.class, responseContainer="Json") - @RequestMapping(value = { - "/roles" }, method = RequestMethod.GET, produces = "application/json") + + @ApiOperation(value = "Gets roles for an application.", response = CentralRole.class, responseContainer = "Json") + @RequestMapping(value = { "/roles" }, method = RequestMethod.GET, produces = "application/json") public List<CentralRole> getRolesForApp(HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRolesForApp"); - List<EPApp> applicationList=new ArrayList<>(); + List<EPApp> applicationList = new ArrayList<>(); applicationList = externalAccessRolesService.getApp(request.getHeader(UEBKEY)); EPApp app = applicationList.get(0); - externalAccessRolesService.syncApplicationRolesWithEcompDB(app); + externalAccessRolesService.syncApplicationRolesWithEcompDB(app); List<CentralRole> answer = null; try { answer = externalAccessRolesService.getRolesForApp(request.getHeader(UEBKEY)); } catch (HttpClientErrorException e) { - if("Application not found".equalsIgnoreCase(e.getMessage())){ + if ("Application not found".equalsIgnoreCase(e.getMessage())) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); } response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); @@ -98,10 +133,10 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl return answer; } - @ApiOperation(value = "Gets all role functions for an application.", response = CentralRoleFunction.class, responseContainer="Json") - @RequestMapping(value = { - "/functions" }, method = RequestMethod.GET, produces = "application/json") - public List<CentralRoleFunction> getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response) throws Exception { + @ApiOperation(value = "Gets all role functions for an application.", response = CentralRoleFunction.class, responseContainer = "Json") + @RequestMapping(value = { "/functions" }, method = RequestMethod.GET, produces = "application/json") + public List<CentralRoleFunction> getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response) + throws Exception { List<CentralRoleFunction> answer = null; logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRoleFunctionsList"); try { @@ -112,12 +147,12 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } logger.debug(EELFLoggerDelegate.debugLogger, "Request completed for getRoleFunctionsList"); return answer; - } - - @ApiOperation(value = "Gets role information for an application.", response = CentralRole.class, responseContainer="Json") - @RequestMapping(value = { - "/role/{role_id}" }, method = RequestMethod.GET, produces = "application/json") - public CentralRole getRoleInfo(HttpServletRequest request, HttpServletResponse response, @PathVariable("role_id") Long roleId) throws Exception { + } + + @ApiOperation(value = "Gets role information for an application.", response = CentralRole.class, responseContainer = "Json") + @RequestMapping(value = { "/role/{role_id}" }, method = RequestMethod.GET, produces = "application/json") + public CentralRole getRoleInfo(HttpServletRequest request, HttpServletResponse response, + @PathVariable("role_id") Long roleId) throws Exception { CentralRole answer = null; logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRoleInfo"); @@ -130,7 +165,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl logger.debug(EELFLoggerDelegate.debugLogger, "Request completed for getRoleInfo"); return answer; } - + @ApiOperation(value = "Gets role information for an application provided by function code.", response = CentralRoleFunction.class, responseContainer = "Json") @RequestMapping(value = { "/function/{code}" }, method = RequestMethod.GET, produces = "application/json") public CentralRoleFunction getRoleFunction(HttpServletRequest request, HttpServletResponse response, @@ -155,40 +190,46 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl EPApp requestedApp = applicationList.get(0); Long appId = requestedApp.getId(); try { - String data = roleFunc; + String data = roleFunc; CentralRoleFunction availableRoleFunction = mapper.readValue(data, CentralRoleFunction.class); availableRoleFunction.setAppId(appId); - boolean saveOrUpdateResponse = externalAccessRolesService.saveCentralRoleFunction(availableRoleFunction, requestedApp); - if(saveOrUpdateResponse){ + boolean saveOrUpdateResponse = externalAccessRolesService.saveCentralRoleFunction(availableRoleFunction, + requestedApp); + if (saveOrUpdateResponse) { EPUser user = externalAccessRolesService.getUser(request.getHeader(LOGIN_ID)).get(0); EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0); - CentralRoleFunction function = externalAccessRolesService.getRoleFunction(availableRoleFunction.getCode(), request.getHeader(UEBKEY)); - String activityCode = (function.getCode() == null) ? EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_ADD_FUNCTION: EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_FUNCTION; + CentralRoleFunction function = externalAccessRolesService + .getRoleFunction(availableRoleFunction.getCode(), request.getHeader(UEBKEY)); + String activityCode = (function.getCode() == null) + ? EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_ADD_FUNCTION + : EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_FUNCTION; logger.info(EELFLoggerDelegate.applicationLogger, "saveRoleFunction: succeeded for app {}, function {}", app.getId(), availableRoleFunction.getCode()); AuditLog auditLog = new AuditLog(); auditLog.setUserId(user.getId()); auditLog.setActivityCode(activityCode); - auditLog.setComments(EcompPortalUtils.truncateString("saveRoleFunction role for app:"+app.getId()+" and function:'"+availableRoleFunction.getCode()+"'", PortalConstants.AUDIT_LOG_COMMENT_SIZE)); + auditLog.setComments( + EcompPortalUtils.truncateString( + "saveRoleFunction role for app:" + app.getId() + " and function:'" + + availableRoleFunction.getCode() + "'", + PortalConstants.AUDIT_LOG_COMMENT_SIZE)); auditLog.setAffectedRecordId(user.getOrgUserId()); auditService.logActivity(auditLog, null); - MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, - EPEELFLoggerAdvice.getCurrentDateTimeUTC()); - MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, - EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); EcompPortalUtils.calculateDateTimeDifferenceForLog( MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP), MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)); logger.info(EELFLoggerDelegate.auditLogger, - EPLogUtil.formatAuditLogMessage("ExternalAccessRolesController.saveRoleFunction", - activityCode, String.valueOf(user.getId()), - user.getOrgUserId(), availableRoleFunction.getCode())); + EPLogUtil.formatAuditLogMessage("ExternalAccessRolesController.saveRoleFunction", activityCode, + String.valueOf(user.getId()), user.getOrgUserId(), availableRoleFunction.getCode())); MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP); MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP); MDC.remove(SystemProperties.MDC_TIMER); - } else{ + } else { logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed"); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to saveRoleFunction for '"+availableRoleFunction.getCode()+"'", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, + "Failed to saveRoleFunction for '" + availableRoleFunction.getCode() + "'", "Failed"); } } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed", e); @@ -196,27 +237,28 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully Saved", "Success"); } - + @ApiOperation(value = "Deletes role function for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/roleFunction/{code}" }, method = RequestMethod.DELETE, produces = "application/json") - public PortalRestResponse<String> deleteRoleFunction(HttpServletRequest request, HttpServletResponse response, @PathVariable("code") String code) throws Exception { + public PortalRestResponse<String> deleteRoleFunction(HttpServletRequest request, HttpServletResponse response, + @PathVariable("code") String code) throws Exception { try { EPUser user = externalAccessRolesService.getUser(request.getHeader(LOGIN_ID)).get(0); EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0); boolean getDelFuncResponse = externalAccessRolesService.deleteCentralRoleFunction(code, app); - if(getDelFuncResponse){ + if (getDelFuncResponse) { logger.info(EELFLoggerDelegate.applicationLogger, "deleteRoleFunction: succeeded for app {}, role {}", app.getId(), code); AuditLog auditLog = new AuditLog(); auditLog.setUserId(user.getId()); auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_DELETE_FUNCTION); - auditLog.setComments(EcompPortalUtils.truncateString("Deleted function for app:"+app.getId()+" and function code:'"+code+"'", PortalConstants.AUDIT_LOG_COMMENT_SIZE)); + auditLog.setComments(EcompPortalUtils.truncateString( + "Deleted function for app:" + app.getId() + " and function code:'" + code + "'", + PortalConstants.AUDIT_LOG_COMMENT_SIZE)); auditLog.setAffectedRecordId(user.getOrgUserId()); auditService.logActivity(auditLog, null); - MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, - EPEELFLoggerAdvice.getCurrentDateTimeUTC()); - MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, - EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); EcompPortalUtils.calculateDateTimeDifferenceForLog( MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP), MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)); @@ -227,19 +269,21 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP); MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP); MDC.remove(SystemProperties.MDC_TIMER); - } else{ + } else { logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction failed"); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to deleteRoleFunction for '"+code+"'", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, + "Failed to deleteRoleFunction for '" + code + "'", "Failed"); } } catch (HttpClientErrorException e) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction failed", e); - return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Failed to deleteRoleFunction for '"+code+"'", "Failed"); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, + "Failed to deleteRoleFunction for '" + code + "'", "Failed"); } return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Successfully Deleted", "Success"); - } - + } + @ApiOperation(value = "Saves role for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/role" }, method = RequestMethod.POST, produces = "application/json") public PortalRestResponse<String> saveRole(HttpServletRequest request, HttpServletResponse response, @@ -256,7 +300,9 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl AuditLog auditLog = new AuditLog(); auditLog.setUserId(user.getId()); auditLog.setActivityCode(activityCode); - auditLog.setComments(EcompPortalUtils.truncateString("saveRole role for app:" + app.getId() + " and role:'" + role.getName()+"'", PortalConstants.AUDIT_LOG_COMMENT_SIZE)); + auditLog.setComments(EcompPortalUtils.truncateString( + "saveRole role for app:" + app.getId() + " and role:'" + role.getName() + "'", + PortalConstants.AUDIT_LOG_COMMENT_SIZE)); auditLog.setAffectedRecordId(user.getOrgUserId()); auditService.logActivity(auditLog, null); MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); @@ -272,7 +318,8 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl MDC.remove(SystemProperties.MDC_TIMER); } else { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Failed to saveRole for '"+role.getName()+"'", "Failed"); + return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, + "Failed to saveRole for '" + role.getName() + "'", "Failed"); } } catch (Exception e) { @@ -282,14 +329,15 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully Saved", "Success"); } - + @ApiOperation(value = "Deletes role for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/deleteRole/{code}" }, method = RequestMethod.DELETE, produces = "application/json") - public PortalRestResponse<String> deleteRole(HttpServletRequest request, HttpServletResponse response, + public PortalRestResponse<String> deleteRole(HttpServletRequest request, HttpServletResponse response, @PathVariable String code) throws Exception { try { - boolean deleteResponse = externalAccessRolesService.deleteRoleForApplication(code, request.getHeader(UEBKEY)); - if(deleteResponse){ + boolean deleteResponse = externalAccessRolesService.deleteRoleForApplication(code, + request.getHeader(UEBKEY)); + if (deleteResponse) { EPUser user = externalAccessRolesService.getUser(request.getHeader(LOGIN_ID)).get(0); EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0); logger.info(EELFLoggerDelegate.applicationLogger, "deleteRole: succeeded for app {}, role {}", @@ -297,13 +345,13 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl AuditLog auditLog = new AuditLog(); auditLog.setUserId(user.getId()); auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_DELETE_ROLE); - auditLog.setComments(EcompPortalUtils.truncateString("Deleted role for app:"+app.getId()+" and role:'"+code+"'", PortalConstants.AUDIT_LOG_COMMENT_SIZE)); + auditLog.setComments(EcompPortalUtils.truncateString( + "Deleted role for app:" + app.getId() + " and role:'" + code + "'", + PortalConstants.AUDIT_LOG_COMMENT_SIZE)); auditLog.setAffectedRecordId(user.getOrgUserId()); auditService.logActivity(auditLog, null); - MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, - EPEELFLoggerAdvice.getCurrentDateTimeUTC()); - MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, - EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); + MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC()); EcompPortalUtils.calculateDateTimeDifferenceForLog( MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP), MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP)); @@ -314,9 +362,10 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP); MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP); MDC.remove(SystemProperties.MDC_TIMER); - } else{ + } else { logger.error(EELFLoggerDelegate.errorLogger, "deleteRole failed"); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to deleteRole for '"+code+"'", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, + "Failed to deleteRole for '" + code + "'", "Failed"); } } catch (Exception e) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); @@ -326,10 +375,10 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully Deleted", "Success"); } - + @ApiOperation(value = "Gets active roles for an application.", response = CentralRole.class, responseContainer = "Json") @RequestMapping(value = { "/activeRoles" }, method = RequestMethod.GET, produces = "application/json") - public List<CentralRole> getActiveRoles(HttpServletRequest request, HttpServletResponse response) throws Exception { + public List<CentralRole> getActiveRoles(HttpServletRequest request, HttpServletResponse response) throws Exception { List<CentralRole> cenRole = null; try { cenRole = externalAccessRolesService.getActiveRoles(request.getHeader(UEBKEY)); @@ -338,13 +387,14 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl logger.error(EELFLoggerDelegate.errorLogger, "getActiveRoles failed", e); } return cenRole; - + } - + @ApiOperation(value = "deletes user roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/deleteDependcyRoleRecord/{roleId}" }, method = RequestMethod.DELETE, produces = "application/json") - public PortalRestResponse<String> deleteDependencyRoleRecord(HttpServletRequest request, HttpServletResponse response, - @PathVariable("roleId") Long roleId) throws Exception { + @RequestMapping(value = { + "/deleteDependcyRoleRecord/{roleId}" }, method = RequestMethod.DELETE, produces = "application/json") + public PortalRestResponse<String> deleteDependencyRoleRecord(HttpServletRequest request, + HttpServletResponse response, @PathVariable("roleId") Long roleId) throws Exception { try { boolean deleteResponse = externalAccessRolesService.deleteDependencyRoleRecord(roleId, request.getHeader(UEBKEY), request.getHeader(LOGIN_ID)); @@ -361,24 +411,27 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Successfully Deleted", "Success"); } - + @ApiOperation(value = "Bulk upload functions for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/upload/portal/functions" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception { + public PortalRestResponse<String> bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response) + throws Exception { Integer result = 0; try { result = externalAccessRolesService.bulkUploadFunctions(request.getHeader(UEBKEY)); } catch (HttpClientErrorException e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", + "Failed"); } - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success"); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success"); } - + @ApiOperation(value = "Bulk upload roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/upload/portal/roles" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadRoles(HttpServletRequest request, HttpServletResponse response) throws Exception { + public PortalRestResponse<String> bulkUploadRoles(HttpServletRequest request, HttpServletResponse response) + throws Exception { Integer result = 0; try { result = externalAccessRolesService.bulkUploadRoles(request.getHeader(UEBKEY)); @@ -387,53 +440,61 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles failed", e); return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadRoles", "Failed"); } - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success"); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success"); } - + @ApiOperation(value = "Bulk upload role functions for an application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/upload/portal/roleFunctions" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception { + @RequestMapping(value = { + "/upload/portal/roleFunctions" }, method = RequestMethod.POST, produces = "application/json") + public PortalRestResponse<String> bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response) + throws Exception { Integer result = 0; try { result = externalAccessRolesService.bulkUploadRolesFunctions(request.getHeader(UEBKEY)); } catch (HttpClientErrorException e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoleFunctions failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadRoleFunctions", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadRoleFunctions", + "Failed"); } - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success"); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success"); } - + @ApiOperation(value = "Bulk upload user roles for an application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/upload/portal/userRoles" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response) throws Exception { + public PortalRestResponse<String> bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response) + throws Exception { Integer result = 0; try { result = externalAccessRolesService.bulkUploadUserRoles(request.getHeader(UEBKEY)); } catch (HttpClientErrorException e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadUserRoles failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadUserRoles", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadUserRoles", + "Failed"); } - return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success"); + return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success"); } - + @ApiOperation(value = "Bulk upload functions for an partner application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/upload/partner/functions" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request, HttpServletResponse response, @RequestBody List<RoleFunction> upload) throws Exception { + public PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request, + HttpServletResponse response, @RequestBody List<RoleFunction> upload) throws Exception { try { externalAccessRolesService.bulkUploadPartnerFunctions(request.getHeader(UEBKEY), upload); } catch (HttpClientErrorException e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", + "Failed"); } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success"); } - + @ApiOperation(value = "Bulk upload roles for an partner application.", response = PortalRestResponse.class, responseContainer = "Json") @RequestMapping(value = { "/upload/partner/roles" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Role> upload) throws Exception { + public PortalRestResponse<String> bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response, + @RequestBody List<Role> upload) throws Exception { try { externalAccessRolesService.bulkUploadPartnerRoles(request.getHeader(UEBKEY), upload); } catch (HttpClientErrorException e) { @@ -443,23 +504,26 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success"); } - + @ApiOperation(value = "Bulk upload role functions for an partner application.", response = PortalRestResponse.class, responseContainer = "Json") - @RequestMapping(value = { "/upload/partner/roleFunctions" }, method = RequestMethod.POST, produces = "application/json") - public PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Role> upload) throws Exception { + @RequestMapping(value = { + "/upload/partner/roleFunctions" }, method = RequestMethod.POST, produces = "application/json") + public PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request, + HttpServletResponse response, @RequestBody List<Role> upload) throws Exception { try { externalAccessRolesService.bulkUploadPartnerRoleFunctions(request.getHeader(UEBKEY), upload); } catch (HttpClientErrorException e) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles failed", e); - return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadPartnerRoleFunctions", "Failed"); + return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, + "Failed to bulkUploadPartnerRoleFunctions", "Failed"); } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success"); } - + @ApiOperation(value = "Gets all functions along with global functions", response = List.class, responseContainer = "Json") @RequestMapping(value = { "/menuFunctions" }, method = RequestMethod.GET, produces = "application/json") - public List<String> getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception { + public List<String> getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception { List<String> functionsList = null; try { functionsList = externalAccessRolesService.getMenuFunctionsList(request.getHeader(UEBKEY)); @@ -469,15 +533,15 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl } return functionsList; } - - + @ApiOperation(value = "Gets all active Users of application", response = String.class, responseContainer = "Json") @RequestMapping(value = { "/users" }, method = RequestMethod.GET, produces = "application/json") - public List<EcompUser> getUsersOfApplication(HttpServletRequest request, HttpServletResponse response) throws Exception { + public List<EcompUser> getUsersOfApplication(HttpServletRequest request, HttpServletResponse response) + throws Exception { List<EcompUser> users = null; try { users = externalAccessRolesService.getAllAppUsers(request.getHeader(UEBKEY)); - } catch (Exception e) { + } catch (Exception e) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); logger.error(EELFLoggerDelegate.errorLogger, "getUsersOfApplication failed", e); throw new Exception(e.getMessage()); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java index ac1b9254..c30b41a7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java index 21a6e8ef..5243cad3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -102,8 +120,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { functionalMenuService.assignHelpURLs(menuItems); EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/functionalMenu", "result =", menuItems); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while calling functionalMenu. Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getMenuItems failed", e); } return menuItems; } @@ -132,9 +149,9 @@ public class FunctionalMenuController extends EPRestrictedBaseController { } /** - * RESTful service method to fetch all the FunctionalMenuItems, both active - * and inactive, for the EditFunctionalMenu feature. Can only be accessed by - * the portal admin. + * RESTful service method to fetch all the FunctionalMenuItems, both active and + * inactive, for the EditFunctionalMenu feature. Can only be accessed by the + * portal admin. * * @param request * HttpServletRequest @@ -157,16 +174,14 @@ public class FunctionalMenuController extends EPRestrictedBaseController { EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/functionalMenuForEditing", "result =", menuItems); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while calling functionalMenuForEditing. Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getMenuItemsForEditing failed", e); } return menuItems; } /** - * RESTful service method to fetch all the FunctionalMenuItems, active , for - * the Functional menu in notification Tree feature. + * RESTful service method to fetch all the FunctionalMenuItems, active , for the + * Functional menu in notification Tree feature. * * @param request * HttpServletRequest @@ -186,21 +201,17 @@ public class FunctionalMenuController extends EPRestrictedBaseController { EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/functionalMenuForNotificationTree", "result =", menuItems); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while calling functionalMenuForNotifications. Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getMenuItemsForNotifications failed", e); } return menuItems; } /** - * RESTful service method to fetch all FunctionalMenuItems associated with - * an application. + * RESTful service method to fetch all FunctionalMenuItems associated with an + * application. * * @param request * HttpServletRequest - * @param response - * HttpServletResponse * @param appId * application ID * @return List of FunctionalMenuItem objects @@ -217,16 +228,14 @@ public class FunctionalMenuController extends EPRestrictedBaseController { EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/functionalMenuForApp/" + appId, "result =", menuItems); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while calling functionalMenuForApp. Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getMenuItemsForApp failed", e); } return menuItems; } /** - * RESTful service method to fetch all FunctionalMenuItems associated with - * the applications and roles that a user has access to. + * RESTful service method to fetch all FunctionalMenuItems associated with the + * applications and roles that a user has access to. * * @param request * HttpServletRequest @@ -246,17 +255,15 @@ public class FunctionalMenuController extends EPRestrictedBaseController { EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/functionalMenuForUser/" + orgUserId, "result =", menuItems); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while calling functionalMenuForUser. Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getMenuItemsForUser failed", e); } return menuItems; } /** - * RESTful service method to fetch all FunctionalMenuItems associated with - * the applications and roles that the authenticated user has access to. + * RESTful service method to fetch all FunctionalMenuItems associated with the + * applications and roles that the authenticated user has access to. * * @param request * HttpServletRequest @@ -284,9 +291,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { } functionalMenuService.assignHelpURLs(menuItems); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while calling getMenuItemsForAuthUser. Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getMenuItemsForAuthUser failed", e); } return menuItems; } @@ -320,9 +325,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { "result =", menuItem); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while calling functionalMenuItemDetails. Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getFunctionalMenuItemDetails failed", e); } return menuItem; @@ -471,8 +474,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController { } /** - * RESTful service to get favorites for the current user as identified in - * the session + * RESTful service to get favorites for the current user as identified in the + * session * * @param request * HttpServletRequest @@ -523,8 +526,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController { * user ID, email and last-login. (Actually has nothing to do with the real * functional menu.) First attempts to get the information from the Tomcat * session (i.e., the CSP cookie); if that fails, calls the shared context - * service to read the information from the database. Gives back what it - * found, any of which may be null, as a JSON collection. + * service to read the information from the database. Gives back what it found, + * any of which may be null, as a JSON collection. * * @param request * HttpServletRequest diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java index 7856dc43..71f745a9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -47,10 +65,10 @@ import org.openecomp.portalapp.util.EPUserUtils; @EPAuditLog public class GetAccessController extends EPUnRestrictedBaseController { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(GetAccessController.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(GetAccessController.class); @Autowired - GetAccessService getAccessService; + private GetAccessService getAccessService; /** * Sorts the list by ECOMP function name. diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java index ee5e5eea..ddb3a315 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -52,6 +70,8 @@ import com.google.gson.Gson; @EPAuditLog public class HealthCheckController extends EPUnRestrictedBaseController { + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HealthCheckController.class); + private class HealthStatus { public int statusCode; @SuppressWarnings("unused") @@ -97,8 +117,6 @@ public class HealthCheckController extends EPUnRestrictedBaseController { private final String statusDown = "DOWN"; private final String statusOk = "OK"; - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HealthCheckController.class); - @RequestMapping(value = { "/portalApi/healthCheck" }, method = RequestMethod.GET, produces = "application/json") public HealthStatus healthCheck(HttpServletRequest request, HttpServletResponse response) { HealthStatus healthStatus = new HealthStatus(500, ""); @@ -187,9 +205,7 @@ public class HealthCheckController extends EPUnRestrictedBaseController { } MDC.put(EPCommonSystemProperties.RESPONSE_CODE, Integer.toString(healthStatus.statusCode)); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while performing the healthcheck. Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "healthCheck failed", e); } EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/healthCheck", "GET result =", response.getStatus()); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java index 7b4d51f5..a40c3dc0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -55,12 +73,13 @@ public class ManifestController extends RestrictedBaseController { private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ManifestController.class); @Autowired - ManifestService manifestService; + private ManifestService manifestService; /** * Gets the webapp manifest contents as a JSON object. * * @param request + * HttpServletRequest * @return A map of key-value pairs. On success: * * <pre> diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java index 42a62b5f..44e3223e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java index 6313822a..8655deb0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -38,21 +56,19 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.HttpClientErrorException; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -@SuppressWarnings("unchecked") @RestController @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy @EPAuditLog public class MicroserviceProxyController extends EPUnRestrictedBaseController { + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MicroserviceProxyController.class); + @Autowired private MicroserviceProxyService microserviceProxyService; - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MicroserviceProxyController.class); - @RequestMapping(value = { "/portalApi/microservice/proxy/{serviceId}" }, method = { RequestMethod.GET }, produces = "application/json") public String getMicroserviceProxy(HttpServletRequest request, HttpServletResponse response, @@ -92,6 +108,7 @@ public class MicroserviceProxyController extends EPUnRestrictedBaseController { mapper.readTree(response); return true; } catch (IOException e) { + logger.debug(EELFLoggerDelegate.debugLogger, "isValidJSON failed", e); return false; } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java index 5f691d2d..2fb5e9ad 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java @@ -1,24 +1,42 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.controller; +package org.openecomp.portalapp.portal.controller; import java.util.UUID; @@ -37,11 +55,6 @@ import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.util.SystemProperties; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; -/*import org.openecomp.vid.policy.PolicyProperties; -import org.openecomp.vid.policy.PolicyResponseWrapper; -import org.openecomp.vid.policy.PolicyRestInterfaceFactory; -import org.openecomp.vid.policy.PolicyRestInterfaceIfc; -import org.openecomp.vid.policy.PolicyUtil;*/ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; @@ -49,8 +62,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; - - /** * Controller to handle Policy requests. */ @@ -60,46 +71,51 @@ import org.springframework.web.bind.annotation.RestController; @Configuration @EnableAspectJAutoProxy @EPAuditLog -public class PolicyController implements BasicAuthenticationController{ - +public class PolicyController implements BasicAuthenticationController { + /** The logger. */ - static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyController.class); - - @RequestMapping(value="/get_policy",method = RequestMethod.POST) - public ResponseEntity<String> getPolicyInfo( HttpServletRequest request, @RequestBody JSONObject policy_request) throws Exception { - - logger.debug(EELFLoggerDelegate.debugLogger, "#####################POLICY API CALL STARTED ###############"+ PolicyProperties.POLICY_GET_CONFIG_VAL); - logger.debug(EELFLoggerDelegate.debugLogger, "#####################Policy Request ###############"+policy_request.toString()); + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyController.class); + + @RequestMapping(value = "/get_policy", method = RequestMethod.POST) + public ResponseEntity<String> getPolicyInfo(HttpServletRequest request, @RequestBody JSONObject policy_request) + throws Exception { + + logger.debug(EELFLoggerDelegate.debugLogger, "#####################POLICY API CALL STARTED ###############" + + PolicyProperties.POLICY_GET_CONFIG_VAL); + logger.debug(EELFLoggerDelegate.debugLogger, + "#####################Policy Request ###############" + policy_request.toString()); String path = SystemProperties.getProperty(PolicyProperties.POLICY_GET_CONFIG_VAL); - PolicyResponseWrapper policyResWrapper = getPolicyConfig(policy_request,path); - - logger.debug(EELFLoggerDelegate.debugLogger, "$$$$$$$$$$$$$$$$$$$$$$ " + new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.OK).toString()); + PolicyResponseWrapper policyResWrapper = getPolicyConfig(policy_request, path); + + logger.debug(EELFLoggerDelegate.debugLogger, "$$$$$$$$$$$$$$$$$$$$$$ " + + new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.OK).toString()); - return ( new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.valueOf(policyResWrapper.getStatus())) ); + return (new ResponseEntity<String>(policyResWrapper.getResponse(), + HttpStatus.valueOf(policyResWrapper.getStatus()))); } - + protected static PolicyResponseWrapper getPolicyConfig(JSONObject request, String path) throws Exception { String methodName = "getPolicyConfig"; String uuid = UUID.randomUUID().toString(); - logger.debug(EELFLoggerDelegate.debugLogger, "starting getPolicyConfig "); + logger.debug(EELFLoggerDelegate.debugLogger, "starting getPolicyConfig "); try { - //STARTING REST API CALL AS AN FACTORY INSTACE - PolicyRestInterfaceIfc policyRestController = PolicyRestInterfaceFactory.getInstance(); - + // STARTING REST API CALL AS AN FACTORY INSTACE + PolicyRestInterfaceIfc policyRestController = PolicyRestInterfaceFactory.getInstance(); + RestObject<String> restObjStr = new RestObject<String>(); String str = new String(); restObjStr.set(str); - policyRestController.<String>Post(str, request, uuid, path, restObjStr ); - PolicyResponseWrapper policyRespWrapper = PolicyUtil.wrapResponse (restObjStr); + policyRestController.<String>Post(str, request, uuid, path, restObjStr); + PolicyResponseWrapper policyRespWrapper = PolicyUtil.wrapResponse(restObjStr); logger.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + " w=" + policyRespWrapper.getResponse()); return policyRespWrapper; - } catch (Exception e) { - logger.debug(EELFLoggerDelegate.debugLogger, "EXCEPTION in getPolicyConfig <== " + "." + methodName + e.toString()); + } catch (Exception e) { + logger.debug(EELFLoggerDelegate.debugLogger, + "EXCEPTION in getPolicyConfig <== " + "." + methodName + e.toString()); throw e; } } } - diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java index 7bb6c45d..29c3aed4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -24,19 +42,6 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import org.openecomp.portalsdk.core.domain.AuditLog; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.AuditService; -import org.openecomp.portalsdk.core.util.SystemProperties; import org.openecomp.portalapp.controller.EPRestrictedBaseController; import org.openecomp.portalapp.portal.domain.EPRole; import org.openecomp.portalapp.portal.domain.EPUser; @@ -51,6 +56,18 @@ import org.openecomp.portalapp.portal.transport.PortalAdmin; import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalapp.util.EPUserUtils; +import org.openecomp.portalsdk.core.domain.AuditLog; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.AuditService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; @RestController @org.springframework.context.annotation.Configuration @@ -89,8 +106,11 @@ public class PortalAdminController extends EPRestrictedBaseController { /** * RESTful service method to create a new portal admin. Requirement: you * must be the Ecomp portal super admin user. + * @param request + * @param userId + * @param response + * @return FieldsValidator */ - @RequestMapping(value = { "/portalApi/portalAdmin" }, method = RequestMethod.POST) public FieldsValidator createPortalAdmin(HttpServletRequest request, @RequestBody String userId, HttpServletResponse response) { @@ -201,9 +221,7 @@ public class PortalAdminController extends EPRestrictedBaseController { rolesByApp = adminRolesService.getRolesByApp(user, appId); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while performing getRolesByApp operation, Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getRolesByApp failed", e); } return rolesByApp; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java index 02f237d7..7c4a4e8d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java index 3dba301a..c9abc3b0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java index 54e95ae0..c2d54c6b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java index 08a0d49b..352912aa 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java index 7a5196ca..76154c6a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java index 4cf7ca63..0db19e1c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java index 24b698e8..3b5ba0c7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java index c5cd5c90..b907909e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -416,9 +434,7 @@ public class UserRolesController extends EPRestrictedBaseController { List<UserApplicationRoles> appUsers = userRolesService.getUsersFromAppEndpoint(appId); return appUsers; } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while performing UserRolesController.getUsersFromAppEndpoint. Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getUsersFromAppEndpoint failed", e); return new ArrayList<UserApplicationRoles>(); } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java index 44a5dcdf..23b0e49e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java index 84150b54..229ef1f3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -44,7 +62,6 @@ import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; import org.openecomp.portalapp.portal.service.ConsulHealthService; import org.openecomp.portalapp.portal.service.MicroserviceService; import org.openecomp.portalapp.portal.service.WidgetParameterService; -import org.openecomp.portalapp.portal.utils.CustomLoggingFilter; import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalapp.util.EPUserUtils; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -78,9 +95,13 @@ import org.springframework.web.multipart.commons.CommonsMultipartResolver; @EPAuditLog public class WidgetsCatalogController extends EPRestrictedBaseController { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogController.class); - RestTemplate template = new RestTemplate(); - String whatService = "widgets-service"; + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogController.class); + + private static final String MS_WIDGET_LOCAL_PORT = "microservices.widget.local.port"; + + private RestTemplate template = new RestTemplate(); + + private String whatService = "widgets-service"; @Autowired private ConsulHealthService consulHealthService; @@ -99,26 +120,24 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { static { // for localhost testing only javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() { - public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) { - if (hostname.equals("localhost")) { + if ("localhost".equals(hostname)) return true; - } return false; } - }); + }); } @RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{loginName}" }, method = RequestMethod.GET) - public List<WidgetCatalog> getUserWidgetCatalog(HttpServletRequest request, HttpServletResponse response, - @PathVariable("loginName") String loginName) throws RestClientException, Exception { + public List<WidgetCatalog> getUserWidgetCatalog(@PathVariable("loginName") String loginName) { List<WidgetCatalog> widgets = new ArrayList<>(); - try {CustomLoggingFilter d; - ResponseEntity<ArrayList> ans = template.exchange( - EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) + try { + ResponseEntity<List> ans = template.exchange( + EcompPortalUtils.widgetMsProtocol() + "://" + + consulHealthService.getServiceLocation(whatService, + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + "/widget/microservices/widgetCatalog/" + loginName, - HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class); + HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), List.class); widgets = ans.getBody(); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getUserWidgetCatalog failed", e); @@ -130,17 +149,15 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { } @RequestMapping(value = { "/portalApi/microservices/widgetCatalog" }, method = RequestMethod.GET) - public List<WidgetCatalog> getWidgetCatalog(HttpServletRequest request, HttpServletResponse response) - throws RestClientException, Exception { + public List<WidgetCatalog> getWidgetCatalog() { List<WidgetCatalog> widgets = new ArrayList<>(); - - String p = EcompPortalUtils.widgetMsProtocol(); try { - ResponseEntity<ArrayList> ans = template.exchange( - EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) + ResponseEntity<List> ans = template.exchange( + EcompPortalUtils.widgetMsProtocol() + "://" + + consulHealthService.getServiceLocation(whatService, + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + "/widget/microservices/widgetCatalog", - HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class); + HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), List.class); widgets = ans.getBody(); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getWidgetCatalog failed", e); @@ -153,52 +170,55 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { @RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.PUT, produces = "application/json") - public void updateWidgetCatalog(HttpServletRequest request, HttpServletResponse response, - @RequestBody WidgetCatalog newWidgetCatalog, @PathVariable("widgetId") long widgetId) - throws RestClientException, Exception { + public void updateWidgetCatalog(@RequestBody WidgetCatalog newWidgetCatalog, @PathVariable("widgetId") long widgetId) throws Exception { template.exchange( - EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) + EcompPortalUtils.widgetMsProtocol() + "://" + + consulHealthService.getServiceLocation(whatService, + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + "/widget/microservices/widgetCatalog/" + widgetId, - HttpMethod.PUT, new HttpEntity(newWidgetCatalog, WidgetServiceHeaders.getInstance()), String.class); + HttpMethod.PUT, new HttpEntity<>(newWidgetCatalog, WidgetServiceHeaders.getInstance()), String.class); } @RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.DELETE) - public void deleteOnboardingWidget(HttpServletRequest request, HttpServletResponse response, - @PathVariable("widgetId") long widgetId) throws RestClientException, Exception { + public void deleteOnboardingWidget(@PathVariable("widgetId") long widgetId) throws Exception { template.exchange( - EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) + EcompPortalUtils.widgetMsProtocol() + "://" + + consulHealthService.getServiceLocation(whatService, + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + "/widget/microservices/widgetCatalog/" + widgetId, - HttpMethod.DELETE, new HttpEntity(WidgetServiceHeaders.getInstance()), String.class); + HttpMethod.DELETE, new HttpEntity<>(WidgetServiceHeaders.getInstance()), String.class); } @RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.POST) - public String updateWidgetCatalogWithFiles(HttpServletRequest request, HttpServletResponse response, + public String updateWidgetCatalogWithFiles(HttpServletRequest request, @PathVariable("widgetId") long widgetId) throws RestClientException, Exception { MultipartHttpServletRequest mRequest; MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>(); String fileName; - String tmp_folder = "/tmp/"; + String tmpFolderName = "/tmp/"; String respond = null; FileOutputStream fo = null; try { mRequest = (MultipartHttpServletRequest) request; MultipartFile mFile = mRequest.getFile("file"); fileName = mFile.getOriginalFilename(); - fo = new FileOutputStream(tmp_folder + fileName); + fo = new FileOutputStream(tmpFolderName + fileName); fo.write(mFile.getBytes()); + // silence sonar scan by calling close here + fo.close(); + fo = null; HttpHeaders header = new HttpHeaders(); header.setContentType(MediaType.MULTIPART_FORM_DATA); - multipartRequest.add("file", new FileSystemResource(tmp_folder + fileName)); + multipartRequest.add("file", new FileSystemResource(tmpFolderName + fileName)); multipartRequest.add("widget", request.getParameter("newWidget")); respond = template.postForObject( - EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) + EcompPortalUtils.widgetMsProtocol() + "://" + + consulHealthService.getServiceLocation(whatService, + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + "/widget/microservices/widgetCatalog/" + widgetId, new HttpEntity<>(multipartRequest, WidgetServiceHeaders.getInstance()), String.class); - File f = new File(tmp_folder + fileName); + File f = new File(tmpFolderName + fileName); f.delete(); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "updateWidgetCatalogWithFiles failed", e); @@ -214,32 +234,36 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { } @RequestMapping(value = { "/portalApi/microservices/widgetCatalog" }, method = RequestMethod.POST) - public String createWidgetCatalog(HttpServletRequest request, HttpServletResponse response) - throws RestClientException, Exception { + public String createWidgetCatalog(HttpServletRequest request) + throws Exception { MultipartHttpServletRequest mRequest; MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>(); String fileName; - String tmp_folder = "/tmp/"; + String tmpFolderName = "/tmp/"; String respond = null; FileOutputStream fo = null; try { mRequest = (MultipartHttpServletRequest) request; MultipartFile mFile = mRequest.getFile("file"); fileName = mFile.getOriginalFilename(); - fo = new FileOutputStream(tmp_folder + fileName); + fo = new FileOutputStream(tmpFolderName + fileName); fo.write(mFile.getBytes()); + // silence sonar scan by calling close here + fo.close(); + fo = null; HttpHeaders header = new HttpHeaders(); header.setContentType(MediaType.MULTIPART_FORM_DATA); - multipartRequest.add("file", new FileSystemResource(tmp_folder + fileName)); + multipartRequest.add("file", new FileSystemResource(tmpFolderName + fileName)); multipartRequest.add("widget", request.getParameter("newWidget")); respond = template.postForObject( - EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) + EcompPortalUtils.widgetMsProtocol() + "://" + + consulHealthService.getServiceLocation(whatService, + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + "/widget/microservices/widgetCatalog", new HttpEntity<>(multipartRequest, WidgetServiceHeaders.getInstance()), String.class); - File f = new File(tmp_folder + fileName); + File f = new File(tmpFolderName + fileName); f.delete(); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "createWidgetCatalog failed", e); @@ -255,46 +279,44 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { } @RequestMapping(value = "/portalApi/microservices/{widgetId}/framework.js", method = RequestMethod.GET) - public String getWidgetFramework(HttpServletRequest request, HttpServletResponse response, - @PathVariable("widgetId") long widgetId) throws RestClientException, Exception { + public String getWidgetFramework(@PathVariable("widgetId") long widgetId) throws Exception { return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + "/widget/microservices/" + widgetId + "/framework.js", String.class, WidgetServiceHeaders.getInstance()); } @RequestMapping(value = "/portalApi/microservices/{widgetId}/controller.js", method = RequestMethod.GET) - public String getWidgetController(HttpServletRequest request, HttpServletResponse response, - @PathVariable("widgetId") long widgetId) throws RestClientException, Exception { + public String getWidgetController(@PathVariable("widgetId") long widgetId) throws Exception { return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + "/widget/microservices/" + widgetId + "/controller.js", String.class, WidgetServiceHeaders.getInstance()); } @RequestMapping(value = "/portalApi/microservices/{widgetId}/style.css", method = RequestMethod.GET) - public String getWidgetCSS(HttpServletRequest request, HttpServletResponse response, - @PathVariable("widgetId") long widgetId) throws RestClientException, Exception { + public String getWidgetCSS(@PathVariable("widgetId") long widgetId) throws Exception { return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + "/widget/microservices/" + widgetId + "/styles.css", String.class, WidgetServiceHeaders.getInstance()); } @RequestMapping(value = { "/portalApi/microservices/parameters/{widgetId}" }, method = RequestMethod.GET) public PortalRestResponse<List<WidgetParameterResult>> getWidgetParameterResult(HttpServletRequest request, - HttpServletResponse response, @PathVariable("widgetId") long widgetId) throws Exception { + @PathVariable("widgetId") long widgetId) throws Exception { EPUser user = EPUserUtils.getUserSession(request); List<WidgetParameterResult> list = new ArrayList<>(); Long serviceId = template.exchange( - EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) + EcompPortalUtils.widgetMsProtocol() + "://" + + consulHealthService.getServiceLocation(whatService, + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + "/widget/microservices/widgetCatalog/parameters/" + widgetId, - HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), Long.class).getBody(); + HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), Long.class).getBody(); if (serviceId == null) { // return ok/sucess and no service parameter for this widget return new PortalRestResponse<List<WidgetParameterResult>>(PortalRestStatusEnum.WARN, @@ -302,46 +324,47 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { } else { List<MicroserviceParameter> defaultParam = microserviceService.getParametersById(serviceId); for (MicroserviceParameter param : defaultParam) { - WidgetParameterResult user_result = new WidgetParameterResult(); - user_result.setParam_id(param.getId()); - user_result.setDefault_value(param.getPara_value()); - user_result.setParam_key(param.getPara_key()); + WidgetParameterResult userResult = new WidgetParameterResult(); + userResult.setParam_id(param.getId()); + userResult.setDefault_value(param.getPara_value()); + userResult.setParam_key(param.getPara_key()); WidgetCatalogParameter userValue = widgetParameterService.getUserParamById(widgetId, user.getId(), param.getId()); if (userValue == null) - user_result.setUser_value(param.getPara_value()); + userResult.setUser_value(param.getPara_value()); else { - user_result.setUser_value(userValue.getUser_value()); + userResult.setUser_value(userValue.getUser_value()); } - list.add(user_result); + list.add(userResult); } } return new PortalRestResponse<List<WidgetParameterResult>>(PortalRestStatusEnum.OK, "SUCCESS", list); } @RequestMapping(value = { "/portalApi/microservices/services/{paramId}" }, method = RequestMethod.GET) - public List<WidgetCatalogParameter> getUserParameterById(HttpServletRequest request, HttpServletResponse response, - @PathVariable("paramId") long paramId) throws Exception { + public List<WidgetCatalogParameter> getUserParameterById( @PathVariable("paramId") long paramId) { List<WidgetCatalogParameter> list = widgetParameterService.getUserParameterById(paramId); return list; } @RequestMapping(value = { "/portalApi/microservices/services/{paramId}" }, method = RequestMethod.DELETE) - public void deleteUserParameterById(HttpServletRequest request, HttpServletResponse response, - @PathVariable("paramId") long paramId) throws Exception { + public void deleteUserParameterById(@PathVariable("paramId") long paramId) { widgetParameterService.deleteUserParameterById(paramId); } @RequestMapping(value = { "/portalApi/microservices/download/{widgetId}" }, method = RequestMethod.GET) public void doDownload(HttpServletRequest request, HttpServletResponse response, - @PathVariable("widgetId") long widgetId) throws RestClientException, Exception { + @PathVariable("widgetId") long widgetId) throws Exception { ServletContext context = request.getServletContext(); - byte[] byteFile = template.exchange( - EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, - SystemProperties.getProperty("microservices.widget.local.port")) - + "/widget/microservices/download/" + widgetId, - HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), byte[].class).getBody(); + byte[] byteFile = template + .exchange( + EcompPortalUtils.widgetMsProtocol() + "://" + + consulHealthService.getServiceLocation(whatService, + SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT)) + + "/widget/microservices/download/" + widgetId, + HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), byte[].class) + .getBody(); File downloadFile = File.createTempFile("temp", ".zip"); FileOutputStream stream = new FileOutputStream(downloadFile.getPath()); @@ -363,7 +386,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { OutputStream outStream = response.getOutputStream(); byte[] buffer = new byte[32 * 1024]; - int bytesRead = -1; + int bytesRead; while ((bytesRead = inputStream.read(buffer)) != -1) { outStream.write(buffer, 0, bytesRead); } @@ -373,8 +396,8 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { } @RequestMapping(value = { "/portalApi/microservices/parameters" }, method = RequestMethod.POST) - public PortalRestResponse<String> saveWidgetParameter(HttpServletRequest request, HttpServletResponse response, - @RequestBody WidgetCatalogParameter widgetParameters) throws Exception { + public PortalRestResponse<String> saveWidgetParameter(HttpServletRequest request, + @RequestBody WidgetCatalogParameter widgetParameters) { EPUser user = EPUserUtils.getUserSession(request); widgetParameters.setUserId(user.getId()); try { @@ -386,6 +409,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController { widgetParameterService.saveUserParameter(widgetParameters); } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "saveWidgetParameter failed", e); return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "FAILURE", e.getMessage()); } return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "SUCCESS", ""); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java index e8bd9622..aefc3d07 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApp.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApp.java index ecf0b684..ed172f6c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApp.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApplications.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApplications.java index c90be671..de0d406a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApplications.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AdminUserApplications.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/App.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/App.java index 794f26c0..8e4bf490 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/App.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/App.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppContactUs.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppContactUs.java index be3baa0c..b816ff98 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppContactUs.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppContactUs.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppIdAndNameTransportModel.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppIdAndNameTransportModel.java index 3efa26a3..00463f72 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppIdAndNameTransportModel.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppIdAndNameTransportModel.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppsResponse.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppsResponse.java index 05fc5fe4..d3a940ea 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppsResponse.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/AppsResponse.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BEProperty.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BEProperty.java index a5b5c0c6..8147903e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BEProperty.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BEProperty.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BasicAuthCredentials.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BasicAuthCredentials.java index 359945ce..83cf21d8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BasicAuthCredentials.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/BasicAuthCredentials.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/CentralRoleFunction.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/CentralRoleFunction.java index 2d659e9c..49e4228c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/CentralRoleFunction.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/CentralRoleFunction.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import org.openecomp.portalsdk.core.domain.support.DomainVo; @@ -5,26 +42,24 @@ import org.openecomp.portalsdk.core.domain.support.DomainVo; import com.fasterxml.jackson.annotation.JsonIgnore; @SuppressWarnings("rawtypes") -public class CentralRoleFunction extends DomainVo implements java.io.Serializable, Comparable{ - - /** - * - */ +public class CentralRoleFunction extends DomainVo implements java.io.Serializable, Comparable { + + /** + * + */ private static final long serialVersionUID = -4018975640065252688L; - private String code; - private String name; - @JsonIgnore - private Long appId; - @JsonIgnore - private Long roleId; - private String editUrl; - - + private String code; + private String name; + @JsonIgnore + private Long appId; + @JsonIgnore + private Long roleId; + private String editUrl; + public CentralRoleFunction() { - + } - - + public CentralRoleFunction(Long id, String code, String name, Long appId, String editUrl) { super(); this.id = id; @@ -46,55 +81,65 @@ public class CentralRoleFunction extends DomainVo implements java.io.Serializabl public String getCode() { return code; } + /** - * @param code the code to set + * @param code + * the code to set */ public void setCode(String code) { this.code = code; } + /** * @return the name */ public String getName() { return name; } + /** - * @param name the name to set + * @param name + * the name to set */ public void setName(String name) { this.name = name; } + /** * @return the appId */ public Long getAppId() { return appId; } + /** - * @param appId the appId to set + * @param appId + * the appId to set */ public void setAppId(Long appId) { this.appId = appId; } + /** * @return the editUrl */ public String getEditUrl() { return editUrl; } + /** - * @param editUrl the editUrl to set + * @param editUrl + * the editUrl to set */ public void setEditUrl(String editUrl) { this.editUrl = editUrl; } - public int compareTo(Object obj){ - String c1 = getName(); - String c2 = ((CentralRoleFunction)obj).getName(); - - return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); - } - - - + + public int compareTo(Object obj) { + String c1 = getName(); + String c2 = ((CentralRoleFunction) obj).getName(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPApp.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPApp.java index ad9dec56..c27a9ad1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPApp.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunction.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunction.java index 7665fd36..1c621c7f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunction.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunction.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import org.openecomp.portalsdk.core.domain.support.DomainVo; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpoint.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpoint.java index 85e390e6..0abcfa8f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpoint.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpoint.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import org.openecomp.portalsdk.core.domain.support.DomainVo; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpointAccount.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpointAccount.java index 3d7dbd1f..b4f66f3b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpointAccount.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPEndpointAccount.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import org.openecomp.portalsdk.core.domain.support.DomainVo; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPRole.java index 90990ef4..fdc70ee1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPRole.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUser.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUser.java index 3a52ffc3..e5e09ac5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUser.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserApp.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserApp.java index 005d5328..80189ddd 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserApp.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRoles.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRoles.java index db041857..2074beb8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRoles.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRoles.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRoles.java index 574645e3..fe6d1975 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRoles.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequest.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequest.java index 616246d8..651ef5e6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequest.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetail.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetail.java index eeb34451..8bf83a31 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetail.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetail.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreference.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreference.java index 6c150535..0d7ee8f0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreference.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreference.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreference.java index f906d0c0..7d0a8603 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreference.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserNotification.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserNotification.java index 3562efd6..993c7dba 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserNotification.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPUserNotification.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreference.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreference.java index 9ea3c075..1c515d6e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreference.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompApp.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompApp.java index 24564aaa..30be6889 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompApp.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRole.java index 52529cb6..e60b220a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRole.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRoleId.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRoleId.java index 894316e5..c61052d8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRoleId.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAppRoleId.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAuditLog.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAuditLog.java index 63ac2c7e..517b9173 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAuditLog.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/EcompAuditLog.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetails.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetails.java index e30b5d36..2ba6a573 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetails.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetails.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccess.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccess.java index fdbc0931..b4c08954 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccess.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccess.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppID.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppID.java index d8c916bd..5087d029 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppID.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppID.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResult.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResult.java index c4b9489c..5c43de24 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResult.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResult.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResultId.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResultId.java index b0508138..df7faac3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResultId.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/GetAccessResultId.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceData.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceData.java index a9ca2b68..d99523a6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceData.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceData.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceParameter.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceParameter.java index 80c48fcc..8ed012ef 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceParameter.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/MicroserviceParameter.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserAppSelection.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserAppSelection.java index 81a5942e..6dbc5d30 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserAppSelection.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserAppSelection.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelection.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelection.java index 5ef8a21b..f049a520 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelection.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelection.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/RoleApp.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/RoleApp.java index 769016db..8b3f2a8c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/RoleApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/RoleApp.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/SharedContext.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/SharedContext.java index 49333c4c..710e910a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/SharedContext.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/SharedContext.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserIdRoleId.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserIdRoleId.java index 4d2041dd..9d59bf34 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserIdRoleId.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserIdRoleId.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRole.java index 0e13cc01..38b74a54 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRole.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRoles.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRoles.java index 83cce3e3..578292a4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/UserRoles.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/Widget.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/Widget.java index 302195f0..33f2df88 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/Widget.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/Widget.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalog.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalog.java index 5481a22f..edf6eb85 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalog.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalog.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameter.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameter.java index 6e750db9..18833f6d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameter.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameter.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetParameterResult.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetParameterResult.java index b41f985e..81d703f4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetParameterResult.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetParameterResult.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetServiceHeaders.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetServiceHeaders.java index c53df6ca..14c7799a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetServiceHeaders.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/domain/WidgetServiceHeaders.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.domain; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCatalogItem.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCatalogItem.java index 9cce4c0f..1279004f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCatalogItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCatalogItem.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ecomp.model; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCategoryFunctionsItem.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCategoryFunctionsItem.java index 9b35beb0..e09b8627 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCategoryFunctionsItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppCategoryFunctionsItem.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ecomp.model; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppContactUsItem.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppContactUsItem.java index 1cfb6644..74adc8be 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppContactUsItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/AppContactUsItem.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ecomp.model; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/CommonWidgetsEnum.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/CommonWidgetsEnum.java index cb712a22..784cf3d5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/CommonWidgetsEnum.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/CommonWidgetsEnum.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ecomp.model; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestResponse.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestResponse.java index 21c6dfe7..05dadca8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestResponse.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestResponse.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ecomp.model; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestStatusEnum.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestStatusEnum.java index 6c264ee2..1f70da72 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestStatusEnum.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/PortalRestStatusEnum.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ecomp.model; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/SearchResultItem.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/SearchResultItem.java index dde9bc27..dbd70b94 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/SearchResultItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ecomp/model/SearchResultItem.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ecomp.model; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceException.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceException.java index 55872f2d..b4764d81 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceException.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceException.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.exceptions; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/interceptor/PortalResourceInterceptor.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/interceptor/PortalResourceInterceptor.java index ba4f2af1..4514126a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/interceptor/PortalResourceInterceptor.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/interceptor/PortalResourceInterceptor.java @@ -1,21 +1,40 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.interceptor; import java.nio.charset.Charset; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java index 27c43160..881952cf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/HealthMonitor.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.listener; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserContextListener.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserContextListener.java index e2176ee9..686bef2d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserContextListener.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserContextListener.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.listener; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserSessionListener.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserSessionListener.java index ebab2aa3..a0093569 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserSessionListener.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/listener/UserSessionListener.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.listener; @@ -29,16 +47,14 @@ import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.util.StringUtils; - +import org.openecomp.portalapp.portal.domain.EPUser; +import org.openecomp.portalapp.portal.service.SharedContextService; import org.openecomp.portalsdk.core.domain.support.CollaborateList; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.service.SharedContextService; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.util.StringUtils; /** * Listens for session-create and session-destroy events. @@ -75,7 +91,6 @@ public class UserSessionListener implements HttpSessionListener { * invalidated. */ public void sessionDestroyed(HttpSessionEvent event) { - try { HttpSession session = event.getSession(); ServletContext context = session.getServletContext(); @@ -84,14 +99,14 @@ public class UserSessionListener implements HttpSessionListener { EPUser user = (EPUser) session .getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)); - if (user!=null && !StringUtils.isEmpty(user.getOrgUserId())) { + if (user != null && !StringUtils.isEmpty(user.getOrgUserId())) { CollaborateList.delUserName(user.getOrgUserId()); } // Remove any shared context entries for this session. - if (getSharedContextService()!=null) { + if (getSharedContextService() != null) { getSharedContextService().deleteSharedContexts(session.getId()); - + // Clean the shared context each time a session is destroyed. // TODO: move the threshold to configuration file. getSharedContextService().expireSharedContexts(60 * 60 * 8); @@ -100,10 +115,10 @@ public class UserSessionListener implements HttpSessionListener { logger.info(EELFLoggerDelegate.debugLogger, "Session Destroyed : " + session.getId()); } catch (Exception e) { - logger.warn(EELFLoggerDelegate.errorLogger, "Exception occurred while executing sessionDestroyed. Details: " + EcompPortalUtils.getStackTrace(e)); + logger.warn(EELFLoggerDelegate.errorLogger, "sessionDestroyed failed", e); } } - + private static ApplicationContext applicationContext; public static void setApplicationContext(ApplicationContext _applicationContext) { @@ -111,11 +126,11 @@ public class UserSessionListener implements HttpSessionListener { } public SharedContextService getSharedContextService() { - if(sharedContextService == null){ - if (applicationContext != null) - sharedContextService = (SharedContextService)applicationContext.getBean("sharedContextService"); + if (sharedContextService == null) { + if (applicationContext != null) + sharedContextService = (SharedContextService) applicationContext.getBean("sharedContextService"); } - + return sharedContextService; } @@ -123,4 +138,3 @@ public class UserSessionListener implements HttpSessionListener { this.sharedContextService = sharedContextService; } } - diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPAuditLog.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPAuditLog.java index bfe81a2b..7d761254 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPAuditLog.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPAuditLog.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.logging.aop; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java index 1db63fe8..260c0f72 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAdvice.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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, + * 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.openecomp.portalapp.portal.logging.aop; @@ -80,7 +98,7 @@ public class EPEELFLoggerAdvice { * @param securityEventType * @param args * @param passOnArgs - * @return + * @return Object array */ public Object[] before(SecurityEventTypeEnum securityEventType, Object[] args, Object[] passOnArgs) { String className = ""; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPMetricsLog.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPMetricsLog.java index ce98b1c6..4cd5971f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPMetricsLog.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPMetricsLog.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.logging.aop; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java index eaac6edf..4a99eeeb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPAppMessagesEnum.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.logging.format; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java index ca4cdec1..cdcc0643 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/format/EPErrorCodesEnum.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.logging.format; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java index 2c6b3300..9c9137fc 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/logging/logic/EPLogUtil.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.logging.logic; @@ -27,7 +45,6 @@ import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; import org.openecomp.portalsdk.core.logging.format.ErrorSeverityEnum; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.web.support.UserUtils; import org.slf4j.MDC; import org.springframework.http.HttpStatus; @@ -61,9 +78,6 @@ public class EPLogUtil { * specified parameters, using log level info, warn or error appropriate for * the specified severity * - * @param classLogger - * Logger for the class where the error occurred; the logger - * carries the class name. * @param epMessageEnum * Enum carrying alarm and error severity * @param param @@ -89,7 +103,7 @@ public class EPLogUtil { errorLogger.error(resolution); } } catch (Exception e) { - errorLogger.error("Failed to log the error code. Details: " + UserUtils.getStackTrace(e)); + errorLogger.error("logEcompError failed", e); } finally { MDC.remove("ErrorCode"); MDC.remove("ErrorDescription"); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/RestObject.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/RestObject.java index a1030e3a..354b9ef6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/RestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/RestObject.java @@ -1,21 +1,39 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.scheduler; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerProperties.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerProperties.java index 2d65b6c3..fe6a9aca 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerProperties.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerProperties.java @@ -1,20 +1,56 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler; import org.openecomp.portalsdk.core.util.SystemProperties; +public class SchedulerProperties extends SystemProperties { + + public static final String SCHEDULER_USER_NAME_VAL = "scheduler.user.name";; -public class SchedulerProperties extends SystemProperties { - - public static final String SCHEDULER_USER_NAME_VAL = "scheduler.user.name";; - public static final String SCHEDULER_PASSWORD_VAL = "scheduler.password"; - + public static final String SCHEDULER_SERVER_URL_VAL = "scheduler.server.url"; - + public static final String SCHEDULER_CREATE_NEW_VNF_CHANGE_INSTANCE_VAL = "scheduler.create.new.vnf.change.instance"; - + public static final String SCHEDULER_GET_TIME_SLOTS = "scheduler.get.time.slots"; - + public static final String SCHEDULER_SUBMIT_NEW_VNF_CHANGE = "scheduler.submit.new.vnf.change"; } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerResponseWrapper.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerResponseWrapper.java index d30f0568..731eef85 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerResponseWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerResponseWrapper.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInt.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInt.java index d532fd79..78a0b108 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInt.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInt.java @@ -1,21 +1,39 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.scheduler; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterface.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterface.java index 337c1fcf..9acfd5a0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterface.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterface.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler; import java.util.Collections; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceFactory.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceFactory.java index 34433e5a..8aaf8819 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceFactory.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceFactory.java @@ -1,15 +1,50 @@ - +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler; public class SchedulerRestInterfaceFactory { - - public static SchedulerRestInterfaceIfc getInstance () { + public static SchedulerRestInterfaceIfc getInstance() { SchedulerRestInterfaceIfc obj = null; obj = new SchedulerRestInterface(); - - return ( obj ); + + return (obj); } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceIfc.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceIfc.java index 77353e5e..738f9baa 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceIfc.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerRestInterfaceIfc.java @@ -1,17 +1,53 @@ - +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler; import org.json.simple.JSONObject; import org.springframework.stereotype.Service; import org.openecomp.portalapp.portal.scheduler.restobjects.RestObject; - @Service public interface SchedulerRestInterfaceIfc { public void initRestClient(); - public <T> void Get(T t, String sourceId, String path, org.openecomp.portalapp.portal.scheduler.restobjects.RestObject<T> restObject ) throws Exception; + public <T> void Get(T t, String sourceId, String path, + org.openecomp.portalapp.portal.scheduler.restobjects.RestObject<T> restObject) throws Exception; public <T> void Delete(T t, JSONObject requestDetails, String sourceID, String path, RestObject<T> restObject) throws Exception; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerUtil.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerUtil.java index 37dddc29..39de6b3e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerUtil.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/SchedulerUtil.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler; import java.text.DateFormat; @@ -15,85 +52,86 @@ import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import com.fasterxml.jackson.databind.ObjectMapper; public class SchedulerUtil { - + private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerUtil.class); - + final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - public static GetTimeSlotsWrapper getTimeSlotsWrapResponse (GetTimeSlotsRestObject<String> rs) { - + public static GetTimeSlotsWrapper getTimeSlotsWrapResponse(GetTimeSlotsRestObject<String> rs) { + String resp_str = ""; int status = 0; - - if ( rs != null ) { + + if (rs != null) { resp_str = rs.get(); status = rs.getStatusCode(); } - + GetTimeSlotsWrapper w = new GetTimeSlotsWrapper(); - + w.setEntity(resp_str); - w.setStatus (status); - + w.setStatus(status); + return (w); } - - public static PostSubmitVnfChangeTimeSlotsWrapper postSubmitNewVnfWrapResponse (PostSubmitVnfChangeRestObject<String> rs) { - + + public static PostSubmitVnfChangeTimeSlotsWrapper postSubmitNewVnfWrapResponse( + PostSubmitVnfChangeRestObject<String> rs) { + String resp_str = ""; int status = 0; String uuid = ""; - - if ( rs != null ) { + + if (rs != null) { resp_str = rs.get(); status = rs.getStatusCode(); uuid = rs.getUUID(); } - + PostSubmitVnfChangeTimeSlotsWrapper w = new PostSubmitVnfChangeTimeSlotsWrapper(); - + w.setEntity(resp_str); - w.setStatus (status); + w.setStatus(status); w.setUuid(uuid); - + return (w); } - - public static PostCreateNewVnfWrapper postCreateNewVnfWrapResponse (PostCreateNewVnfRestObject<String> rs) { - + + public static PostCreateNewVnfWrapper postCreateNewVnfWrapResponse(PostCreateNewVnfRestObject<String> rs) { + String resp_str = ""; int status = 0; String uuid = ""; - - if ( rs != null ) { + + if (rs != null) { resp_str = rs.get(); status = rs.getStatusCode(); uuid = rs.getUUID(); } - + PostCreateNewVnfWrapper w = new PostCreateNewVnfWrapper(); - + w.setEntity(resp_str); - w.setStatus (status); + w.setStatus(status); w.setUuid(uuid); - + return (w); } - - public static <T> String convertPojoToString ( T t ) throws com.fasterxml.jackson.core.JsonProcessingException { - + + public static <T> String convertPojoToString(T t) throws com.fasterxml.jackson.core.JsonProcessingException { + String methodName = "convertPojoToString"; ObjectMapper mapper = new ObjectMapper(); String r_json_str = ""; - if ( t != null ) { - try { - r_json_str = mapper.writeValueAsString(t); - } - catch ( com.fasterxml.jackson.core.JsonProcessingException j ) { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse object as json"); - } - } - return (r_json_str); + if (t != null) { + try { + r_json_str = mapper.writeValueAsString(t); + } catch (com.fasterxml.jackson.core.JsonProcessingException j) { + logger.debug(EELFLoggerDelegate.debugLogger, + dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse object as json"); + } + } + return (r_json_str); } - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpBasicClient.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpBasicClient.java index f0ec2769..2059cae0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpBasicClient.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpBasicClient.java @@ -1,21 +1,39 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.scheduler.client; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpsBasicClient.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpsBasicClient.java index be244865..2eb3ac72 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpsBasicClient.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/client/HttpsBasicClient.java @@ -1,21 +1,39 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.scheduler.client; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyProperties.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyProperties.java index cf10d8f6..a89b5d61 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyProperties.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyProperties.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.policy; import org.openecomp.portalsdk.core.util.SystemProperties; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyResponseWrapper.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyResponseWrapper.java index ed51456e..276af521 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyResponseWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyResponseWrapper.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.policy; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInt.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInt.java index ce930c9a..14c4db72 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInt.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInt.java @@ -1,21 +1,39 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.scheduler.policy; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterface.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterface.java index 70b4f818..e14dd107 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterface.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterface.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.policy; import java.text.DateFormat; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceFactory.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceFactory.java index c6dd440d..26726547 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceFactory.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceFactory.java @@ -1,14 +1,49 @@ - +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.policy; public class PolicyRestInterfaceFactory { - - public static PolicyRestInterfaceIfc getInstance () { + public static PolicyRestInterfaceIfc getInstance() { PolicyRestInterfaceIfc obj = null; obj = new PolicyRestInterface(); - - return ( obj ); + + return (obj); } }
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceIfc.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceIfc.java index 38fedb9c..4e3d08e0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceIfc.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyRestInterfaceIfc.java @@ -1,58 +1,116 @@ - +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.policy; import org.json.simple.JSONObject; import org.openecomp.portalapp.portal.scheduler.policy.rest.RequestDetails; -public interface PolicyRestInterfaceIfc { +public interface PolicyRestInterfaceIfc { /** * Inits the rest client. */ public void initRestClient(); - + /** * Gets the. * - * @param <T> the generic type - * @param t the t - * @param sourceId the source id - * @param path the path - * @param restObject the rest object - * @throws Exception the exception + * @param <T> + * the generic type + * @param t + * the t + * @param sourceId + * the source id + * @param path + * the path + * @param restObject + * the rest object + * @throws Exception + * the exception */ - public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception; - + public <T> void Get(T t, String sourceId, String path, RestObject<T> restObject) throws Exception; + /** * Delete. * - * @param <T> the generic type - * @param t the t - * @param r the r - * @param sourceID the source ID - * @param path the path - * @param restObject the rest object - * @throws Exception the exception + * @param <T> + * the generic type + * @param t + * the t + * @param r + * the r + * @param sourceID + * the source ID + * @param path + * the path + * @param restObject + * the rest object + * @throws Exception + * the exception */ - public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception; - + public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) + throws Exception; + /** * Post. * - * @param <T> the generic type - * @param t the t - * @param r the r - * @param sourceID the source ID - * @param path the path - * @param restObject the rest object - * @throws Exception the exception + * @param <T> + * the generic type + * @param t + * the t + * @param r + * the r + * @param sourceID + * the source ID + * @param path + * the path + * @param restObject + * the rest object + * @throws Exception + * the exception */ public <T> void Post(T t, JSONObject r, String sourceID, String path, RestObject<T> restObject) throws Exception; - + /*** * Log request. * - * @param r the r + * @param r + * the r */ - public void logRequest ( RequestDetails r ); - + public void logRequest(RequestDetails r); + }
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java index 8ec8323d..aa4216bf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/PolicyUtil.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.policy; import java.text.DateFormat; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/RestObject.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/RestObject.java index 040971e5..efe2de07 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/RestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/RestObject.java @@ -1,21 +1,39 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.scheduler.policy; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/rest/RequestDetails.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/rest/RequestDetails.java index 9c5debee..a7759cba 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/rest/RequestDetails.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/policy/rest/RequestDetails.java @@ -1,21 +1,39 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.scheduler.policy.rest; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/properties/VidProperties.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/properties/VidProperties.java index 883f8714..e18f43f1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/properties/VidProperties.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/properties/VidProperties.java @@ -1,21 +1,39 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.scheduler.properties; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/GetTimeSlotsRestObject.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/GetTimeSlotsRestObject.java index 3e7771ae..9749c836 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/GetTimeSlotsRestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/GetTimeSlotsRestObject.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.restobjects; public class GetTimeSlotsRestObject<T> extends RestObject<T> { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostCreateNewVnfRestObject.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostCreateNewVnfRestObject.java index 7e92307b..94b66821 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostCreateNewVnfRestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostCreateNewVnfRestObject.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.restobjects; public class PostCreateNewVnfRestObject<T> extends RestObject<T> { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostSubmitVnfChangeRestObject.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostSubmitVnfChangeRestObject.java index 9dd66afc..4f78fd75 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostSubmitVnfChangeRestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/PostSubmitVnfChangeRestObject.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.restobjects; public class PostSubmitVnfChangeRestObject<T> extends RestObject<T> { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/RestObject.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/RestObject.java index 6bb74431..a8636ad9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/RestObject.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/restobjects/RestObject.java @@ -1,21 +1,39 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.scheduler.restobjects; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/util/CustomJacksonJaxBJsonProvider.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/util/CustomJacksonJaxBJsonProvider.java index e6953838..d9792b3d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/util/CustomJacksonJaxBJsonProvider.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/util/CustomJacksonJaxBJsonProvider.java @@ -1,21 +1,39 @@ /*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= + * + * 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.openecomp.portalapp.portal.scheduler.util; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/GetTimeSlotsWrapper.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/GetTimeSlotsWrapper.java index 81aafc62..69b6b366 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/GetTimeSlotsWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/GetTimeSlotsWrapper.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.wrapper; public class GetTimeSlotsWrapper extends SchedulerResponseWrapper { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostCreateNewVnfWrapper.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostCreateNewVnfWrapper.java index 38aa6347..41f07f38 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostCreateNewVnfWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostCreateNewVnfWrapper.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.wrapper; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostSubmitVnfChangeTimeSlotsWrapper.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostSubmitVnfChangeTimeSlotsWrapper.java index 9d6725ab..c0f2403d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostSubmitVnfChangeTimeSlotsWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/PostSubmitVnfChangeTimeSlotsWrapper.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.wrapper; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/SchedulerResponseWrapper.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/SchedulerResponseWrapper.java index e10505c0..3a55b4fc 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/SchedulerResponseWrapper.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/scheduler/wrapper/SchedulerResponseWrapper.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.scheduler.wrapper; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesService.java index 529581d2..020ed6f4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesServiceImpl.java index 9025b598..e9ca4e9b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AdminRolesServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -73,30 +91,31 @@ public class AdminRolesServiceImpl implements AdminRolesService { private Long ACCOUNT_ADMIN_ROLE_ID = 999L; private Long ECOMP_APP_ID = 1L; - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AdminRolesServiceImpl.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AdminRolesServiceImpl.class); @Autowired private SessionFactory sessionFactory; @Autowired private DataAccessService dataAccessService; @Autowired - SearchService searchService; + private SearchService searchService; @Autowired - EPAppService appsService; - - RestTemplate template = new RestTemplate(); - + private EPAppService appsService; + + private RestTemplate template = new RestTemplate(); + @PostConstruct private void init() { try { SYS_ADMIN_ROLE_ID = Long.valueOf(SystemProperties.getProperty(EPCommonSystemProperties.SYS_ADMIN_ROLE_ID)); - ACCOUNT_ADMIN_ROLE_ID = Long.valueOf(SystemProperties.getProperty(EPCommonSystemProperties.ACCOUNT_ADMIN_ROLE_ID)); + ACCOUNT_ADMIN_ROLE_ID = Long + .valueOf(SystemProperties.getProperty(EPCommonSystemProperties.ACCOUNT_ADMIN_ROLE_ID)); ECOMP_APP_ID = Long.valueOf(SystemProperties.getProperty(EPCommonSystemProperties.ECOMP_APP_ID)); - } catch(Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "init failed", e); } } - + @Override @EPMetricsLog @SuppressWarnings("unchecked") @@ -104,8 +123,8 @@ public class AdminRolesServiceImpl implements AdminRolesService { AppsListWithAdminRole appsListWithAdminRole = null; try { - List<EPUser> userList = dataAccessService.getList(EPUser.class, " where orgUserId = '" + orgUserId + "'", null, - null); + List<EPUser> userList = dataAccessService.getList(EPUser.class, " where orgUserId = '" + orgUserId + "'", + null, null); HashMap<Long, Long> appsUserAdmin = new HashMap<Long, Long>(); if (userList.size() > 0) { EPUser user = userList.get(0); @@ -114,7 +133,7 @@ public class AdminRolesServiceImpl implements AdminRolesService { userAppList = dataAccessService.getList(EPUserApp.class, " where userId = " + user.getId() + " and role.id = " + ACCOUNT_ADMIN_ROLE_ID, null, null); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getAppsWithAdminRoleStateForUser 1 failed", e); EPLogUtil.logEcompError(EPAppMessagesEnum.BeDaoSystemError); } for (EPUserApp userApp : userAppList) { @@ -126,22 +145,22 @@ public class AdminRolesServiceImpl implements AdminRolesService { appsListWithAdminRole.orgUserId = orgUserId; List<EPApp> appsList = null; try { - appsList = dataAccessService.getList(EPApp.class, " where ( enabled = 'Y' or id = " + ECOMP_APP_ID + ")", null, null); + appsList = dataAccessService.getList(EPApp.class, + " where ( enabled = 'Y' or id = " + ECOMP_APP_ID + ")", null, null); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getAppsWithAdminRoleStateForUser 2 failed", e); EPLogUtil.logEcompError(EPAppMessagesEnum.BeDaoSystemError); } for (EPApp app : appsList) { AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin(); appNameIdIsAdmin.id = app.getId(); - appNameIdIsAdmin.appName = app.getName(); + appNameIdIsAdmin.appName = app.getName(); appNameIdIsAdmin.isAdmin = new Boolean(appsUserAdmin.containsKey(app.getId())); appNameIdIsAdmin.restrictedApp = app.isRestrictedApp(); appsListWithAdminRole.appsRoles.add(appNameIdIsAdmin); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while performing AdminRolesServiceImpl.getAppsWithAdminRoleStateForUser operation, Details:" - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getAppsWithAdminRoleStateForUser 3 failed", e); } return appsListWithAdminRole; @@ -174,8 +193,8 @@ public class AdminRolesServiceImpl implements AdminRolesService { EPUser user = null; boolean createNewUser = false; String orgUserId = newAppsListWithAdminRoles.orgUserId.trim(); - List<EPUser> localUserList = dataAccessService.getList(EPUser.class, " where org_user_id='" + orgUserId + "'", - null, null); + List<EPUser> localUserList = dataAccessService.getList(EPUser.class, + " where org_user_id='" + orgUserId + "'", null, null); List<EPUserApp> oldAppsWhereUserIsAdmin = new ArrayList<EPUserApp>(); if (localUserList.size() > 0) { EPUser tmpUser = localUserList.get(0); @@ -221,12 +240,13 @@ public class AdminRolesServiceImpl implements AdminRolesService { localSession.save(EPUserApp.class.getName(), newUserApp); } transaction.commit(); - - // Add user admin role for list of centralized applications in external system + + // Add user admin role for list of centralized applications in external system result = addAdminRoleInExternalSystem(user, localSession, newAppsWhereUserIsAdmin); } catch (Exception e) { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); - logger.error(EELFLoggerDelegate.errorLogger, "setAppsWithAdminRoleStateForUser: exception in point 2", e); + logger.error(EELFLoggerDelegate.errorLogger, + "setAppsWithAdminRoleStateForUser: exception in point 2", e); try { if(transaction!=null) transaction.rollback(); @@ -234,14 +254,16 @@ public class AdminRolesServiceImpl implements AdminRolesService { logger.error(EELFLoggerDelegate.errorLogger, "setAppsWithAdminRoleStateForUser: transaction is null cannot rollback"); } catch (Exception ex) { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeExecuteRollbackError, e); - logger.error(EELFLoggerDelegate.errorLogger, "setAppsWithAdminRoleStateForUser: exception in point 3", ex); + logger.error(EELFLoggerDelegate.errorLogger, + "setAppsWithAdminRoleStateForUser: exception in point 3", ex); } } finally { try { localSession.close(); } catch (Exception e) { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoCloseSessionError, e); - logger.error(EELFLoggerDelegate.errorLogger, "setAppsWithAdminRoleStateForUser: exception in point 4", e); + logger.error(EELFLoggerDelegate.errorLogger, + "setAppsWithAdminRoleStateForUser: exception in point 4", e); } } } @@ -252,7 +274,8 @@ public class AdminRolesServiceImpl implements AdminRolesService { } @SuppressWarnings("unchecked") - private boolean addAdminRoleInExternalSystem(EPUser user, Session localSession, List<AppNameIdIsAdmin> newAppsWhereUserIsAdmin) { + private boolean addAdminRoleInExternalSystem(EPUser user, Session localSession, + List<AppNameIdIsAdmin> newAppsWhereUserIsAdmin) { boolean result = false; try { // Reset All admin role for centralized applications @@ -296,7 +319,7 @@ public class AdminRolesServiceImpl implements AdminRolesService { if (e.getMessage().equalsIgnoreCase("404 Not Found")) { logger.debug(EELFLoggerDelegate.debugLogger, "Application Not found for app {}", app.getNameSpace(), e.getMessage()); - } else{ + } else { logger.error(EELFLoggerDelegate.errorLogger, "Application Not found for app {}", app.getNameSpace(), e); } @@ -358,8 +381,8 @@ public class AdminRolesServiceImpl implements AdminRolesService { } catch (Exception e) { if (e.getMessage().equalsIgnoreCase("404 Not Found")) { logger.debug(EELFLoggerDelegate.errorLogger, - "Application name space not found in External system for app {} due to bad rquest name space ", app.getNameSpace(), - e.getMessage()); + "Application name space not found in External system for app {} due to bad rquest name space ", + app.getNameSpace(), e.getMessage()); } else { logger.error(EELFLoggerDelegate.errorLogger, "Failed to assign admin role for application {}", app.getNameSpace(), e); @@ -389,7 +412,8 @@ public class AdminRolesServiceImpl implements AdminRolesService { } } catch (Exception e) { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while executing isSuperAdmin operation", e); + logger.error(EELFLoggerDelegate.errorLogger, + "Exception occurred while executing isSuperAdmin operation", e); } } // else @@ -413,12 +437,13 @@ public class AdminRolesServiceImpl implements AdminRolesService { public boolean isAccountAdmin(EPUser user) { try { EPUser currentUser = user != null - ? (EPUser) dataAccessService.getDomainObject(EPUser.class, user.getId(), null) : null; + ? (EPUser) dataAccessService.getDomainObject(EPUser.class, user.getId(), null) + : null; if (currentUser != null && currentUser.getId() != null) { for (EPUserApp userApp : currentUser.getEPUserApps()) { - if (//!userApp.getApp().getId().equals(ECOMP_APP_ID) - // && - userApp.getRole().getId().equals(ACCOUNT_ADMIN_ROLE_ID)) { + if (// !userApp.getApp().getId().equals(ECOMP_APP_ID) + // && + userApp.getRole().getId().equals(ACCOUNT_ADMIN_ROLE_ID)) { // Account Administrator sees only the applications // he/she is Administrator return true; @@ -427,7 +452,8 @@ public class AdminRolesServiceImpl implements AdminRolesService { } } catch (Exception e) { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while executing isAccountAdmin operation", e); + logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while executing isAccountAdmin operation", + e); } return false; } @@ -435,7 +461,8 @@ public class AdminRolesServiceImpl implements AdminRolesService { public boolean isUser(EPUser user) { try { EPUser currentUser = user != null - ? (EPUser) dataAccessService.getDomainObject(EPUser.class, user.getId(), null) : null; + ? (EPUser) dataAccessService.getDomainObject(EPUser.class, user.getId(), null) + : null; if (currentUser != null && currentUser.getId() != null) { for (EPUserApp userApp : currentUser.getEPUserApps()) { if (!userApp.getApp().getId().equals(ECOMP_APP_ID)) { @@ -462,7 +489,7 @@ public class AdminRolesServiceImpl implements AdminRolesService { String sql = "SELECT * FROM FN_ROLE WHERE UPPER(ACTIVE_YN) = 'Y' AND APP_ID = " + appId; @SuppressWarnings("unchecked") List<EPRole> roles = dataAccessService.executeSQLQuery(sql, EPRole.class, null); - for (EPRole role: roles) { + for (EPRole role : roles) { list.add(role); } return list; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsService.java index d71e80fe..da33293c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImpl.java index 628414d9..2f987075 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java index caeceb3c..a8d79aed 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java index 027d972c..ae11a91e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -169,10 +187,7 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient decreptedAppPwd = CipherUtil.decrypt(encriptedPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Unable to decrypt App name = " + externalApp, - EcompPortalUtils.getStackTrace(e)); - logger.error(EELFLoggerDelegate.errorLogger, "Unable to decrypt App name = " + externalApp, - EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "createClientFor failed to decrypt", e); } WebClient client = createClientForPath(appBaseUri, restPath); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java index 2ee98644..4ffccd1e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java index c5856c62..f56cdef9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountService.java index 4b4342d4..0f18b6f3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountService.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import java.util.List; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountServiceImpl.java index 753a501e..1c353d07 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthAccountServiceImpl.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import java.util.ArrayList; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialService.java index e5966603..c16ae40d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java index 8a7dd19a..49f6f58c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthService.java index 24367e6e..6742a4c9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthServiceImpl.java index 0cfa4f81..d3ca7452 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ConsulHealthServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchService.java index 538678b0..87d557c3 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImpl.java index 336a7522..f08011f2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppCommonServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppCommonServiceImpl.java index b51ea1a1..2fc0f505 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppCommonServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppCommonServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -915,8 +933,9 @@ public class EPAppCommonServiceImpl implements EPAppService { transaction.commit(); result = true; } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "updateApp failed", e); EcompPortalUtils.rollbackTransaction(transaction, - "updateApp rollback, exception = " + EcompPortalUtils.getStackTrace(e)); + "updateApp rollback, exception = " + e.toString()); } finally { EcompPortalUtils.closeLocalSession(localSession, "updateApp"); } @@ -1107,7 +1126,7 @@ public class EPAppCommonServiceImpl implements EPAppService { EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebRegisterOnboardingAppError, e); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); EcompPortalUtils.rollbackTransaction(transaction, - "updateApp rollback, exception = " + EcompPortalUtils.getStackTrace(e)); + "updateApp rollback, exception = " + e.toString()); } finally { EcompPortalUtils.closeLocalSession(localSession, "updateApp"); } @@ -1118,7 +1137,7 @@ public class EPAppCommonServiceImpl implements EPAppService { } - public CambriaTopicManager getTopicManager(LinkedList<String> urlList, String key, String secret) + public CambriaTopicManager getTopicManager(List<String> urlList, String key, String secret) throws GeneralSecurityException, Exception { throw new Exception("This method can only be invoked from child class"); } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppService.java index 3ab12983..c4a31907 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAppService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditService.java index ef436475..321b441f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditServiceImpl.java index a7b71612..5e86c3c9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPAuditServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapService.java index 4bdecc92..e06f3987 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapServiceImpl.java index 664ee1ae..82e44fd8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLdapServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -30,23 +48,21 @@ import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import javax.naming.directory.SearchControls; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - +import org.openecomp.portalapp.portal.domain.EPUser; +import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; +import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; +import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; import org.openecomp.portalsdk.core.command.support.SearchResult; import org.openecomp.portalsdk.core.domain.support.DomainVo; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.service.support.FusionService; import org.openecomp.portalsdk.core.service.support.ServiceLocator; import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service("epLdapService") @Transactional @@ -55,234 +71,198 @@ import org.openecomp.portalapp.portal.utils.EcompPortalUtils; public class EPLdapServiceImpl extends FusionService implements EPLdapService { @Autowired private ServiceLocator serviceLocator; - + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPLdapServiceImpl.class); @EPAuditLog - @SuppressWarnings({ "rawtypes", "unchecked" }) - public SearchResult searchPost(DomainVo searchCriteria, String sortBy1, String sortBy2, String sortBy3, - int pageNo, int dataSize, int userId) throws Exception { + @SuppressWarnings({ "rawtypes", "unchecked" }) + public SearchResult searchPost(DomainVo searchCriteria, String sortBy1, String sortBy2, String sortBy3, int pageNo, + int dataSize, int userId) throws Exception { + + String remoteHost = ""; - String remoteHost = ""; - // initialize the directory context to access POST - DirContext dirContext = serviceLocator.getDirContext(SystemProperties.getProperty(SystemProperties.POST_INITIAL_CONTEXT_FACTORY), - SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL), - SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL)); - - SearchResult searchResult = new SearchResult(); + DirContext dirContext = serviceLocator.getDirContext( + SystemProperties.getProperty(SystemProperties.POST_INITIAL_CONTEXT_FACTORY), + SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL), + SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL)); - try { - - remoteHost = String.format("%s/%s", SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL), - SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL)); - MDC.put(EPCommonSystemProperties.FULL_URL, remoteHost); - - String[] postAttributes = {"nickname","givenName","initials","sn","employeeNumber","mail","telephoneNumber", - "departmentNumber","a1","street","roomNumber","l","st","postalCode","zip4","physicalDeliveryOfficeName","bc", - "friendlyCountryName","bd","bdname","bu","buname","jtname","mgrid","a2","compcode","compdesc", - "costcenter","silo","b2"}; + SearchResult searchResult = new SearchResult(); - SearchControls searchControls = new SearchControls(); - searchControls.setTimeLimit(5000); - searchControls.setReturningAttributes(postAttributes); + try { - StringBuffer filterClause = new StringBuffer("(&(objectClass=*)"); + remoteHost = String.format("%s/%s", SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL), + SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL)); + MDC.put(EPCommonSystemProperties.FULL_URL, remoteHost); - EPUser user = (EPUser)searchCriteria; + String[] postAttributes = { "nickname", "givenName", "initials", "sn", "employeeNumber", "mail", + "telephoneNumber", "departmentNumber", "a1", "street", "roomNumber", "l", "st", "postalCode", + "zip4", "physicalDeliveryOfficeName", "bc", "friendlyCountryName", "bd", "bdname", "bu", "buname", + "jtname", "mgrid", "a2", "compcode", "compdesc", "costcenter", "silo", "b2" }; - if(Utilities.nvl(user.getFirstName()).length() > 0) { - filterClause.append("(givenName=").append(user.getFirstName()).append("*)"); - } - if(Utilities.nvl(user.getLastName()).length() > 0) { - filterClause.append("(sn=").append(user.getLastName()).append("*)"); - } - if(Utilities.nvl(user.getHrid()).length() > 0) { - filterClause.append("(employeeNumber=").append(user.getHrid()).append("*)"); - } - if(Utilities.nvl(user.getOrgManagerUserId()).length() > 0) { - filterClause.append("(mgrid=").append(user.getOrgManagerUserId()).append("*)"); - } - if(Utilities.nvl(user.getOrgCode()).length() > 0) { - filterClause.append("(departmentNumber=").append(user.getOrgCode()).append("*)"); - } - if(Utilities.nvl(user.getEmail()).length() > 0) { - filterClause.append("(mail=").append(user.getEmail()).append("*)"); - } - if(Utilities.nvl(user.getOrgUserId()).length() > 0) { - filterClause.append("(a1=").append(user.getOrgUserId()).append("*)"); - } - filterClause.append("(c3=N)"); // this has been added to filter CP09 entries on the LDAP server that are duplicates of existing individuals - filterClause.append(")"); + SearchControls searchControls = new SearchControls(); + searchControls.setTimeLimit(5000); + searchControls.setReturningAttributes(postAttributes); - List list = new ArrayList(); - if (!filterClause.toString().equals("(&(objectClass=*))")) { - NamingEnumeration e = dirContext.search(SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL) + "/" + - SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL), - filterClause.toString(), - searchControls); - list = processResults(e); - } - - Collections.sort(list); + StringBuffer filterClause = new StringBuffer("(&(objectClass=*)"); - searchResult = new SearchResult(list); - searchResult.setPageNo(pageNo); - if(dataSize >= 0) { - searchResult.setDataSize(dataSize); - } - else { - searchResult.setDataSize(list.size()); - } - } catch(NamingException ne) { - String stackTrace = EcompPortalUtils.getStackTrace(ne); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while performing the LDAP search. Details: " + stackTrace); - } catch(Exception e) { - String stackTrace = EcompPortalUtils.getStackTrace(e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while performing the LDAP search. Details: " + stackTrace); - } - finally { - dirContext.close(); - } + EPUser user = (EPUser) searchCriteria; - return searchResult; - } + if (Utilities.nvl(user.getFirstName()).length() > 0) { + filterClause.append("(givenName=").append(user.getFirstName()).append("*)"); + } + if (Utilities.nvl(user.getLastName()).length() > 0) { + filterClause.append("(sn=").append(user.getLastName()).append("*)"); + } + if (Utilities.nvl(user.getHrid()).length() > 0) { + filterClause.append("(employeeNumber=").append(user.getHrid()).append("*)"); + } + if (Utilities.nvl(user.getOrgManagerUserId()).length() > 0) { + filterClause.append("(mgrid=").append(user.getOrgManagerUserId()).append("*)"); + } + if (Utilities.nvl(user.getOrgCode()).length() > 0) { + filterClause.append("(departmentNumber=").append(user.getOrgCode()).append("*)"); + } + if (Utilities.nvl(user.getEmail()).length() > 0) { + filterClause.append("(mail=").append(user.getEmail()).append("*)"); + } + if (Utilities.nvl(user.getOrgUserId()).length() > 0) { + filterClause.append("(a1=").append(user.getOrgUserId()).append("*)"); + } + filterClause.append("(c3=N)"); // this has been added to filter CP09 entries on the LDAP server that are + // duplicates of existing individuals + filterClause.append(")"); + List list = new ArrayList(); + if (!filterClause.toString().equals("(&(objectClass=*))")) { + NamingEnumeration e = dirContext.search( + SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL) + "/" + + SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL), + filterClause.toString(), searchControls); + list = processResults(e); + } - @SuppressWarnings({ "rawtypes", "unchecked" }) - @EPMetricsLog - private ArrayList processResults(NamingEnumeration e) throws NamingException { - ArrayList results = new ArrayList(); - int count = 0; + Collections.sort(list); - while (e.hasMore()) { - javax.naming.directory.SearchResult searchResult = (javax.naming.directory.SearchResult)e.next(); - results.add(processAttributes(searchResult.getAttributes())); - count++; + searchResult = new SearchResult(list); + searchResult.setPageNo(pageNo); + if (dataSize >= 0) { + searchResult.setDataSize(dataSize); + } else { + searchResult.setDataSize(list.size()); + } + } catch (NamingException ne) { + logger.error(EELFLoggerDelegate.errorLogger, "searchPost failed with naming exception", ne); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "searchPost failed", e); + } finally { + dirContext.close(); + } - if(count > Integer.parseInt(SystemProperties.getProperty(SystemProperties.POST_MAX_RESULT_SIZE))) { - break; - } - } - return results; - } + return searchResult; + } + @SuppressWarnings({ "rawtypes", "unchecked" }) + @EPMetricsLog + private ArrayList processResults(NamingEnumeration e) throws NamingException { + ArrayList results = new ArrayList(); + int count = 0; - @SuppressWarnings("rawtypes") - @EPMetricsLog + while (e.hasMore()) { + javax.naming.directory.SearchResult searchResult = (javax.naming.directory.SearchResult) e.next(); + results.add(processAttributes(searchResult.getAttributes())); + count++; + + if (count > Integer.parseInt(SystemProperties.getProperty(SystemProperties.POST_MAX_RESULT_SIZE))) { + break; + } + } + return results; + } + + @SuppressWarnings("rawtypes") + @EPMetricsLog private DomainVo processAttributes(Attributes resultAttributes) throws NamingException { - EPUser user = new EPUser(); + EPUser user = new EPUser(); + + try { + if (resultAttributes == null) { + logger.debug(EELFLoggerDelegate.debugLogger, "This result has no attributes"); + } else { + for (NamingEnumeration e = resultAttributes.getAll(); e.hasMore();) { // why the nested loop? + Attribute attribute = (Attribute) e.next(); + for (NamingEnumeration ie = attribute.getAll(); ie.hasMore();) { + if (attribute.getID().equalsIgnoreCase("nickname")) { + user.setFirstName((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("initials")) { + user.setMiddleInitial((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("sn")) { + user.setLastName((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("employeeNumber")) { + user.setHrid((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("mail")) { + user.setEmail((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("telephoneNumber")) { + user.setPhone((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("departmentNumber")) { + user.setOrgCode((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("a1")) { + user.setOrgUserId((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("street")) { + user.setAddress1((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("roomNumber")) { + user.setAddress2((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("l")) { + user.setCity((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("st")) { + user.setState((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("postalCode")) { + user.setZipCode((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("zip4")) { + user.setZipCodeSuffix((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("physicalDeliveryOfficeName")) { + user.setLocationClli((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("bc")) { + user.setBusinessCountryCode((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("friendlyCountryName")) { + user.setBusinessCountryName((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("bd")) { + user.setDepartment((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("bdname")) { + user.setDepartmentName((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("jtname")) { + user.setJobTitle((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("mgrid")) { + user.setOrgManagerUserId((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("a2")) { + user.setCommandChain((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("compcode")) { + user.setCompanyCode((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("compdesc")) { + user.setCompany((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("bu")) { + user.setBusinessUnit((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("buname")) { + user.setBusinessUnitName((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("silo")) { + user.setSiloStatus((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("costcenter")) { + user.setCostCenter((String) ie.next()); + } else if (attribute.getID().equalsIgnoreCase("b2")) { + user.setFinancialLocCode((String) ie.next()); + } else { // we don't care about returned attribute, let's move on + ie.next(); + } - try { - if (resultAttributes == null) { - logger.debug(EELFLoggerDelegate.debugLogger, "This result has no attributes"); - } else { - for (NamingEnumeration e = resultAttributes.getAll(); e.hasMore();) { //why the nested loop? - Attribute attribute = (Attribute)e.next(); - for (NamingEnumeration ie = attribute.getAll(); ie.hasMore();) { - if (attribute.getID().equalsIgnoreCase("nickname")) { - user.setFirstName((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("initials")) { - user.setMiddleInitial((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("sn")) { - user.setLastName((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("employeeNumber")) { - user.setHrid((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("mail")) { - user.setEmail((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("telephoneNumber")) { - user.setPhone((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("departmentNumber")) { - user.setOrgCode((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("a1")) { - user.setOrgUserId((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("street")) { - user.setAddress1((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("roomNumber")) { - user.setAddress2((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("l")) { - user.setCity((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("st")) { - user.setState((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("postalCode")) { - user.setZipCode((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("zip4")) { - user.setZipCodeSuffix((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("physicalDeliveryOfficeName")) { - user.setLocationClli((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("bc")) { - user.setBusinessCountryCode((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("friendlyCountryName")) { - user.setBusinessCountryName((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("bd")) { - user.setDepartment((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("bdname")) { - user.setDepartmentName((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("jtname")) { - user.setJobTitle((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("mgrid")) { - user.setOrgManagerUserId((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("a2")) { - user.setCommandChain((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("compcode")) { - user.setCompanyCode((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("compdesc")) { - user.setCompany((String) ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("bu")) { - user.setBusinessUnit((String)ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("buname")) { - user.setBusinessUnitName((String)ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("silo")) { - user.setSiloStatus((String)ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("costcenter")) { - user.setCostCenter((String)ie.next()); - } - else if (attribute.getID().equalsIgnoreCase("b2")) { - user.setFinancialLocCode((String)ie.next()); - } - else { //we don't care about returned attribute, let's move on - ie.next(); - } + } + } + } + } catch (NamingException e) { + logger.error(EELFLoggerDelegate.errorLogger, "processAttributes failed with naming exception", e); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "processAttributes failed", e); + } - } - } - } - } catch (NamingException e) { - String stackTrace = EcompPortalUtils.getStackTrace(e); - logger.error(EELFLoggerDelegate.errorLogger, "An error occurred while processing the following user from POST with an Organization User ID of " + user.getOrgUserId()); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occcurred while processing LDAP search results, Details: " + stackTrace); - } catch(Exception e) { - String stackTrace = EcompPortalUtils.getStackTrace(e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occcurred while processing LDAP search results, Details: " + stackTrace); - } - - return user; - } + return user; + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuService.java index 9785f2b0..145d4df2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuServiceImpl.java index f24ab87f..fe661b3d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLeftMenuServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginService.java index d8d2a290..d3224944 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginServiceImpl.java index f9125064..f4710478 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPLoginServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionService.java index 66a9ccc2..5c5b15cf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionService.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import java.util.List; @@ -9,21 +46,21 @@ import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalsdk.core.domain.RoleFunction; public interface EPRoleFunctionService { + /** * Builds a set of role functions and sets a session attribute with it. * - * @param request - * HttpServletRequest * @return Set of role functions that was built. */ public List<RoleFunction> getRoleFunctions(); - - + /** - * Builds a set of role functions of user + * Builds a set of role functions of user * * @param request * HttpServletRequest + * @param user + * EPUser * @return Set of role functions that was built. */ public Set getRoleFunctions(HttpServletRequest request, EPUser user); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImpl.java index d41100ff..814dbaf5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImpl.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import java.util.ArrayList; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImpl.java index f36aa544..2049700c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImpl.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import java.util.HashMap; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleService.java index cec7dd64..85b523db 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleServiceImpl.java index 3efe4382..e4c67140 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/EPRoleServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesService.java index 77ce88c5..643e2285 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesService.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import java.util.List; @@ -36,7 +73,7 @@ public interface ExternalAccessRolesService { * Adds role in the external access system if fails throws exception * * @param addRoles - * @param UE + * @param uebkey * @return boolean * @throws Exception */ diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java index 97fa98e5..341a62cb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImpl.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import java.util.ArrayList; @@ -1347,12 +1384,12 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic logger.debug(EELFLoggerDelegate.debugLogger, "deleteDependencyRoleRecord: committed the transaction"); result = true; } catch(HttpClientErrorException e){ - logger.error(EELFLoggerDelegate.errorLogger, "HttpClientErrorException - Failed to deleteRoleDependeciesRecord", e); + logger.error(EELFLoggerDelegate.errorLogger, "deleteDependencyRoleRecord: HttpClientErrorException", e); EPLogUtil.logExternalAuthAccessAlarm(logger, e.getStatusCode()); } catch (Exception e) { - EcompPortalUtils.rollbackTransaction(transaction, "deleteDependencyRoleRecord: rollback, exception = " + e); - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); - result = false; + logger.error(EELFLoggerDelegate.errorLogger, "deleteDependencyRoleRecord failed", e); + EcompPortalUtils.rollbackTransaction(transaction, + "deleteDependencyRoleRecord rollback, exception = " + e.toString()); } finally { localSession.close(); } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuService.java index c9aac85e..af049ffe 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuServiceImpl.java index 87143e85..26f1431e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/FunctionalMenuServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -35,13 +53,6 @@ import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.SystemProperties; import org.openecomp.portalapp.portal.domain.EPApp; import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalapp.portal.domain.FunctionalMenuItemWithAppID; @@ -55,6 +66,12 @@ import org.openecomp.portalapp.portal.transport.FunctionalMenuItemWithRoles; import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.service.DataAccessService; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; @Service("functionalMenuService") @org.springframework.context.annotation.Configuration @@ -74,12 +91,13 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { @PostConstruct private void init() { try { - ACCOUNT_ADMIN_ROLE_ID = Long.valueOf(SystemProperties.getProperty(EPCommonSystemProperties.ACCOUNT_ADMIN_ROLE_ID)); + ACCOUNT_ADMIN_ROLE_ID = Long + .valueOf(SystemProperties.getProperty(EPCommonSystemProperties.ACCOUNT_ADMIN_ROLE_ID)); RESTRICTED_APP_ROLE_ID = SystemProperties.getProperty(EPCommonSystemProperties.RESTRICTED_APP_ROLE_ID); - } catch(Exception e) { + } catch (Exception e) { } } - + public List<FunctionalMenuItem> getFunctionalMenuItems(EPUser user) { List<FunctionalMenuItem> menuItems = new ArrayList<FunctionalMenuItem>(); return menuItems; @@ -88,39 +106,38 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { public List<FunctionalMenuItem> getFunctionalMenuItems() { return getFunctionalMenuItems(false); } - + public List<FunctionalMenuItem> getFunctionalMenuItems(Boolean all) { - // Divide this into 2 queries: one which returns the bottom-level menu items associated with Restricted apps, - // and one that returns all the other menu items. Then we can easily add the boolean flag + // Divide this into 2 queries: one which returns the bottom-level menu items + // associated with Restricted apps, + // and one that returns all the other menu items. Then we can easily add the + // boolean flag // restrictedApp to each FunctionalMenuItem, to be used by the front end. String activeWhereClause = ""; - if (! all) { + if (!all) { activeWhereClause = " AND UPPER(m.active_yn) = 'Y' "; } String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id " - + "FROM fn_menu_functional m, fn_menu_functional_roles r " - + "WHERE m.menu_id = r.menu_id " - + activeWhereClause //" AND UPPER(m.active_yn) = 'Y' " - + " AND r.role_id != '" + RESTRICTED_APP_ROLE_ID + "' " - + " UNION " - + " SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn,-1 app_id " - + " FROM fn_menu_functional m " - + " WHERE m.url='' " - + activeWhereClause; //" AND UPPER(m.active_yn) = 'Y' "; + + "FROM fn_menu_functional m, fn_menu_functional_roles r " + "WHERE m.menu_id = r.menu_id " + + activeWhereClause // " AND UPPER(m.active_yn) = 'Y' " + + " AND r.role_id != '" + RESTRICTED_APP_ROLE_ID + "' " + " UNION " + + " SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn,-1 app_id " + + " FROM fn_menu_functional m " + " WHERE m.url='' " + activeWhereClause; // " AND UPPER(m.active_yn) = + // 'Y' "; logQuery(sql); @SuppressWarnings("unchecked") - List<FunctionalMenuItemWithAppID> menuItemsWithAppIdList = dataAccessService.executeSQLQuery(sql,FunctionalMenuItemWithAppID.class, null); - List<FunctionalMenuItem> menuItems = new ArrayList<>(); + List<FunctionalMenuItemWithAppID> menuItemsWithAppIdList = dataAccessService.executeSQLQuery(sql, + FunctionalMenuItemWithAppID.class, null); + List<FunctionalMenuItem> menuItems = new ArrayList<>(); menuItems = transformFunctionalMenuItemWithAppIDToFunctionalMenuItem(menuItemsWithAppIdList); for (FunctionalMenuItem menuItem : menuItems) { menuItem.restrictedApp = false; } - + sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id " - + "FROM fn_menu_functional m, fn_menu_functional_roles r " - + "WHERE m.menu_id = r.menu_id " - + activeWhereClause //" AND UPPER(m.active_yn) = 'Y' " + + "FROM fn_menu_functional m, fn_menu_functional_roles r " + "WHERE m.menu_id = r.menu_id " + + activeWhereClause // " AND UPPER(m.active_yn) = 'Y' " + " AND r.role_id = '" + RESTRICTED_APP_ROLE_ID + "' "; logQuery(sql); @SuppressWarnings("unchecked") @@ -129,44 +146,42 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { menuItem.restrictedApp = true; menuItems.add(menuItem); } - + return menuItems; } - public List<FunctionalMenuItem> getFunctionalMenuItemsForNotificationTree(Boolean all) { - // Divide this into 2 queries: one which returns the bottom-level menu items associated with Restricted apps, - // and one that returns all the other menu items which are active. Then we can easily add the boolean flag + // Divide this into 2 queries: one which returns the bottom-level menu items + // associated with Restricted apps, + // and one that returns all the other menu items which are active. Then we can + // easily add the boolean flag // restrictedApp to each FunctionalMenuItem, to be used by the front end. String activeWhereClause = ""; - if (! all) { + if (!all) { activeWhereClause = " AND UPPER(m.active_yn) = 'Y' "; } String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id " - + "FROM fn_menu_functional m, fn_menu_functional_roles r " - + "WHERE m.menu_id = r.menu_id " - + activeWhereClause + " AND UPPER(m.active_yn) = 'Y' " - + " AND r.role_id != '" + RESTRICTED_APP_ROLE_ID + "' " - + " UNION " - + " SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn,-1 app_id " - + " FROM fn_menu_functional m " - + " WHERE m.url='' " - + activeWhereClause + " AND UPPER(m.active_yn) = 'Y' "; + + "FROM fn_menu_functional m, fn_menu_functional_roles r " + "WHERE m.menu_id = r.menu_id " + + activeWhereClause + " AND UPPER(m.active_yn) = 'Y' " + " AND r.role_id != '" + RESTRICTED_APP_ROLE_ID + + "' " + " UNION " + + " SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn,-1 app_id " + + " FROM fn_menu_functional m " + " WHERE m.url='' " + activeWhereClause + + " AND UPPER(m.active_yn) = 'Y' "; logQuery(sql); @SuppressWarnings("unchecked") - List<FunctionalMenuItemWithAppID> menuItemsWithAppIdList = dataAccessService.executeSQLQuery(sql,FunctionalMenuItemWithAppID.class, null); - List<FunctionalMenuItem> menuItems = new ArrayList<>(); + List<FunctionalMenuItemWithAppID> menuItemsWithAppIdList = dataAccessService.executeSQLQuery(sql, + FunctionalMenuItemWithAppID.class, null); + List<FunctionalMenuItem> menuItems = new ArrayList<>(); menuItems = transformFunctionalMenuItemWithAppIDToFunctionalMenuItem(menuItemsWithAppIdList); for (FunctionalMenuItem menuItem : menuItems) { menuItem.restrictedApp = false; } - + sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn, r.app_id " - + "FROM fn_menu_functional m, fn_menu_functional_roles r " - + "WHERE m.menu_id = r.menu_id " - + activeWhereClause + " AND UPPER(m.active_yn) = 'Y' " - + " AND r.role_id = '" + RESTRICTED_APP_ROLE_ID + "' "; + + "FROM fn_menu_functional m, fn_menu_functional_roles r " + "WHERE m.menu_id = r.menu_id " + + activeWhereClause + " AND UPPER(m.active_yn) = 'Y' " + " AND r.role_id = '" + RESTRICTED_APP_ROLE_ID + + "' "; logQuery(sql); @SuppressWarnings("unchecked") List<FunctionalMenuItem> menuItems2 = dataAccessService.executeSQLQuery(sql, FunctionalMenuItem.class, null); @@ -174,77 +189,77 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { menuItem.restrictedApp = true; menuItems.add(menuItem); } - + return menuItems; } public List<FunctionalMenuItem> getFunctionalMenuItemsForApp(Integer appId) { String sql = "SELECT DISTINCT m1.menu_id, m1.column_num, m1.text, m1.parent_menu_id, m1.url, m.active_yn " + " FROM fn_menu_functional m, fn_menu_functional m1, fn_menu_functional_ancestors a, fn_menu_functional_roles mr " - + " WHERE " + " mr.app_id='" + appId + "' " + " AND mr.menu_id = m.menu_id " + " AND UPPER(m.active_yn) = 'Y'" - + " AND UPPER(m1.active_yn) ='Y'" + " AND a.menu_id = m.menu_id " + " AND a.ancestor_menu_id = m1.menu_id"; + + " WHERE " + " mr.app_id='" + appId + "' " + " AND mr.menu_id = m.menu_id " + + " AND UPPER(m.active_yn) = 'Y'" + " AND UPPER(m1.active_yn) ='Y'" + " AND a.menu_id = m.menu_id " + + " AND a.ancestor_menu_id = m1.menu_id"; logQuery(sql); logger.debug(EELFLoggerDelegate.debugLogger, "getFunctionalMenuItemsForApp: logged the query"); @SuppressWarnings("unchecked") List<FunctionalMenuItem> menuItems = dataAccessService.executeSQLQuery(sql, FunctionalMenuItem.class, null); - + return menuItems; } + /** * convert List of FunctionalMenuItemWithAppID into List of FunctionalMenuItem * */ - public List<FunctionalMenuItem> transformFunctionalMenuItemWithAppIDToFunctionalMenuItem(List<FunctionalMenuItemWithAppID> functionalMenuItemWithAppIDList) { + public List<FunctionalMenuItem> transformFunctionalMenuItemWithAppIDToFunctionalMenuItem( + List<FunctionalMenuItemWithAppID> functionalMenuItemWithAppIDList) { List<FunctionalMenuItem> functionalMenuItemList = new ArrayList<FunctionalMenuItem>(); for (FunctionalMenuItemWithAppID functionalMenuItemWithAppID : functionalMenuItemWithAppIDList) { FunctionalMenuItem menuItem = new FunctionalMenuItem(); - menuItem.menuId=functionalMenuItemWithAppID.menuId; - menuItem.column=functionalMenuItemWithAppID.column; - menuItem.text=functionalMenuItemWithAppID.text; - menuItem.parentMenuId=functionalMenuItemWithAppID.parentMenuId; - menuItem.url=functionalMenuItemWithAppID.url; - menuItem.active_yn=functionalMenuItemWithAppID.active_yn; - menuItem.appid=functionalMenuItemWithAppID.appid; + menuItem.menuId = functionalMenuItemWithAppID.menuId; + menuItem.column = functionalMenuItemWithAppID.column; + menuItem.text = functionalMenuItemWithAppID.text; + menuItem.parentMenuId = functionalMenuItemWithAppID.parentMenuId; + menuItem.url = functionalMenuItemWithAppID.url; + menuItem.active_yn = functionalMenuItemWithAppID.active_yn; + menuItem.appid = functionalMenuItemWithAppID.appid; menuItem.setRoles(functionalMenuItemWithAppID.roles); - menuItem.restrictedApp=functionalMenuItemWithAppID.restrictedApp; + menuItem.restrictedApp = functionalMenuItemWithAppID.restrictedApp; functionalMenuItemList.add(menuItem); } return functionalMenuItemList; } - + public List<FunctionalMenuItem> getFunctionalMenuItemsForUser(String orgUserId) { // m represents the functional menu items that are the leaf nodes // m1 represents the functional menu items for all the nodes - // Divide this into 2 queries: one which returns the bottom-level menu items associated with Restricted apps, - // and one that returns all the other menu items. Then we can easily add the boolean flag + // Divide this into 2 queries: one which returns the bottom-level menu items + // associated with Restricted apps, + // and one that returns all the other menu items. Then we can easily add the + // boolean flag // restrictedApp to each FunctionalMenuItem, to be used by the front end. String sql = "SELECT DISTINCT m1.menu_id, m1.column_num, m1.text, m1.parent_menu_id, m1.url, m.active_yn " + " FROM fn_menu_functional m, fn_menu_functional m1, fn_menu_functional_ancestors a, " - + " fn_menu_functional_roles mr, fn_user u , fn_user_role ur " + " WHERE " + " u.org_user_id='" + orgUserId - + "' " + " AND u.user_id = ur.user_id " + " AND ur.app_id = mr.app_id " + + + " fn_menu_functional_roles mr, fn_user u , fn_user_role ur " + " WHERE " + " u.org_user_id='" + + orgUserId + "' " + " AND u.user_id = ur.user_id " + " AND ur.app_id = mr.app_id " + // " AND ur.role_id = mr.role_id " + " AND (ur.role_id = mr.role_id " + " OR ur.role_id = '" + ACCOUNT_ADMIN_ROLE_ID + "') " + " AND m.menu_id = mr.menu_id " + " AND UPPER(m.active_yn) = 'Y'" + " AND UPPER(m1.active_yn) ='Y' " - + " AND a.menu_id = m.menu_id " + " AND a.ancestor_menu_id = m1.menu_id " - + " UNION " + + " AND a.menu_id = m.menu_id " + " AND a.ancestor_menu_id = m1.menu_id " + " UNION " // the ancestors of the restricted app menu items + " select m1.menu_id, m1.column_num, m1.text, m1.parent_menu_id, m1.url, m1.active_yn " + " FROM fn_menu_functional m, fn_menu_functional_roles mr, fn_menu_functional m1, " - + " fn_menu_functional_ancestors a " - + " where a.menu_id = m.menu_id " - + " AND a.ancestor_menu_id = m1.menu_id " - + " AND m.menu_id != m1.menu_id " - + " AND m.menu_id = mr.menu_id " - + " AND mr.role_id = '" + RESTRICTED_APP_ROLE_ID + "' " + + " fn_menu_functional_ancestors a " + " where a.menu_id = m.menu_id " + + " AND a.ancestor_menu_id = m1.menu_id " + " AND m.menu_id != m1.menu_id " + + " AND m.menu_id = mr.menu_id " + " AND mr.role_id = '" + RESTRICTED_APP_ROLE_ID + "' " + " AND UPPER(m.active_yn) = 'Y'" + " AND UPPER(m1.active_yn) ='Y' " // Add the Favorites menu item - + " UNION " - + " SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn " + + " UNION " + " SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn " + " FROM fn_menu_functional m " + " WHERE m.text in ('Favorites','Get Access','Contact Us','Support','User Guide','Help')"; - + logQuery(sql); logger.debug(EELFLoggerDelegate.debugLogger, "getFunctionalMenuItemsForUser: logged the query"); @@ -253,12 +268,10 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { for (FunctionalMenuItem menuItem : menuItems) { menuItem.restrictedApp = false; } - + sql = " SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn " - + " FROM fn_menu_functional m, fn_menu_functional_roles r " - + " WHERE m.menu_id = r.menu_id " - + " AND UPPER(m.active_yn) = 'Y' " - + " AND r.role_id = '" + RESTRICTED_APP_ROLE_ID + "' "; + + " FROM fn_menu_functional m, fn_menu_functional_roles r " + " WHERE m.menu_id = r.menu_id " + + " AND UPPER(m.active_yn) = 'Y' " + " AND r.role_id = '" + RESTRICTED_APP_ROLE_ID + "' "; logQuery(sql); @SuppressWarnings("unchecked") List<FunctionalMenuItem> menuItems2 = dataAccessService.executeSQLQuery(sql, FunctionalMenuItem.class, null); @@ -266,7 +279,7 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { menuItem.restrictedApp = true; menuItems.add(menuItem); } - + return menuItems; } @@ -289,12 +302,13 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { menuItem.appid = appid; List<Integer> roles = new ArrayList<Integer>(); for (FunctionalMenuRole roleItem : roleItems) { - logger.debug(EELFLoggerDelegate.debugLogger, "LR: app_id: " + roleItem.appId + "; role_id: " + roleItem.roleId + "\n"); + logger.debug(EELFLoggerDelegate.debugLogger, + "LR: app_id: " + roleItem.appId + "; role_id: " + roleItem.roleId + "\n"); roles.add(roleItem.roleId); } menuItem.setRoles(roles); } - + return menuItem; } @@ -305,7 +319,7 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { @SuppressWarnings("unchecked") List<FunctionalMenuItem> functionalMenuItems = dataAccessService.getList(FunctionalMenuItem.class, " where text = '" + menuItemJson.text + "'", null, null); - + boolean dublicatedName = false; for (FunctionalMenuItem fnMenuItem : functionalMenuItems) { if (menuItemJson.menuId != null && menuItemJson.menuId.equals(fnMenuItem.menuId)) { @@ -322,43 +336,49 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { fieldsValidator.addProblematicFieldName("text"); fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_CONFLICT); fieldsValidator.errorCode = new Long(EPCommonSystemProperties.DUBLICATED_FIELD_VALUE_ECOMP_ERROR); - logger.debug(EELFLoggerDelegate.debugLogger, "In menuItemFieldsChecker, Error: we have an duplicate text field"); - } else if (StringUtils.isEmpty(menuItemJson.text) && menuItemJson.menuId == null) { - // text must be non empty for a create. For an edit, can be empty, which means it is a move request. + logger.debug(EELFLoggerDelegate.debugLogger, + "In menuItemFieldsChecker, Error: we have an duplicate text field"); + } else if (StringUtils.isEmpty(menuItemJson.text) && menuItemJson.menuId == null) { + // text must be non empty for a create. For an edit, can be empty, which means + // it is a move request. // a null menuId indicates a create. fieldsValidator.addProblematicFieldName("text"); fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_BAD_REQUEST); - logger.debug(EELFLoggerDelegate.debugLogger, "In menuItemFieldsChecker, Error: we have an empty text field"); + logger.debug(EELFLoggerDelegate.debugLogger, + "In menuItemFieldsChecker, Error: we have an empty text field"); } else { // The url, appid, and roles must either be all filled or all empty. Boolean urlIsEmpty = StringUtils.isEmpty(menuItemJson.url); Boolean rolesIsEmpty = menuItemJson.getRoles() == null || menuItemJson.getRoles().isEmpty(); Boolean appidIsEmpty = menuItemJson.appid == null || menuItemJson.appid == 0; - logger.debug(EELFLoggerDelegate.debugLogger, "LR: menuItemfieldsChecker: urlIsEmpty: " + urlIsEmpty + "; rolesIsEmpty: " + rolesIsEmpty + "; appidIsEmpty: " + appidIsEmpty +"\n"); - if (!((urlIsEmpty && rolesIsEmpty && appidIsEmpty) || (!urlIsEmpty && !rolesIsEmpty && !appidIsEmpty))) - { + logger.debug(EELFLoggerDelegate.debugLogger, "LR: menuItemfieldsChecker: urlIsEmpty: " + urlIsEmpty + + "; rolesIsEmpty: " + rolesIsEmpty + "; appidIsEmpty: " + appidIsEmpty + "\n"); + if (!((urlIsEmpty && rolesIsEmpty && appidIsEmpty) + || (!urlIsEmpty && !rolesIsEmpty && !appidIsEmpty))) { fieldsValidator.addProblematicFieldName("url,roles,appid"); fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_BAD_REQUEST); - logger.debug(EELFLoggerDelegate.debugLogger, "In menuItemFieldsChecker, Error: we don't have: either all 3 fields empty or all 3 fields nonempty"); + logger.debug(EELFLoggerDelegate.debugLogger, + "In menuItemFieldsChecker, Error: we don't have: either all 3 fields empty or all 3 fields nonempty"); } else { - logger.debug(EELFLoggerDelegate.debugLogger, "In menuItemFieldsChecker, Success: either all 3 fields empty or all 3 fields nonempty"); + logger.debug(EELFLoggerDelegate.debugLogger, + "In menuItemFieldsChecker, Success: either all 3 fields empty or all 3 fields nonempty"); } } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while validating the FunctionalMenuItems. Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "menuItemFieldsChecker failed", e); fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } - + return fieldsValidator; } - + // Turn foreign key checks on or off protected void setForeignKeys(Session localSession, Boolean on) { String keyCheck = "0"; if (on) { keyCheck = "1"; } - String sql = "set FOREIGN_KEY_CHECKS="+keyCheck; + String sql = "set FOREIGN_KEY_CHECKS=" + keyCheck; logQuery(sql); Query query = localSession.createSQLQuery(sql); query.executeUpdate(); @@ -380,12 +400,12 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { menuItem.parentMenuId = menuItemJson.parentMenuId; menuItem.active_yn = "Y"; localSession = sessionFactory.openSession(); - + // If the app is disabled, deactivate the menu item. if (menuItemJson.appid != null) { Long appidLong = Long.valueOf(menuItemJson.appid); EPApp app = (EPApp) localSession.get(EPApp.class, appidLong); - if (app != null && ! app.getEnabled()) { + if (app != null && !app.getEnabled()) { menuItem.active_yn = "N"; } } @@ -415,20 +435,22 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { transaction.commit(); result = true; } catch (Exception e) { - EcompPortalUtils.rollbackTransaction(transaction, - "createFunctionalMenuItem rollback, exception = " + e); - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "createFunctionalMenuItem failed", e); + EcompPortalUtils.rollbackTransaction(transaction, + "createFunctionalMenuItem rollback, exception = " + e.toString()); } finally { EcompPortalUtils.closeLocalSession(localSession, "createFunctionalMenuItem"); } if (result) { } else { - logger.debug(EELFLoggerDelegate.debugLogger, "LR: createFunctionalMenuItem: no result. setting httpStatusCode to " - + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + logger.debug(EELFLoggerDelegate.debugLogger, + "LR: createFunctionalMenuItem: no result. setting httpStatusCode to " + + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } else { - logger.error(EELFLoggerDelegate.errorLogger, "FunctionalMenuServiceImpl.createFunctionalMenuItem: bad request"); + logger.error(EELFLoggerDelegate.errorLogger, + "FunctionalMenuServiceImpl.createFunctionalMenuItem: bad request"); } return fieldsValidator; } @@ -461,7 +483,7 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { public void deleteFavorites(Long menuId) { dataAccessService.deleteDomainObjects(FavoritesFunctionalMenuItem.class, "menu_id='" + menuId + "'", null); } - + private Boolean parentMenuIdEqual(Integer menuId1, Integer menuId2) { return ((menuId1 == null && menuId2 == null) || (menuId1 != null && menuId1.equals(menuId2))); } @@ -532,8 +554,8 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { } // Adjust the children under the new parent. logger.debug(EELFLoggerDelegate.debugLogger, "about to adjust the children under the new parent"); - logger.debug(EELFLoggerDelegate.debugLogger, "get all menu items where menuId!=" + menuId + "; parentMenuId==" + newParentMenuId - + "; column>=" + newColumn); + logger.debug(EELFLoggerDelegate.debugLogger, "get all menu items where menuId!=" + menuId + + "; parentMenuId==" + newParentMenuId + "; column>=" + newColumn); criteria = localSession.createCriteria(FunctionalMenuItem.class); criteria.add(Restrictions.ne("menuId", menuId)); if (newParentMenuId == null) { @@ -568,10 +590,10 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { } public FieldsValidator editFunctionalMenuItem(FunctionalMenuItemWithRoles menuItemJson) { - boolean result = false; - Session localSession = null; + boolean result = false; + Session localSession = null; Transaction transaction = null; - Long menuId = menuItemJson.menuId; + Long menuId = menuItemJson.menuId; logger.debug(EELFLoggerDelegate.debugLogger, "LR: editFunctionalMenuItem: test 1"); FieldsValidator fieldsValidator = menuItemFieldsChecker(menuItemJson); @@ -580,7 +602,8 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { // in db table. if (menuId == null) { fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_BAD_REQUEST); - logger.error(EELFLoggerDelegate.errorLogger, "FunctionalMenuServiceImpl.editFunctionalMenuItem: bad request"); + logger.error(EELFLoggerDelegate.errorLogger, + "FunctionalMenuServiceImpl.editFunctionalMenuItem: bad request"); } else { // To simplify the code, assume we will have a transaction try { @@ -588,16 +611,19 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { transaction = localSession.beginTransaction(); // Get the existing info associated with menuItem from the DB - FunctionalMenuItem menuItem = (FunctionalMenuItem) localSession.get(FunctionalMenuItem.class, menuId); + FunctionalMenuItem menuItem = (FunctionalMenuItem) localSession.get(FunctionalMenuItem.class, + menuId); Integer oldColumn = menuItem.column; Integer oldParentMenuId = menuItem.parentMenuId; Integer newColumn = menuItemJson.column; Integer newParentMenuId = menuItemJson.parentMenuId; - logger.debug(EELFLoggerDelegate.debugLogger, "prev info: column: " + oldColumn + "; parentMenuId: " + oldParentMenuId); + logger.debug(EELFLoggerDelegate.debugLogger, + "prev info: column: " + oldColumn + "; parentMenuId: " + oldParentMenuId); - if (menuItemJson.appid != null && menuItemJson.getRoles() != null && !menuItemJson.getRoles().isEmpty() - && menuItemJson.url != null && !menuItemJson.url.isEmpty() && menuItemJson.text != null + if (menuItemJson.appid != null && menuItemJson.getRoles() != null + && !menuItemJson.getRoles().isEmpty() && menuItemJson.url != null + && !menuItemJson.url.isEmpty() && menuItemJson.text != null && !menuItemJson.text.isEmpty()) { // Scenario: appid, roles, url and text are all non-null. // This menu item is associated with an app. @@ -618,21 +644,21 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { menuItem.setRoles(menuItemJson.getRoles()); menuItem.url = menuItemJson.url; menuItem.text = menuItemJson.text; - + // If the app is disabled, deactivate the menu item. Long appidLong = Long.valueOf(menuItemJson.appid); EPApp app = (EPApp) localSession.get(EPApp.class, appidLong); - if (app != null && ! app.getEnabled()) { + if (app != null && !app.getEnabled()) { menuItem.active_yn = "N"; } else { menuItem.active_yn = "Y"; } - localSession.update(menuItem); addRoles(menuItemJson, localSession); - } else if (menuItemJson.appid == null && (menuItemJson.getRoles() == null || menuItemJson.getRoles().isEmpty()) + } else if (menuItemJson.appid == null + && (menuItemJson.getRoles() == null || menuItemJson.getRoles().isEmpty()) && (menuItemJson.url == null || menuItemJson.url.isEmpty()) && menuItemJson.text != null && !menuItemJson.text.isEmpty()) { // Scenario: appid, roles and url are all null; text is @@ -686,25 +712,27 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { } transaction.commit(); - logger.debug(EELFLoggerDelegate.debugLogger, "LR: editFunctionalMenuItem: finished committing transaction"); + logger.debug(EELFLoggerDelegate.debugLogger, + "LR: editFunctionalMenuItem: finished committing transaction"); result = true; } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "editFunctionalMenuItem failed", e); EcompPortalUtils.rollbackTransaction(transaction, - "createFunctionalMenuItem rollback, exception = " + e); - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + "createFunctionalMenuItem rollback, exception = " + e.toString()); } finally { EcompPortalUtils.closeLocalSession(localSession, "editFunctionalMenuItem"); } - + if (result) { } else { - logger.debug(EELFLoggerDelegate.debugLogger, "LR: createFunctionalMenuItem: no result. setting httpStatusCode to " - + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + logger.debug(EELFLoggerDelegate.debugLogger, + "LR: createFunctionalMenuItem: no result. setting httpStatusCode to " + + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } - } - + } + return fieldsValidator; } @@ -718,7 +746,8 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { try { localSession = sessionFactory.openSession(); transaction = localSession.beginTransaction(); - // We must turn off foreign keys before deleting a menu item. Otherwise there will be a + // We must turn off foreign keys before deleting a menu item. Otherwise there + // will be a // constraint violation from the ancestors table. setForeignKeys(localSession, false); deleteRoles(menuId); @@ -730,21 +759,22 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { transaction.commit(); result = true; } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "deleteFunctionalMenuItem failed", e); EcompPortalUtils.rollbackTransaction(transaction, - "deleteFunctionalMenuItem rollback, exception = " + e); - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + "deleteFunctionalMenuItem rollback, exception = " + e.toString()); } finally { EcompPortalUtils.closeLocalSession(localSession, "deleteFunctionalMenuItem"); } if (result) { } else { - logger.debug(EELFLoggerDelegate.debugLogger, "LR: deleteFunctionalMenuItem: no result. setting httpStatusCode to " - + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + logger.debug(EELFLoggerDelegate.debugLogger, + "LR: deleteFunctionalMenuItem: no result. setting httpStatusCode to " + + HttpServletResponse.SC_INTERNAL_SERVER_ERROR); fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } return fieldsValidator; } - + // Regenerate the fn_menu_functional_ancestors table, which is used // by the queries that return the functional menu items. public FieldsValidator regenerateAncestorTable() { @@ -760,7 +790,7 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { Query query = localSession.createSQLQuery(sql); query.executeUpdate(); logger.debug(EELFLoggerDelegate.debugLogger, "regenerateAncestorTable: finished query 1"); - + sql = "ALTER TABLE fn_menu_functional_ancestors AUTO_INCREMENT=1"; logQuery(sql); query = localSession.createSQLQuery(sql); @@ -787,9 +817,9 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { logger.debug(EELFLoggerDelegate.debugLogger, "regenerateAncestorTable: finished query 3"); transaction.commit(); } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "regenerateAncestorTable failed", e); EcompPortalUtils.rollbackTransaction(transaction, - "regenerateAncestorTable rollback, exception = " + e); - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + "regenerateAncestorTable rollback, exception = " + e.toString()); fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { EcompPortalUtils.closeLocalSession(localSession, "regenerateAncestorTable"); @@ -804,132 +834,139 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { public FieldsValidator setFavoriteItem(FavoritesFunctionalMenuItem menuItemJson) { boolean result = false; FieldsValidator fieldsValidator = new FieldsValidator(); - + Session localSession = null; Transaction transaction = null; - + try { - logger.debug(EELFLoggerDelegate.debugLogger, String.format("Before adding favorite for user id:{0} and menu id:{1} ",menuItemJson.userId,menuItemJson.menuId)); + logger.debug(EELFLoggerDelegate.debugLogger, + String.format("Before adding favorite for user id:{0} and menu id:{1} ", menuItemJson.userId, + menuItemJson.menuId)); localSession = sessionFactory.openSession(); transaction = localSession.beginTransaction(); localSession.save(menuItemJson); - transaction.commit(); + transaction.commit(); result = true; - logger.debug(EELFLoggerDelegate.debugLogger, String.format("After adding favorite for user id:{0} and menu id:{1} ",menuItemJson.userId,menuItemJson.menuId)); + logger.debug(EELFLoggerDelegate.debugLogger, + String.format("After adding favorite for user id:{0} and menu id:{1} ", menuItemJson.userId, + menuItemJson.menuId)); } catch (Exception e) { - EcompPortalUtils.rollbackTransaction(transaction,"setFavoriteItem rollback, exception = " + e); - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "setFavoriteItem failed", e); + EcompPortalUtils.rollbackTransaction(transaction, "setFavoriteItem rollback, exception = " + e.toString()); } finally { EcompPortalUtils.closeLocalSession(localSession, "setFavoriteItem"); - } - - if(result) { } - else { + + if (result) { + } else { fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } - + return fieldsValidator; } - - public List<FavoritesFunctionalMenuItemJson> getFavoriteItems(Long userId) { + + public List<FavoritesFunctionalMenuItemJson> getFavoriteItems(Long userId) { try { logger.debug(EELFLoggerDelegate.debugLogger, "Before getting favorites for user id: " + userId); - - // Divide this into 2 queries: one which returns the favorites items associated with Restricted apps, - // and one that returns all the other favorites items. Then we can easily add the boolean flag - // restrictedApp to each FavoritesFunctionalMenuItemJson, to be used by the front end. + + // Divide this into 2 queries: one which returns the favorites items associated + // with Restricted apps, + // and one that returns all the other favorites items. Then we can easily add + // the boolean flag + // restrictedApp to each FavoritesFunctionalMenuItemJson, to be used by the + // front end. String sql = "SELECT f.user_id,f.menu_id,m.text,m.url " + " FROM fn_menu_favorites f, fn_menu_functional m, fn_menu_functional_roles mr " - + " WHERE f.user_id='" + userId + "' AND f.menu_id = m.menu_id " - + " AND f.menu_id = mr.menu_id " + + " WHERE f.user_id='" + userId + "' AND f.menu_id = m.menu_id " + " AND f.menu_id = mr.menu_id " + " AND mr.role_id = '" + RESTRICTED_APP_ROLE_ID + "' "; @SuppressWarnings("unchecked") - List<FavoritesFunctionalMenuItemJson> menuItems = dataAccessService.executeSQLQuery(sql, FavoritesFunctionalMenuItemJson.class, null); + List<FavoritesFunctionalMenuItemJson> menuItems = dataAccessService.executeSQLQuery(sql, + FavoritesFunctionalMenuItemJson.class, null); for (FavoritesFunctionalMenuItemJson menuItem : menuItems) { menuItem.restrictedApp = true; } - + sql = "SELECT DISTINCT f.user_id,f.menu_id,m.text,m.url " + " FROM fn_menu_favorites f, fn_menu_functional m, fn_menu_functional_roles mr " - + " WHERE f.user_id='" + userId + "' AND f.menu_id = m.menu_id " - + " AND f.menu_id = mr.menu_id " + + " WHERE f.user_id='" + userId + "' AND f.menu_id = m.menu_id " + " AND f.menu_id = mr.menu_id " + " AND mr.role_id != '" + RESTRICTED_APP_ROLE_ID + "' "; @SuppressWarnings("unchecked") - List<FavoritesFunctionalMenuItemJson> menuItems2 = dataAccessService.executeSQLQuery(sql, FavoritesFunctionalMenuItemJson.class, null); + List<FavoritesFunctionalMenuItemJson> menuItems2 = dataAccessService.executeSQLQuery(sql, + FavoritesFunctionalMenuItemJson.class, null); for (FavoritesFunctionalMenuItemJson menuItem : menuItems2) { menuItem.restrictedApp = false; menuItems.add(menuItem); } - + return menuItems; } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in FunctionalMenuServiceImpl.getFavoriteItems. Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getFavoriteItems failed", e); List<FavoritesFunctionalMenuItemJson> menuItems = new ArrayList<FavoritesFunctionalMenuItemJson>(); return menuItems; - } + } } - + public FieldsValidator removeFavoriteItem(Long userId, Long menuId) { boolean result = false; FieldsValidator fieldsValidator = new FieldsValidator(); - + Session localSession = null; Transaction transaction = null; - - try { - + + try { + FavoritesFunctionalMenuItem menuItemJson = new FavoritesFunctionalMenuItem(); menuItemJson.userId = userId; menuItemJson.menuId = menuId; - + localSession = sessionFactory.openSession(); transaction = localSession.beginTransaction(); localSession.delete(menuItemJson); localSession.flush(); - transaction.commit(); + transaction.commit(); result = true; - logger.debug(EELFLoggerDelegate.debugLogger, String.format("After removing favorite for user id: " + userId + "; menu id: " + menuId)); + logger.debug(EELFLoggerDelegate.debugLogger, + String.format("After removing favorite for user id: " + userId + "; menu id: " + menuId)); } catch (Exception e) { - EcompPortalUtils.rollbackTransaction(transaction,"removeFavoriteItem rollback, exception = " + e); - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); - } finally { + logger.error(EELFLoggerDelegate.errorLogger, "removeFavoriteItem failed", e); + EcompPortalUtils.rollbackTransaction(transaction, + "removeFavoriteItem rollback, exception = " + e.toString()); + } finally { EcompPortalUtils.closeLocalSession(localSession, "removeFavoriteItem"); - } - - if(result) { } - else { + + if (result) { + } else { fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } - + return fieldsValidator; } - + @Override public void assignHelpURLs(List<FunctionalMenuItem> menuItems) { try { String user_guide_link = SystemProperties.getProperty(EPCommonSystemProperties.USER_GUIDE_URL); - - for(FunctionalMenuItem menuItem: menuItems){ - if(menuItem.text.equalsIgnoreCase("Contact Us")){ + + for (FunctionalMenuItem menuItem : menuItems) { + if (menuItem.text.equalsIgnoreCase("Contact Us")) { menuItem.setUrl("contactUs"); - //menuItem.setRestrictedApp(true); + // menuItem.setRestrictedApp(true); } - if(menuItem.text.equalsIgnoreCase("Get Access")) { + if (menuItem.text.equalsIgnoreCase("Get Access")) { menuItem.setUrl("getAccess"); } - if(menuItem.text.equalsIgnoreCase("User Guide")) { + if (menuItem.text.equalsIgnoreCase("User Guide")) { menuItem.setUrl(user_guide_link); menuItem.setRestrictedApp(true); } } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "assignHelpURLs process failed. Details: " + EcompPortalUtils.getStackTrace(e)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "assignHelpURLs process failed", e); } - + } public List<FunctionalMenuRole> getFunctionalMenuRole() { @@ -938,8 +975,9 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { logger.debug(EELFLoggerDelegate.debugLogger, "getFunctionalMenuRole: logged the query"); @SuppressWarnings("unchecked") - List<FunctionalMenuRole> functionalMenuRole = dataAccessService.executeSQLQuery(sql, FunctionalMenuRole.class, null); - + List<FunctionalMenuRole> functionalMenuRole = dataAccessService.executeSQLQuery(sql, FunctionalMenuRole.class, + null); + return functionalMenuRole; } @@ -951,13 +989,12 @@ public class FunctionalMenuServiceImpl implements FunctionalMenuService { List<BusinessCardApplicationRole> userAppRoles = null; try { - userAppRoles = dataAccessService - .executeNamedQuery("getUserApproles", params, null); + userAppRoles = dataAccessService.executeNamedQuery("getUserApproles", params, null); } catch (Exception e) { // TODO Auto-generated catch block logger.error(EELFLoggerDelegate.errorLogger, "getUserAppRolesList failed", e); - } + } return userAppRoles; } - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessService.java index e9dc2818..5857658d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessServiceImpl.java index 1f215921..317e838e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/GetAccessServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestService.java index 66932bf6..5e4c96a7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestServiceImpl.java index 5136985c..0e5da802 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/ManifestServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyService.java index 3feffde6..85977ef1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java index f5a542bf..acd8524a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceProxyServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -49,47 +67,40 @@ import org.springframework.web.client.RestTemplate; @EPMetricsLog public class MicroserviceProxyServiceImpl implements MicroserviceProxyService { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MicroserviceProxyServiceImpl.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MicroserviceProxyServiceImpl.class); + private static final String BASIC_AUTH = "Basic Authentication"; private static final String NO_AUTH = "No Authentication"; private static final String COOKIE_AUTH = "Cookie based Authentication"; private static final String QUESTION_MARK = "?"; private static final String ADD_MARK = "&"; - String whatService = "widgets-service"; - @Autowired private ConsulHealthService consulHealthService; - @Autowired MicroserviceService microserviceService; - @Autowired WidgetParameterService widgetParameterService; - RestTemplate template = new RestTemplate(); + private String whatService = "widgets-service"; + + private RestTemplate template = new RestTemplate(); @Override public String proxyToDestination(long serviceId, EPUser user, HttpServletRequest request) throws Exception { - - //get the microservice object by the id + // get the microservice object by the id MicroserviceData data = microserviceService.getMicroserviceDataById(serviceId); - // No such microservice available if (data == null) { - //can we return a better response than null? + // can we return a better response than null? return null; } - return authenticateAndRespond(data, request, composeParams(data, user)); } - + @Override public String proxyToDestinationByWidgetId(long widgetId, EPUser user, HttpServletRequest request) throws Exception { - - String response = null; - @SuppressWarnings({ "rawtypes", "unchecked" }) ResponseEntity<Long> ans = (ResponseEntity<Long>) template.exchange( EcompPortalUtils.widgetMsProtocol() + "://" @@ -98,14 +109,11 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService { + "/widget/microservices/widgetCatalog/parameters/" + widgetId, HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), Long.class); Long serviceId = ans.getBody(); - // get the microservice object by the id MicroserviceData data = microserviceService.getMicroserviceDataById(serviceId); - // No such microservice available - if (data == null) { - return response; - } + if (data == null) + return null; List<MicroserviceParameter> params = composeParams(data, user); for (MicroserviceParameter p : params) { @@ -114,35 +122,28 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService { if (userValue != null) p.setPara_value(userValue.getUser_value()); } - return authenticateAndRespond(data, request, params); - } - private String authenticateAndRespond(MicroserviceData data, HttpServletRequest request, List<MicroserviceParameter> params){ - + private String authenticateAndRespond(MicroserviceData data, HttpServletRequest request, + List<MicroserviceParameter> params) throws HttpClientErrorException, IllegalArgumentException { String response = null; - if (data.getSecurityType().equals(NO_AUTH)) { HttpEntity<String> entity = new HttpEntity<String>(headersForNoAuth()); - String url = microserviceUrlConverter(data, params); - try { - logger.debug(EELFLoggerDelegate.debugLogger, "Before making no authentication call: {}", url); - response = template.exchange(url, HttpMethod.GET, entity, String.class).getBody(); - logger.debug(EELFLoggerDelegate.debugLogger, "No authentication call response: {}", response); - - } catch (HttpClientErrorException e) { - throw e; - } + logger.debug(EELFLoggerDelegate.debugLogger, + "authenticateAndRespond: Before making no authentication call: {}", url); + response = template.exchange(url, HttpMethod.GET, entity, String.class).getBody(); + logger.debug(EELFLoggerDelegate.debugLogger, "authenticateAndRespond: No authentication call response: {}", + response); } else if (data.getSecurityType().equals(BASIC_AUTH)) { // encoding the username and password String plainCreds = null; - try{ + try { plainCreds = data.getUsername() + ":" + decryptedPassword(data.getPassword()); - } - catch(Exception e){ - logger.error("problem decrypting password ... check if decryption key is correct in system.properties: ", e); + } catch (Exception e) { + logger.error("authenticateAndRespond failed to decrypt password", e); + throw new IllegalArgumentException("Failed to decrypt password", e); } byte[] plainCredsBytes = plainCreds.getBytes(); byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes); @@ -154,7 +155,7 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService { try { response = template.exchange(url, HttpMethod.GET, entity, String.class).getBody(); } catch (HttpClientErrorException e) { - logger.error("Problem while talking to {1} - message: {2} ", url, e.getMessage()); + logger.error("authenticateAndRespond failed for basic security url " + url, e); throw e; } } else if (data.getSecurityType().equals(COOKIE_AUTH)) { @@ -163,16 +164,17 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService { try { response = template.exchange(url, HttpMethod.GET, entity, String.class).getBody(); } catch (HttpClientErrorException e) { + logger.error("authenticateAndRespond failed for cookie auth url " + url, e); throw e; } } - + return response; } - + private String decryptedPassword(String encryptedPwd) throws Exception { String result = ""; - if (encryptedPwd != null & encryptedPwd.length() > 0) { + if (encryptedPwd != null && encryptedPwd.length() > 0) { try { result = CipherUtil.decrypt(encryptedPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); @@ -181,7 +183,7 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService { throw e; } } - + return result; } @@ -199,40 +201,42 @@ public class MicroserviceProxyServiceImpl implements MicroserviceProxyService { return url; } - - private HttpHeaders headersForNoAuth(){ + + private HttpHeaders headersForNoAuth() { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); return headers; } + + // TODO: why is this generically named cookie used? + private final static String Cookie = "Cookie"; - private HttpHeaders headersForBasicAuth(HttpServletRequest request, String base64Creds){ + private HttpHeaders headersForBasicAuth(HttpServletRequest request, String base64Creds) { HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", "Basic " + base64Creds); headers.setContentType(MediaType.APPLICATION_JSON); - String rawCookie = request.getHeader("Cookie"); - headers.add("Cookie", rawCookie); - + String rawCookie = request.getHeader(Cookie); + if (rawCookie != null) + headers.add(Cookie, rawCookie); return headers; } - private HttpHeaders headersForCookieAuth(HttpServletRequest request){ + private HttpHeaders headersForCookieAuth(HttpServletRequest request) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); - String rawCookie = request.getHeader("Cookie"); - headers.add("Cookie", rawCookie); - + String rawCookie = request.getHeader(Cookie); + if (rawCookie != null) + headers.add(Cookie, rawCookie); return headers; } - - private List<MicroserviceParameter> composeParams(MicroserviceData data, EPUser user){ + + private List<MicroserviceParameter> composeParams(MicroserviceData data, EPUser user) { List<MicroserviceParameter> params = data.getParameterList(); - MicroserviceParameter userId_param = new MicroserviceParameter(); - userId_param.setPara_key("userId"); - userId_param.setPara_value(user.getOrgUserId()); - params.add(userId_param); - + MicroserviceParameter userIdParam = new MicroserviceParameter(); + userIdParam.setPara_key("userId"); + userIdParam.setPara_value(user.getOrgUserId()); + params.add(userIdParam); return params; } }
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceService.java index df55abb4..d2ef3647 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java index 520bef98..23a8c504 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/MicroserviceServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppService.java index af957dc4..af69f337 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImpl.java index 243b61eb..c547a9de 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetService.java index 1b18e65d..a59e43e5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetServiceImpl.java index 189b3107..5c38997f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PersUserWidgetServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminService.java index ebbe52f3..03257f97 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminServiceImpl.java index 10490e73..bc4c3390 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/PortalAdminServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -90,9 +108,7 @@ public class PortalAdminServiceImpl implements PortalAdminService { logger.debug(EELFLoggerDelegate.debugLogger, "getPortalAdmins was successful"); return portalAdmins; } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while performing getPortalAdmins operation, Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getPortalAdmins failed", e); return null; } } @@ -149,8 +165,8 @@ public class PortalAdminServiceImpl implements PortalAdminService { else logger.error(EELFLoggerDelegate.errorLogger, "PortalAdminServiceImpl createPortalAdmin: failed to Add role in the external central auth system since User obj is null" ); } catch (Exception e) { - EcompPortalUtils.rollbackTransaction(transaction, "createPortalAdmin rollback, exception = " + e); - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "createPortalAdmin failed", e); + EcompPortalUtils.rollbackTransaction(transaction, "createPortalAdmin rollback, exception = " + e.toString()); } finally { EcompPortalUtils.closeLocalSession(localSession, "createPortalAdmin"); } @@ -216,8 +232,8 @@ public class PortalAdminServiceImpl implements PortalAdminService { transaction.commit(); result = deletePortalAdminInExternalCentralAuth(userId, PortalConstants.PORTAL_ADMIN_ROLE); } catch (Exception e) { - EcompPortalUtils.rollbackTransaction(transaction, "deletePortalAdmin rollback, exception = " + e); - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "deletePortalAdmin failed", e); + EcompPortalUtils.rollbackTransaction(transaction, "deletePortalAdmin rollback, exception = " + e.toString()); } finally { EcompPortalUtils.closeLocalSession(localSession, "deletePortalAdmin"); } @@ -285,9 +301,7 @@ public class PortalAdminServiceImpl implements PortalAdminService { return true; } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred while performing isLoggedInUserPortalAdmin operation, Details: " - + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "isLoggedInUserPortalAdmin failed", e); return false; } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java index cf88fb7f..56e64405 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java index a2b56e5a..df0c3886 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java @@ -1,37 +1,55 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; import java.util.ArrayList; import java.util.List; +import org.openecomp.portalapp.portal.domain.EPUser; +import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; +import org.openecomp.portalapp.portal.transport.UserWithNameSurnameTitle; +import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.transport.UserWithNameSurnameTitle; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -101,7 +119,7 @@ public class SearchServiceImpl implements SearchService { try { result = mapper.writeValueAsString(resultOfSearch); } catch (JsonProcessingException e) { - logger.error(EELFLoggerDelegate.errorLogger, "searchUsersInPhoneBook Exception = " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "searchUsersInPhoneBook failed", e); } return result; } @@ -116,7 +134,7 @@ public class SearchServiceImpl implements SearchService { foundUsers.add(foundUser); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "searchInPhoneBookWithToken Exception = " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "searchUsersByAttrs failed", e); } return foundUsers; } @@ -167,7 +185,7 @@ public class SearchServiceImpl implements SearchService { } } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "searchUserBy orgUserId exception = " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "searchUserByUserId failed", e); } return user; } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextService.java index 72f3bcb5..24b164ed 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextServiceImpl.java index b222d189..37b38703 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/SharedContextServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/TicketEventService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/TicketEventService.java index 1c9a735a..4219e035 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/TicketEventService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/TicketEventService.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import com.fasterxml.jackson.databind.JsonNode; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationService.java index 447cacf4..4aa6a180 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationServiceImpl.java index 52bc4922..329d4e8a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserNotificationServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java index 0751c72e..683bca30 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesCommonServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -340,9 +358,10 @@ public class UserRolesCommonServiceImpl { transaction.commit(); result = true; } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "syncUserRoles failed", e); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); EcompPortalUtils.rollbackTransaction(transaction, - "Exception occurred in syncUserRoles, Details: " + EcompPortalUtils.getStackTrace(e)); + "Exception occurred in syncUserRoles, Details: " + e.toString()); if("DELETE".equals(reqType)){ throw new Exception(e.getMessage()); } @@ -557,9 +576,10 @@ public class UserRolesCommonServiceImpl { transaction.commit(); logger.debug(EELFLoggerDelegate.debugLogger, "syncAppRoles: committed the transaction"); } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "syncAppRoles failed", e); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); EcompPortalUtils.rollbackTransaction(transaction, - "syncAppRoles: Exception occurred in syncAppRoles, Details: " + EcompPortalUtils.getStackTrace(e)); + "Exception occurred in syncAppRoles, Details: " + e.toString()); throw new Exception(e); } finally { localSession.close(); @@ -1693,7 +1713,8 @@ public class UserRolesCommonServiceImpl { try { logger.error(EELFLoggerDelegate.errorLogger,"Should not be reached here, still the endpoint is yet to be defined"); boolean result = postUserRolesToMylogins(userAppRolesData, applicationsRestClientService, userAppRolesData.appId, user.getId()); - + logger.debug(EELFLoggerDelegate.debugLogger,"putUserAppRolesRequest: result {}", result); + params.put("appId", userAppRolesData.appId); EPUserAppRolesRequest epAppRolesRequestData = new EPUserAppRolesRequest(); epAppRolesRequestData.setCreatedDate(new Date()); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesService.java index eebf3bf1..57188947 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserRolesService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserService.java index b08f9e8a..38c7fa33 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java index 88c482ba..49831435 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterService.java index d3c32596..81b5e1e2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterServiceImpl.java index 1fead505..e69c7275 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetParameterServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetService.java index 5c3ea768..a90fc4e2 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetServiceImpl.java index c19730e0..7633e34a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/service/WidgetServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -54,6 +72,8 @@ import org.openecomp.portalapp.portal.utils.EcompPortalUtils; @EPMetricsLog public class WidgetServiceImpl implements WidgetService { + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetServiceImpl.class); + private static final String baseSqlToken = " widget.WIDGET_ID, widget.WDG_NAME, widget.APP_ID, app.APP_NAME, widget.WDG_WIDTH, widget.WDG_HEIGHT, widget.WDG_URL" + " from FN_WIDGET widget join FN_APP app ON widget.APP_ID = app.APP_ID"; @@ -66,8 +86,6 @@ public class WidgetServiceImpl implements WidgetService { private static final String urlField = "url"; private static final String nameField = "name"; - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetServiceImpl.class); - @Autowired AdminRolesService adminRolesService; @Autowired @@ -82,7 +100,7 @@ public class WidgetServiceImpl implements WidgetService { ACCOUNT_ADMIN_ROLE_ID = Long.valueOf(SystemProperties.getProperty(EPCommonSystemProperties.ACCOUNT_ADMIN_ROLE_ID)); LONG_ECOMP_APP_ID = Long.valueOf(SystemProperties.getProperty(EPCommonSystemProperties.ECOMP_APP_ID)); } catch(Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "init failed", e); } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AllAppsWithRolesForUser.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AllAppsWithRolesForUser.java index f56d6111..b08eafef 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AllAppsWithRolesForUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AllAppsWithRolesForUser.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/Analytics.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/Analytics.java index b6e6c24f..fc84012d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/Analytics.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/Analytics.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalization.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalization.java index f07ae6e1..0480f1bb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalization.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalization.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdmin.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdmin.java index 135b298c..2d44b672 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdmin.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdmin.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUser.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUser.java index 16ba67b5..7c217813 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUser.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRole.java index fc9bc88c..4bcf21a8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRole.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunction.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunction.java index d25cec5d..e1924fa5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunction.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunction.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRoles.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRoles.java index 8187ce4e..d2add21d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRoles.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRole.java index 5fb847f4..fff72827 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRole.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesList.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesList.java index 51feb115..74c83700 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesList.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesList.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralApp.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralApp.java index 5a03bf56..6f7861b9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralApp.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.util.Arrays; @@ -28,8 +65,7 @@ public class CentralApp { public String uebKey; // ueb_key public String uebSecret; // ueb_secret public String uebTopicName; // ueb_topic_name - - + public CentralApp(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, String name, String imageUrl, String description, String notes, String url, String alternateUrl, String restEndpoint, String mlAppName, String mlAppAdminId, String motsId, String appPassword, String open, String enabled, @@ -60,149 +96,195 @@ public class CentralApp { this.uebSecret = uebSecret; this.uebTopicName = uebTopicName; } - + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } - + public Date getCreated() { return created; } + public void setCreated(Date created) { this.created = created; } + public Date getModified() { return modified; } + public void setModified(Date modified) { this.modified = modified; } + public Long getCreatedId() { return createdId; } + public void setCreatedId(Long createdId) { this.createdId = createdId; } + public Long getModifiedId() { return modifiedId; } + public void setModifiedId(Long modifiedId) { this.modifiedId = modifiedId; } + public Long getRowNum() { return rowNum; } + public void setRowNum(Long rowNum) { this.rowNum = rowNum; } + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public String getImageUrl() { return imageUrl; } + public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } + public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } + public String getNotes() { return notes; } + public void setNotes(String notes) { this.notes = notes; } + public String getUrl() { return url; } + public void setUrl(String url) { this.url = url; } + public String getAlternateUrl() { return alternateUrl; } + public void setAlternateUrl(String alternateUrl) { this.alternateUrl = alternateUrl; } + public String getRestEndpoint() { return restEndpoint; } + public void setRestEndpoint(String restEndpoint) { this.restEndpoint = restEndpoint; } + public String getMlAppName() { return mlAppName; } + public void setMlAppName(String mlAppName) { this.mlAppName = mlAppName; } + public String getMlAppAdminId() { return mlAppAdminId; } + public void setMlAppAdminId(String mlAppAdminId) { this.mlAppAdminId = mlAppAdminId; } + public String getMotsId() { return motsId; } + public void setMotsId(String motsId) { this.motsId = motsId; } + public String getAppPassword() { return appPassword; } + public void setAppPassword(String appPassword) { this.appPassword = appPassword; } + public String getOpen() { return open; } + public void setOpen(String open) { this.open = open; } + public String getEnabled() { return enabled; } + public void setEnabled(String enabled) { this.enabled = enabled; } + public byte[] getThumbnail() { return thumbnail; } + public void setThumbnail(byte[] thumbnail) { this.thumbnail = thumbnail; } + public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } + public String getUebKey() { return uebKey; } + public void setUebKey(String uebKey) { this.uebKey = uebKey; } + public String getUebSecret() { return uebSecret; } + public void setUebSecret(String uebSecret) { this.uebSecret = uebSecret; } + public String getUebTopicName() { return uebTopicName; } + public void setUebTopicName(String uebTopicName) { this.uebTopicName = uebTopicName; } @@ -366,6 +448,5 @@ public class CentralApp { return false; return true; } - - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralRole.java index de576ad7..eb90fcd9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralRole.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.util.Date; @@ -6,242 +43,242 @@ import java.util.SortedSet; import org.openecomp.portalapp.portal.domain.CentralRoleFunction; import org.openecomp.portalapp.portal.domain.EPRole; -public class CentralRole implements Comparable{ - public Long id; - public Date created; - public Date modified; - public Long createdId; - public Long modifiedId; - public Long rowNum; - - public String name; - public boolean active; - public Integer priority; - - public SortedSet<CentralRoleFunction> roleFunctions = null; - - public SortedSet<CentralRole> childRoles = null; - - public SortedSet<CentralRole> parentRoles = null; - - public CentralRole(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, - String name, boolean active, Integer priority, SortedSet<CentralRoleFunction> roleFunctions, - SortedSet<CentralRole> childRoles, SortedSet<CentralRole> parentRoles) { - super(); - this.id = id; - this.created = created; - this.modified = modified; - this.createdId = createdId; - this.modifiedId = modifiedId; - this.rowNum = rowNum; - this.name = name; - this.active = active; - this.priority = priority; - this.roleFunctions = roleFunctions; - this.childRoles = childRoles; - this.parentRoles = parentRoles; - } - - public CentralRole(){ - - } - - public CentralRole(Long id, String name){ - this.id = id; - this.name = name; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Date getModified() { - return modified; - } - - public void setModified(Date modified) { - this.modified = modified; - } - - public Long getCreatedId() { - return createdId; - } - - public void setCreatedId(Long createdId) { - this.createdId = createdId; - } - - public Long getModifiedId() { - return modifiedId; - } - - public void setModifiedId(Long modifiedId) { - this.modifiedId = modifiedId; - } - - public Long getRowNum() { - return rowNum; - } - - public void setRowNum(Long rowNum) { - this.rowNum = rowNum; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public boolean isActive() { - return active; - } - - public void setActive(boolean active) { - this.active = active; - } - - public Integer getPriority() { - return priority; - } - - public void setPriority(Integer priority) { - this.priority = priority; - } - - public SortedSet<CentralRoleFunction> getRoleFunctions() { - return roleFunctions; - } - - public void setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) { - this.roleFunctions = roleFunctions; - } - - public SortedSet<CentralRole> getChildRoles() { - return childRoles; - } - - public void setChildRoles(SortedSet<CentralRole> childRoles) { - this.childRoles = childRoles; - } - - public SortedSet<CentralRole> getParentRoles() { - return parentRoles; - } - - public void setParentRoles(SortedSet<CentralRole> parentRoles) { - this.parentRoles = parentRoles; - } - - public int compareTo(Object obj){ - EPRole other = (EPRole)obj; - - String c1 = getName(); - String c2 = other.getName(); - - return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (active ? 1231 : 1237); - result = prime * result + ((childRoles == null) ? 0 : childRoles.hashCode()); - result = prime * result + ((created == null) ? 0 : created.hashCode()); - result = prime * result + ((createdId == null) ? 0 : createdId.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((modified == null) ? 0 : modified.hashCode()); - result = prime * result + ((modifiedId == null) ? 0 : modifiedId.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((parentRoles == null) ? 0 : parentRoles.hashCode()); - result = prime * result + ((priority == null) ? 0 : priority.hashCode()); - result = prime * result + ((roleFunctions == null) ? 0 : roleFunctions.hashCode()); - result = prime * result + ((rowNum == null) ? 0 : rowNum.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CentralRole other = (CentralRole) obj; - if (active != other.active) - return false; - if (childRoles == null) { - if (other.childRoles != null) - return false; - } else if (!childRoles.equals(other.childRoles)) +public class CentralRole implements Comparable { + public Long id; + public Date created; + public Date modified; + public Long createdId; + public Long modifiedId; + public Long rowNum; + + public String name; + public boolean active; + public Integer priority; + + public SortedSet<CentralRoleFunction> roleFunctions = null; + + public SortedSet<CentralRole> childRoles = null; + + public SortedSet<CentralRole> parentRoles = null; + + public CentralRole(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, String name, + boolean active, Integer priority, SortedSet<CentralRoleFunction> roleFunctions, + SortedSet<CentralRole> childRoles, SortedSet<CentralRole> parentRoles) { + super(); + this.id = id; + this.created = created; + this.modified = modified; + this.createdId = createdId; + this.modifiedId = modifiedId; + this.rowNum = rowNum; + this.name = name; + this.active = active; + this.priority = priority; + this.roleFunctions = roleFunctions; + this.childRoles = childRoles; + this.parentRoles = parentRoles; + } + + public CentralRole() { + + } + + public CentralRole(Long id, String name) { + this.id = id; + this.name = name; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getModified() { + return modified; + } + + public void setModified(Date modified) { + this.modified = modified; + } + + public Long getCreatedId() { + return createdId; + } + + public void setCreatedId(Long createdId) { + this.createdId = createdId; + } + + public Long getModifiedId() { + return modifiedId; + } + + public void setModifiedId(Long modifiedId) { + this.modifiedId = modifiedId; + } + + public Long getRowNum() { + return rowNum; + } + + public void setRowNum(Long rowNum) { + this.rowNum = rowNum; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + + public Integer getPriority() { + return priority; + } + + public void setPriority(Integer priority) { + this.priority = priority; + } + + public SortedSet<CentralRoleFunction> getRoleFunctions() { + return roleFunctions; + } + + public void setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) { + this.roleFunctions = roleFunctions; + } + + public SortedSet<CentralRole> getChildRoles() { + return childRoles; + } + + public void setChildRoles(SortedSet<CentralRole> childRoles) { + this.childRoles = childRoles; + } + + public SortedSet<CentralRole> getParentRoles() { + return parentRoles; + } + + public void setParentRoles(SortedSet<CentralRole> parentRoles) { + this.parentRoles = parentRoles; + } + + public int compareTo(Object obj) { + EPRole other = (EPRole) obj; + + String c1 = getName(); + String c2 = other.getName(); + + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (active ? 1231 : 1237); + result = prime * result + ((childRoles == null) ? 0 : childRoles.hashCode()); + result = prime * result + ((created == null) ? 0 : created.hashCode()); + result = prime * result + ((createdId == null) ? 0 : createdId.hashCode()); + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((modified == null) ? 0 : modified.hashCode()); + result = prime * result + ((modifiedId == null) ? 0 : modifiedId.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((parentRoles == null) ? 0 : parentRoles.hashCode()); + result = prime * result + ((priority == null) ? 0 : priority.hashCode()); + result = prime * result + ((roleFunctions == null) ? 0 : roleFunctions.hashCode()); + result = prime * result + ((rowNum == null) ? 0 : rowNum.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CentralRole other = (CentralRole) obj; + if (active != other.active) + return false; + if (childRoles == null) { + if (other.childRoles != null) return false; - if (created == null) { - if (other.created != null) - return false; - } else if (!created.equals(other.created)) + } else if (!childRoles.equals(other.childRoles)) + return false; + if (created == null) { + if (other.created != null) return false; - if (createdId == null) { - if (other.createdId != null) - return false; - } else if (!createdId.equals(other.createdId)) + } else if (!created.equals(other.created)) + return false; + if (createdId == null) { + if (other.createdId != null) return false; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) + } else if (!createdId.equals(other.createdId)) + return false; + if (id == null) { + if (other.id != null) return false; - if (modified == null) { - if (other.modified != null) - return false; - } else if (!modified.equals(other.modified)) + } else if (!id.equals(other.id)) + return false; + if (modified == null) { + if (other.modified != null) return false; - if (modifiedId == null) { - if (other.modifiedId != null) - return false; - } else if (!modifiedId.equals(other.modifiedId)) + } else if (!modified.equals(other.modified)) + return false; + if (modifiedId == null) { + if (other.modifiedId != null) return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) + } else if (!modifiedId.equals(other.modifiedId)) + return false; + if (name == null) { + if (other.name != null) return false; - if (parentRoles == null) { - if (other.parentRoles != null) - return false; - } else if (!parentRoles.equals(other.parentRoles)) + } else if (!name.equals(other.name)) + return false; + if (parentRoles == null) { + if (other.parentRoles != null) return false; - if (priority == null) { - if (other.priority != null) - return false; - } else if (!priority.equals(other.priority)) + } else if (!parentRoles.equals(other.parentRoles)) + return false; + if (priority == null) { + if (other.priority != null) return false; - if (roleFunctions == null) { - if (other.roleFunctions != null) - return false; - } else if (!roleFunctions.equals(other.roleFunctions)) + } else if (!priority.equals(other.priority)) + return false; + if (roleFunctions == null) { + if (other.roleFunctions != null) return false; - if (rowNum == null) { - if (other.rowNum != null) - return false; - } else if (!rowNum.equals(other.rowNum)) + } else if (!roleFunctions.equals(other.roleFunctions)) + return false; + if (rowNum == null) { + if (other.rowNum != null) return false; - return true; - } + } else if (!rowNum.equals(other.rowNum)) + return false; + return true; + } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUser.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUser.java index b44e25d3..e402456b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUser.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.util.Date; @@ -5,68 +42,67 @@ import java.util.Set; public class CentralUser { - public Long id; public Date created; public Date modified; public Long createdId; public Long modifiedId; public Long rowNum; - - public Long orgId; - public Long managerId; - public String firstName; - public String middleInitial; - public String lastName; - public String phone; - public String fax; - public String cellular; - public String email; - public Long addressId; - public String alertMethodCd; - public String hrid; - public String orgUserId; - public String orgCode; - public String address1; - public String address2; - public String city; - public String state; - public String zipCode; - public String country; - public String orgManagerUserId; - public String locationClli; - public String businessCountryCode; - public String businessCountryName; - public String businessUnit; - public String businessUnitName; - public String department; - public String departmentName; - public String companyCode; - public String company; - public String zipCodeSuffix; - public String jobTitle; - public String commandChain; - public String siloStatus; - public String costCenter; - public String financialLocCode; - public String loginId; - public String loginPwd; - public Date lastLoginDate; - public boolean active; - public boolean internal; - public Long selectedProfileId; - public Long timeZoneId; - public boolean online; - public String chatId; - - public Set<CentralUserApp> userApps = null; + public Long orgId; + public Long managerId; + public String firstName; + public String middleInitial; + public String lastName; + public String phone; + public String fax; + public String cellular; + public String email; + public Long addressId; + public String alertMethodCd; + public String hrid; + public String orgUserId; + public String orgCode; + public String address1; + public String address2; + public String city; + public String state; + public String zipCode; + public String country; + public String orgManagerUserId; + public String locationClli; + public String businessCountryCode; + public String businessCountryName; + public String businessUnit; + public String businessUnitName; + public String department; + public String departmentName; + public String companyCode; + public String company; + public String zipCodeSuffix; + public String jobTitle; + public String commandChain; + public String siloStatus; + public String costCenter; + public String financialLocCode; + + public String loginId; + public String loginPwd; + public Date lastLoginDate; + public boolean active; + public boolean internal; + public Long selectedProfileId; + public Long timeZoneId; + public boolean online; + public String chatId; + + public Set<CentralUserApp> userApps = null; public Set<CentralRole> pseudoRoles = null; - - public CentralUser(){ - + + public CentralUser() { + } - + public CentralUser(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, Long orgId, Long managerId, String firstName, String middleInitial, String lastName, String phone, String fax, String cellular, String email, Long addressId, String alertMethodCd, String hrid, String orgUserId, @@ -460,8 +496,5 @@ public class CentralUser { return false; return true; } - - - } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserApp.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserApp.java index 9317b9fe..8f6c15bd 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CentralUserApp.java @@ -1,70 +1,91 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; @SuppressWarnings("rawtypes") -public class CentralUserApp implements Comparable{ - +public class CentralUserApp implements Comparable { + private Long userId; private CentralApp app; private CentralRole role; private Short priority; - - - + public Long getUserId() { return userId; } - - public void setUserId(Long userId) { this.userId = userId; } - - public CentralApp getApp() { return app; } - - public void setApp(CentralApp app) { this.app = app; } - - public CentralRole getRole() { return role; } - - public void setRole(CentralRole role) { this.role = role; } - - public Short getPriority() { return priority; } - - public void setPriority(Short priority) { this.priority = priority; } + public int compareTo(Object other) { + CentralUserApp castOther = (CentralUserApp) other; + Long c1 = (this.getUserId() == null ? 0 : this.getUserId()) + (this.priority == null ? 0 : this.priority); + Long c2 = (castOther.getUserId() == null ? 0 : castOther.getUserId()) + + (castOther.getApp() == null || castOther.getApp().getId() == null ? 0 : castOther.getApp().getId()) + + (castOther.priority == null ? 0 : castOther.priority); - public int compareTo(Object other){ - CentralUserApp castOther = (CentralUserApp) other; - - Long c1 = (this.getUserId()==null ? 0 : this.getUserId()) + (this.priority==null ? 0 : this.priority); - Long c2 = (castOther.getUserId()==null ? 0 : castOther.getUserId()) + (castOther.getApp()==null||castOther.getApp().getId()==null ? 0 : castOther.getApp().getId()) + (castOther.priority==null ? 0 : castOther.priority); - - return c1.compareTo(c2); + return c1.compareTo(c2); } - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidget.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidget.java index 5be1fb70..ae759868 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidget.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidget.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidgetMeta.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidgetMeta.java index ebf2439b..2e82f579 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidgetMeta.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/CommonWidgetMeta.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreference.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreference.java index 7d8b8cda..cd59cdb0 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreference.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreference.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreference.java index 5e337bb8..eef43c63 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreference.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPref.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPref.java index 73a12ee5..341ed48b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPref.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPref.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRoles.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRoles.java index 085df3b8..8e140ad8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRoles.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreference.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreference.java index bb29ef71..d8a2b2dc 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreference.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreference.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRoles.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRoles.java index 3ac21040..e98421f6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserAppRoles.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserRoles.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserRoles.java index 50c14ca8..953b7b81 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EcompUserRoles.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItem.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItem.java index 6f7c96b3..c5256957 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItem.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVO.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVO.java index c8c466ee..d7170fea 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVO.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVO.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVO.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVO.java index d1ebe13c..2bf5a105 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVO.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVO.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItem.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItem.java index 26cf5484..5ec117d9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItem.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidget.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidget.java index fe4a3cde..1da7f7ff 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidget.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidget.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidgetMeta.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidgetMeta.java index 39488a21..34471087 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidgetMeta.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/EventWidgetMeta.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPerms.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPerms.java index 27d0dd0b..aeb2ad36 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPerms.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPerms.java @@ -1,8 +1,45 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.io.Serializable; -public class ExternalAccessPerms implements Serializable, Comparable{ +public class ExternalAccessPerms implements Serializable, Comparable { /** * @@ -12,14 +49,11 @@ public class ExternalAccessPerms implements Serializable, Comparable{ public String instance; public String action; public String description; - - + public ExternalAccessPerms() { super(); } - - - + public ExternalAccessPerms(String type, String instance, String action, String description) { super(); this.type = type; @@ -35,39 +69,46 @@ public class ExternalAccessPerms implements Serializable, Comparable{ this.action = action; } - /** * @return the type */ public String getType() { return type; } + /** - * @param type the type to set + * @param type + * the type to set */ public void setType(String type) { this.type = type; } + /** * @return the instance */ public String getInstance() { return instance; } + /** - * @param instance the instance to set + * @param instance + * the instance to set */ public void setInstance(String instance) { this.instance = instance; } + /** * @return the action */ public String getAction() { return action; } + /** - * @param action the action to set + * @param action + * the action to set */ public void setAction(String action) { this.action = action; @@ -81,19 +122,16 @@ public class ExternalAccessPerms implements Serializable, Comparable{ this.description = description; } - @Override - public int compareTo(Object obj){ - ExternalAccessPerms other = (ExternalAccessPerms)obj; + public int compareTo(Object obj) { + ExternalAccessPerms other = (ExternalAccessPerms) obj; - String c1 = getInstance(); - String c2 = other.getInstance(); + String c1 = getInstance(); + String c2 = other.getInstance(); - return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); + return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2); } - - @Override public int hashCode() { final int prime = 31; @@ -105,8 +143,6 @@ public class ExternalAccessPerms implements Serializable, Comparable{ return result; } - - @Override public boolean equals(Object obj) { if (this == obj) @@ -138,6 +174,5 @@ public class ExternalAccessPerms implements Serializable, Comparable{ return false; return true; } - - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetail.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetail.java index 39c29dd8..554aebb5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetail.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetail.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.util.List; @@ -6,7 +43,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonRootName; @JsonIgnoreProperties(ignoreUnknown = true) -@JsonRootName(value="perm") +@JsonRootName(value = "perm") public class ExternalAccessPermsDetail { private String type; @@ -14,9 +51,7 @@ public class ExternalAccessPermsDetail { private String action; private List<String> roles; private String description; - - - + public ExternalAccessPermsDetail() { super(); } @@ -37,40 +72,45 @@ public class ExternalAccessPermsDetail { this.roles = roles; this.description = description; } - + /** * @param type * @param instance * @param action * @param description */ - public ExternalAccessPermsDetail(String type, String instance, String action, - String description) { + public ExternalAccessPermsDetail(String type, String instance, String action, String description) { super(); this.type = type; this.instance = instance; this.action = action; this.description = description; } - + public String getType() { return type; } + public void setType(String type) { this.type = type; } + public String getInstance() { return instance; } + public void setInstance(String instance) { this.instance = instance; } + public String getAction() { return action; } + public void setAction(String action) { this.action = action; } + public List<String> getRoles() { return roles; } @@ -82,9 +122,9 @@ public class ExternalAccessPermsDetail { public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } - - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRole.java index 949c191e..415665a5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRole.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.io.Serializable; @@ -10,17 +47,17 @@ public class ExternalAccessRole implements Serializable { private static final long serialVersionUID = 3439986826362436339L; public String name; public String description; - + public ExternalAccessRole() { - + } - + public ExternalAccessRole(String name, String description) { super(); this.name = name; this.description = description; } - + public String getName() { return name; } @@ -32,8 +69,9 @@ public class ExternalAccessRole implements Serializable { public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePerms.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePerms.java index 460b02ac..314df1d6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePerms.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePerms.java @@ -1,29 +1,67 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; public class ExternalAccessRolePerms { - - private ExternalAccessPerms perm; + + private ExternalAccessPerms perm; private String role; - - + public ExternalAccessRolePerms(ExternalAccessPerms perm, String role) { super(); this.perm = perm; this.role = role; } - + public ExternalAccessPerms getPerm() { return perm; } + public void setPerm(ExternalAccessPerms perm) { this.perm = perm; } + public String getRole() { return role; } + public void setRole(String role) { this.role = role; } - - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUser.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUser.java index 30674bf3..4b181302 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUser.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; public class ExternalAccessUser { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetail.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetail.java index 1a8aeb64..45b2819e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetail.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetail.java @@ -1,11 +1,47 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; public class ExternalAccessUserRoleDetail { - + private String name; private ExternalRoleDescription description; - - + /** * */ @@ -18,16 +54,19 @@ public class ExternalAccessUserRoleDetail { this.name = name; this.description = description; } - + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public ExternalRoleDescription getDescription() { return description; } + public void setDescription(ExternalRoleDescription description) { this.description = description; } @@ -62,6 +101,5 @@ public class ExternalAccessUserRoleDetail { return false; return true; } - - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRequestFieldsValidator.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRequestFieldsValidator.java index d5122ea5..0e7581af 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRequestFieldsValidator.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRequestFieldsValidator.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; public class ExternalRequestFieldsValidator { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescription.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescription.java index 824dc5b2..5c73c1fc 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescription.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescription.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; public class ExternalRoleDescription { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItem.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItem.java index 606cd67e..df382721 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItem.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItemJson.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItemJson.java index 7826e6c7..ea64f13a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItemJson.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FavoritesFunctionalMenuItemJson.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FieldsValidator.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FieldsValidator.java index fee83b2f..f029e8af 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FieldsValidator.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FieldsValidator.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItem.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItem.java index 93d53d04..3deb49b1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItem.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItem.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemWithRoles.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemWithRoles.java index e74f0844..0dc64023 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemWithRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemWithRoles.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRole.java index 2c2124f0..83aab184 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRole.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; import java.io.Serializable; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/LocalRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/LocalRole.java index 4ec22281..05dfc5bb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/LocalRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/LocalRole.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java index 3187d093..54fe7fba 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingWidget.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingWidget.java index 9c812994..26a6d6ae 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingWidget.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingWidget.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdmin.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdmin.java index 294b859d..643af75c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdmin.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdmin.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdminUserRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdminUserRole.java index 17306adc..9e187162 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdminUserRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/PortalAdminUserRole.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ProfileDetail.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ProfileDetail.java index 11c0bada..cbc6b692 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ProfileDetail.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/ProfileDetail.java @@ -1,16 +1,56 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; public class ProfileDetail { - + private String firstName; private String lastName; private String middleName; private String email; private String loginId; private String loginPassword; - - public ProfileDetail(){} - public ProfileDetail(String firstName, String lastName, String middleName, String email, String loginId, String loginPassword) { + + public ProfileDetail() { + } + + public ProfileDetail(String firstName, String lastName, String middleName, String email, String loginId, + String loginPassword) { this.firstName = firstName; this.lastName = lastName; this.middleName = middleName; @@ -22,39 +62,49 @@ public class ProfileDetail { public String getFirstName() { return firstName; } + public void setFirstName(String firstName) { this.firstName = firstName; } + public String getLastName() { return lastName; } + public void setLastName(String lastName) { this.lastName = lastName; } + public String getMiddleName() { return middleName; } + public void setMiddleName(String middleName) { this.middleName = middleName; } + public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } + public String getLoginId() { return loginId; } + public void setLoginId(String loginId) { this.loginId = loginId; } + public String getLoginPassword() { return loginPassword; } + public void setLoginPassword(String loginPassword) { this.loginPassword = loginPassword; } - - + } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteRole.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteRole.java index 74dbd1ab..6de32280 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteRole.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteRole.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRoles.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRoles.java index 7095991c..4aa30577 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRoles.java @@ -4,23 +4,41 @@ import java.util.ArrayList; import java.util.List; /*- - * ================================================================================ - * ECOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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. */ /** diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUser.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUser.java index 27a34619..76018b39 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RoleInAppForUser.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RolesInAppForUser.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RolesInAppForUser.java index 2b3b451a..ea6f92b8 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RolesInAppForUser.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/RolesInAppForUser.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRoles.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRoles.java index 75aba7ab..b1af0818 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRoles.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserApplicationRoles.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitle.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitle.java index bcd6595c..b14fc8de 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitle.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitle.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalization.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalization.java index 0674e446..bc39014d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalization.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalization.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java index 55137cbf..a56cfb62 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ueb; @@ -28,37 +46,34 @@ import javax.annotation.PostConstruct; import org.hibernate.Session; import org.hibernate.SessionFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties; -import org.openecomp.portalsdk.core.onboarding.ueb.Helper; -import org.openecomp.portalsdk.core.onboarding.ueb.Publisher; -import org.openecomp.portalsdk.core.onboarding.ueb.UebException; -import org.openecomp.portalsdk.core.onboarding.ueb.UebManager; -import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg; import org.openecomp.portalapp.portal.domain.EPApp; import org.openecomp.portalapp.portal.domain.EcompApp; import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.openecomp.portalsdk.core.onboarding.ueb.Helper; +import org.openecomp.portalsdk.core.onboarding.ueb.Publisher; +import org.openecomp.portalsdk.core.onboarding.ueb.UebException; +import org.openecomp.portalsdk.core.onboarding.ueb.UebManager; +import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg; +import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; +import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; @Component @Transactional @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy public class EPUebHelper { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPUebHelper.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPUebHelper.class); @Autowired - EPAppService appsService; - + private EPAppService appsService; @Autowired private SessionFactory sessionFactory; @@ -124,9 +139,8 @@ public class EPUebHelper { PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET), PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME)); } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "initUeb failed", e); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebConnectionError, e); - String stackTrace = EcompPortalUtils.getStackTrace(e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while initializing the publisher. Details: " + stackTrace); } Thread thread = new Thread("EPUebManager: postConstructMethod - refreshPublisherList") { @@ -144,13 +158,11 @@ public class EPUebHelper { try { UebManager.getInstance().addPublisher(app.getUebTopicName()); } catch (UebException e) { - String stackTrace = EcompPortalUtils.getStackTrace(e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception while adding a publisher. Details: " + stackTrace); + logger.error(EELFLoggerDelegate.errorLogger, "addPublisher failed", e); } } public boolean checkAvailability() { - // // Test existence of topic at UEB url // @@ -180,8 +192,7 @@ public class EPUebHelper { } catch (Exception e) { available = false; - String stackTrace = EcompPortalUtils.getStackTrace(e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while performing the UEB Healthcheck. Details: " + stackTrace); + logger.error(EELFLoggerDelegate.errorLogger, "checkAvailability failed", e); } } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java index d6eb9eb9..720e0615 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ueb; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/CustomLoggingFilter.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/CustomLoggingFilter.java index ac019d5f..ab41daac 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/CustomLoggingFilter.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/CustomLoggingFilter.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.utils; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java index 4d472801..fd15634b 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EPCommonSystemProperties.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.utils; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java index f29f9d91..2d4d214f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompPortalUtils.java @@ -1,26 +1,42 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.utils; -import java.io.PrintWriter; -import java.io.StringWriter; import java.net.InetAddress; import java.net.UnknownHostException; import java.text.SimpleDateFormat; @@ -50,10 +66,15 @@ public class EcompPortalUtils { private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EcompPortalUtils.class); + // TODO: GLOBAL_LOGIN_URL is the same as in SessionTimeoutInterceptor. + // It should be defined in SystemProperties. + private static final String GLOBAL_LOGIN_URL = "global-login-url"; + /** * @param orgUserId - * @return true if orgUserId is not empty and contains only alphanumeric, - * false otherwise + * User ID to validate + * @return true if orgUserId is not empty and contains only alphanumeric, false + * otherwise */ public static boolean legitimateUserId(String orgUserId) { return orgUserId.matches("^[a-zA-Z0-9]+$"); @@ -64,7 +85,9 @@ public class EcompPortalUtils { * expression * * @param source + * String to split * @param regex + * tokens * @return List of tokens split from the source */ public static List<String> parsingByRegularExpression(String source, String regex) { @@ -84,7 +107,9 @@ public class EcompPortalUtils { * Builds a JSON object with error code and message information. * * @param errorCode + * error code * @param errorMessage + * message * @return JSON object as a String */ public static String jsonErrorMessageResponse(int errorCode, String errorMessage) { @@ -95,6 +120,7 @@ public class EcompPortalUtils { * Builds a JSON object with the specified message * * @param message + * Message to embed * @return JSON object as a String */ public static String jsonMessageResponse(String message) { @@ -102,8 +128,8 @@ public class EcompPortalUtils { } /** - * Serializes the specified object as JSON and writes the result to the - * debug log. If serialization fails, logs a message to the error logger. + * Serializes the specified object as JSON and writes the result to the debug + * log. If serialization fails, logs a message to the error logger. * * @param logger * Logger for the class where the object was built; the logger @@ -130,8 +156,8 @@ public class EcompPortalUtils { } /** - * Serializes the specified object as JSON and writes the result to the - * debug log. If serialization fails, logs a message to the error logger. + * Serializes the specified object as JSON and writes the result to the debug + * log. If serialization fails, logs a message to the error logger. * * @param source * First portion of the log message @@ -169,18 +195,16 @@ public class EcompPortalUtils { } } - // TODO: GLOBAL_LOGIN_URL is the same as in SessionTimeoutInterceptor. - // It should be defined in SystemProperties. - private static final String GLOBAL_LOGIN_URL = "global-login-url"; - /** - * Set response status to Unauthorized if user == null and to Forbidden in - * all (!) other cases. Logging is not performed if invocator == null + * Set response status to Unauthorized if user == null and to Forbidden in all + * (!) other cases. Logging is not performed if invocator == null * * @param user + * User object * @param response + * HttpServletResponse * @param invocator - * - may be null + * may be null */ public static void setBadPermissions(EPUser user, HttpServletResponse response, String invocator) { if (user == null) { @@ -206,8 +230,7 @@ public class EcompPortalUtils { responseCodeInt = Integer.valueOf(responseCode); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred in getResponseCode(). Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getExternalAppResponseCode failed", e); } return responseCodeInt; } @@ -218,8 +241,7 @@ public class EcompPortalUtils { String responseCodeString = String.valueOf(responseCode); MDC.put(EPCommonSystemProperties.EXTERNAL_API_RESPONSE_CODE, responseCodeString); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred in setResponseCode(). Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "setExternalAppResponseCode failed", e); } } @@ -231,8 +253,7 @@ public class EcompPortalUtils { httpStatusString = httpStatusString.toLowerCase(); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred in getHTTPStatusString(). Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getHTTPStatusString failed", e); } return httpStatusString; } @@ -242,7 +263,6 @@ public class EcompPortalUtils { // "Internal Ecomp Error: 500 internal_server_error" or // "External App Error: 404 not_found" // TODO: create our own Ecomp error codes, starting with 1000 and up. - String responseString = ""; String internalExternalString = internal ? "Ecomp Error: " : "App Error: "; String httpStatusString = "unknown_error"; try { @@ -250,10 +270,9 @@ public class EcompPortalUtils { httpStatusString = getHTTPStatusString(responseCode); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred in getFEErrorString(). Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getFEErrorString failed", e); } - responseString = internalExternalString + responseCode + " " + httpStatusString; + String responseString = internalExternalString + responseCode + " " + httpStatusString; return responseString; } @@ -274,17 +293,6 @@ public class EcompPortalUtils { return productionBuild; } - private static final Object stackTraceLock = new Object(); - - public static String getStackTrace(Throwable t) { - synchronized (stackTraceLock) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - t.printStackTrace(pw); - return sw.toString(); - } - } - public static String getMyIpAdddress() { InetAddress ip; String localIp; @@ -293,7 +301,7 @@ public class EcompPortalUtils { localIp = ip.getHostAddress(); } catch (UnknownHostException e) { localIp = "unknown"; - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getMyIpAdddress failed ", e); } return localIp; } @@ -306,23 +314,36 @@ public class EcompPortalUtils { hostName = ip.getHostName(); } catch (UnknownHostException e) { hostName = "unknown"; - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getMyHostName failed", e); } return hostName; } - /* return a default property if the expected one is not available */ + /** + * Returns a default property if the expected one is not available + * + * @param property + * Key + * @param defaultValue + * default Value + * @return Default value if property is not defined or yields the empty string; + * else the property value. + */ public static String getPropertyOrDefault(String property, String defaultValue) { - return ((null == SystemProperties.getProperty(property) || SystemProperties.getProperty(property).equals("")) - ? defaultValue : SystemProperties.getProperty(property)); + if (!SystemProperties.containsProperty(property)) + return defaultValue; + String value = SystemProperties.getProperty(property); + if (value == null || "".equals(value)) + return defaultValue; + return value; } /** * Calculates the time duration of a function call for logging purpose. It * stores the result by using "MDC.put(SystemProperties.MDC_TIMER, * timeDifference);" It is important to call - * "MDC.remove(SystemProperties.MDC_TIMER);" after this method call to clean - * up the record in MDC + * "MDC.remove(SystemProperties.MDC_TIMER);" after this method call to clean up + * the record in MDC * * @param beginDateTime * the given begin time for the call @@ -340,42 +361,32 @@ public class EcompPortalUtils { String timeDifference = String.format("%d", endDate.getTime() - beginDate.getTime()); MDC.put(SystemProperties.MDC_TIMER, timeDifference); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "calculateDateTimeDifferenceForLog failed", e); } } } - - public static String widgetMsProtocol(){ - final String protocol; - try{ - protocol = SystemProperties.getProperty(EPCommonSystemProperties.WIDGET_MS_PROTOCOL); - return (protocol == null || protocol.trim().equals("")) ? "https" : protocol ; - } - catch(IllegalStateException ese){ - //looks like SystemProperties.getProperty throws IllegalStateException if it cannot find a property you are looking for - //In order to not break the code if a non-required property is missing from system.properties, returning https as default - //when this exception is caught. - return "https"; - } + + /** + * Answers the protocol to use. + * + * @return Protocol name from property file; defaults to https. + */ + public static String widgetMsProtocol() { + return getPropertyOrDefault(EPCommonSystemProperties.WIDGET_MS_PROTOCOL, "https"); } - - public static String localOrDockerHost(){ - final String effectiveHost; - try{ - effectiveHost = SystemProperties.getProperty(EPCommonSystemProperties.WIDGET_MS_HOSTNAME); - return (effectiveHost == null || effectiveHost.trim().equals("")) ? "localhost" : effectiveHost ; - } - catch(IllegalStateException ese){ - //looks like SystemProperties.getProperty throws IllegalStateException if it cannot find a property you are looking for - //In order to not break the code if a non-required property is missing from system.properties, returning https as default - //when this exception is caught. - return "localhost"; - } + + /** + * Answers the host to use. + * + * @return Host name from property file; defaults to localhost. + */ + public static String localOrDockerHost() { + return getPropertyOrDefault(EPCommonSystemProperties.WIDGET_MS_HOSTNAME, "localhost"); } /** - * It returns headers where username and password of external central auth - * is encoded to base64 + * It returns headers where username and password of external central auth is + * encoded to base64 * * @return header which contains external central auth username and password * base64 encoded @@ -383,12 +394,10 @@ public class EcompPortalUtils { * if unable to decrypt the password */ public static HttpHeaders base64encodeKeyForAAFBasicAuth() throws Exception { - String userName = ""; String decryptedPass = ""; - if (EPCommonSystemProperties - .containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_USER_NAME) && EPCommonSystemProperties - .containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_PASSWORD)) { + if (EPCommonSystemProperties.containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_USER_NAME) + && EPCommonSystemProperties.containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_PASSWORD)) { decryptedPass = SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_PASSWORD); userName = SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_AUTH_USER_NAME); } @@ -400,7 +409,7 @@ public class EcompPortalUtils { headers.setContentType(MediaType.APPLICATION_JSON); return headers; } - + private static String decrypted(String encrypted) throws Exception { String result = ""; if (encrypted != null && encrypted.length() > 0) { diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompVersion.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompVersion.java index 8afde4ef..9e9c5aab 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompVersion.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/EcompVersion.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.utils; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/HashMapFromList.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/HashMapFromList.java index a953bf1e..5abc498d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/HashMapFromList.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/HashMapFromList.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.utils; @@ -40,9 +58,10 @@ import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; * hash map created from list. * * @param <T> + * Type */ public class HashMapFromList<T> { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HashMapFromList.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HashMapFromList.class); public HashMap<String, T> hashMap(List<T> list, String name) { HashMap<String, T> result = new HashMap<String, T>(); @@ -61,8 +80,7 @@ public class HashMapFromList<T> { if (o != null) result.put(o.toString(), obj); } catch (Exception e1) { - String stackTrace = EcompPortalUtils.getStackTrace(e1); - logger.error(EELFLoggerDelegate.errorLogger, "Object of class " + object.getClass().getName() + ", field " + parmName + ". Details: ", stackTrace); + logger.error(EELFLoggerDelegate.errorLogger, "hashMap failed 1: object of class " + object.getClass().getName() + ", field " + parmName, e1); return new HashMap<String, T>(); } } @@ -78,14 +96,12 @@ public class HashMapFromList<T> { if (o != null) result.put(o.toString(), obj); } catch (Exception e2) { - String stackTrace = EcompPortalUtils.getStackTrace(e2); - logger.error(EELFLoggerDelegate.errorLogger, "Object of class " + object.getClass().getName() + ", method " + getterName + ". Details: ", stackTrace); + logger.error(EELFLoggerDelegate.errorLogger, "hashMap failed 2: object of class " + object.getClass().getName() + ", method " + getterName, e2); return new HashMap<String, T>(); } } } catch (Exception e3) { - String stackTrace = EcompPortalUtils.getStackTrace(e3); - logger.error(EELFLoggerDelegate.errorLogger, "Object of class " + object.getClass().getName() + ", bad field '" + name + "' or method '" + getterName + "()'. Details: " + stackTrace); + logger.error(EELFLoggerDelegate.errorLogger, "hashMap failed 3: object of class " + object.getClass().getName() + ", bad field '" + name + "' or method '" + getterName + "()", e3); return new HashMap<String, T>(); } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/ParallelExecutor.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/ParallelExecutor.java index 0354798c..8dfacb5c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/ParallelExecutor.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/ParallelExecutor.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.utils; @@ -30,7 +48,7 @@ import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; public abstract class ParallelExecutor<T> { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ParallelExecutor.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ParallelExecutor.class); protected static abstract class ThreadOperation<T> { public abstract T execute(List<Object> parms); @@ -72,7 +90,7 @@ public abstract class ParallelExecutor<T> { result.add(future.get()); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "performAllOperations failed", e); } } executor.shutdown(); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java index 56bb542a..413b11a7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/utils/PortalConstants.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.utils; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java index 7ceca0e9..fc88d4fa 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileService.java index 2ea5b582..54ce80b7 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileServiceImpl.java index ecd6a13c..373b2b00 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/EPProfileServiceImpl.java @@ -1,38 +1,54 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.service; import java.util.List; +import org.openecomp.portalapp.portal.domain.EPUser; +import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; +import org.openecomp.portalsdk.core.dao.ProfileDao; +import org.openecomp.portalsdk.core.domain.Profile; +import org.openecomp.portalsdk.core.service.DataAccessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.openecomp.portalsdk.core.dao.ProfileDao; -import org.openecomp.portalsdk.core.domain.Profile; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; - @Service("epProfileService") @Transactional @org.springframework.context.annotation.Configuration @@ -40,8 +56,6 @@ import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; @EPMetricsLog public class EPProfileServiceImpl implements EPProfileService { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPProfileServiceImpl.class); - @Autowired private ProfileDao profileDao; @@ -50,7 +64,6 @@ public class EPProfileServiceImpl implements EPProfileService { @SuppressWarnings("unchecked") public List<Profile> findAll() { - // List msgDB = getDataAccessService().getList(Profile.class, null); return getDataAccessService().getList(Profile.class, null); } @@ -59,7 +72,6 @@ public class EPProfileServiceImpl implements EPProfileService { } public void saveUser(EPUser user) { - getDataAccessService().saveDomainObject(user, null); } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallService.java index 1fd36aee..be2fe7cf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.service; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/CoreTimeoutHandler.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/CoreTimeoutHandler.java index 897d9cd9..152c68b1 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/CoreTimeoutHandler.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/CoreTimeoutHandler.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.service.sessionmgt; @@ -26,7 +44,6 @@ import java.util.Map; import javax.servlet.http.HttpSession; import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.domain.sessionmgt.TimeoutVO; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; @@ -36,130 +53,130 @@ import org.springframework.stereotype.Service; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; - @Service @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy @EPMetricsLog -public class CoreTimeoutHandler{ +public class CoreTimeoutHandler { private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CoreTimeoutHandler.class); - - public static final Map<String, HttpSession> sessionMap = new Hashtable<String,HttpSession>(); + + public static final Map<String, HttpSession> sessionMap = new Hashtable<String, HttpSession>(); public static final Integer repeatInterval = 15 * 60; // 15 minutes - ObjectMapper mapper = new ObjectMapper(); - - + ObjectMapper mapper = new ObjectMapper(); + public static void sessionCreated(String portalJSessionId, String jSessionId, HttpSession session) { - + storeMaxInactiveTime(session); - + // this key is a combination of portal jsession id and app session id - session.setAttribute(PortalApiConstants.PORTAL_JSESSION_ID,jSessionKey(jSessionId, portalJSessionId)); - sessionMap.put((String)session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID), session); - + session.setAttribute(PortalApiConstants.PORTAL_JSESSION_ID, jSessionKey(jSessionId, portalJSessionId)); + sessionMap.put((String) session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID), session); + } - + protected static void storeMaxInactiveTime(HttpSession session) { - - if(session.getAttribute(PortalApiConstants.GLOBAL_SESSION_MAX_IDLE_TIME) == null) - session.setAttribute(PortalApiConstants.GLOBAL_SESSION_MAX_IDLE_TIME,session.getMaxInactiveInterval()); + + if (session.getAttribute(PortalApiConstants.GLOBAL_SESSION_MAX_IDLE_TIME) == null) + session.setAttribute(PortalApiConstants.GLOBAL_SESSION_MAX_IDLE_TIME, session.getMaxInactiveInterval()); } - + public static void sessionDestroyed(HttpSession session) { - - try{ - sessionMap.remove((String)session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID)); - }catch(Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, "************************ Session Management: Error while destroying session for " + session.getId() + " Details: " + EcompPortalUtils.getStackTrace(e)); + + try { + sessionMap.remove((String) session.getAttribute(PortalApiConstants.PORTAL_JSESSION_ID)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "sessionDestroyed failed on session " + session.getId(), e); } - + } - + public String gatherSessionExtenstions() { - - Map<String,TimeoutVO> sessionTimeoutMap = new Hashtable<String,TimeoutVO>(); + + Map<String, TimeoutVO> sessionTimeoutMap = new Hashtable<String, TimeoutVO>(); String jsonMap = ""; - - - for(String jSessionKey: sessionMap.keySet()) { - - try{ + + for (String jSessionKey : sessionMap.keySet()) { + + try { // get the expirytime in seconds HttpSession session = sessionMap.get(jSessionKey); - + Long lastAccessedTimeMilliSec = session.getLastAccessedTime(); Long maxIntervalMilliSec = session.getMaxInactiveInterval() * 1000L; - //Long currentTimeMilliSec = Calendar.getInstance().getTimeInMillis() ; - //(maxIntervalMilliSec - (currentTimeMilliSec - lastAccessedTimeMilliSec) + ; + // Long currentTimeMilliSec = Calendar.getInstance().getTimeInMillis() ; + // (maxIntervalMilliSec - (currentTimeMilliSec - lastAccessedTimeMilliSec) + ; Calendar instance = Calendar.getInstance(); instance.setTimeInMillis(session.getLastAccessedTime()); - logger.info(EELFLoggerDelegate.errorLogger, "************************ Session Management: Last Accessed time for "+ jSessionKey + ": " + instance.getTime()); - + logger.info(EELFLoggerDelegate.errorLogger, + "gatherSessionExtenstions: Session Management: Last Accessed time for " + jSessionKey + ": " + + instance.getTime()); + Long sessionTimOutMilliSec = maxIntervalMilliSec + lastAccessedTimeMilliSec; - - sessionTimeoutMap.put( portalJSessionId(jSessionKey), new TimeoutVO(jSessionId(jSessionKey),sessionTimOutMilliSec)); - - + + sessionTimeoutMap.put(portalJSessionId(jSessionKey), + new TimeoutVO(jSessionId(jSessionKey), sessionTimOutMilliSec)); + jsonMap = mapper.writeValueAsString(sessionTimeoutMap); - } catch(Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "************************ Session Management: Error during JsonSessionTimout conversion. Details: " + EcompPortalUtils.getStackTrace(e)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "gatherSessionExtenstions failed", e); } } - + return jsonMap; - + } - - + public void updateSessionExtensions(String sessionTimeoutMapStr) throws Exception { - - //Map<String,Object> sessionTimeoutMap = mapper.readValue(sessionTimeoutMapStr, Map.class); - Map<String,TimeoutVO> sessionTimeoutMap; - try{ - TypeReference<Hashtable<String,TimeoutVO>> typeRef - = new TypeReference<Hashtable<String,TimeoutVO>>() {}; - - sessionTimeoutMap = mapper.readValue(sessionTimeoutMapStr, typeRef); - }catch(Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, "************************ Session Management: Error while to parse update session extension in portal", e); + + Map<String, TimeoutVO> sessionTimeoutMap; + try { + TypeReference<Hashtable<String, TimeoutVO>> typeRef = new TypeReference<Hashtable<String, TimeoutVO>>() { + }; + + sessionTimeoutMap = mapper.readValue(sessionTimeoutMapStr, typeRef); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "updateSessionExtensions failed 1", e); return; } - for(String jPortalSessionId: sessionTimeoutMap.keySet()) { + for (String jPortalSessionId : sessionTimeoutMap.keySet()) { try { - - TimeoutVO extendedTimeoutVO = mapper.readValue(mapper.writeValueAsString(sessionTimeoutMap.get(jPortalSessionId)),TimeoutVO.class); + + TimeoutVO extendedTimeoutVO = mapper + .readValue(mapper.writeValueAsString(sessionTimeoutMap.get(jPortalSessionId)), TimeoutVO.class); HttpSession session = sessionMap.get(jSessionKey(extendedTimeoutVO.getjSessionId(), jPortalSessionId)); - - if(session == null) { + + if (session == null) { continue; } - + Long lastAccessedTimeMilliSec = session.getLastAccessedTime(); Long maxIntervalMilliSec = session.getMaxInactiveInterval() * 1000L; Long sessionTimOutMilliSec = maxIntervalMilliSec + lastAccessedTimeMilliSec; - + Long maxTimeoutTimeMilliSec = extendedTimeoutVO.getSessionTimOutMilliSec(); - if(maxTimeoutTimeMilliSec>sessionTimOutMilliSec) { - logger.debug(EELFLoggerDelegate.debugLogger, "************************ Session Management: " + " updated session max idle time"); - session.setMaxInactiveInterval((int)(maxTimeoutTimeMilliSec-lastAccessedTimeMilliSec)/1000); + if (maxTimeoutTimeMilliSec > sessionTimOutMilliSec) { + logger.debug(EELFLoggerDelegate.debugLogger, + "updateSessionExtensions: Session Management: updated session max idle time"); + session.setMaxInactiveInterval((int) (maxTimeoutTimeMilliSec - lastAccessedTimeMilliSec) / 1000); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "************************ Session Management: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, + "updateSessionExtensions failed", e); } - + } - + } - protected static String jSessionKey(String jSessionId, String portalJSessionId) { + protected static String jSessionKey(String jSessionId, String portalJSessionId) { return portalJSessionId + "-" + jSessionId; } - - protected String portalJSessionId(String jSessionKey) { + + protected String portalJSessionId(String jSessionKey) { return jSessionKey.split("-")[0]; } - - protected String jSessionId(String jSessionKey) { + + protected String jSessionId(String jSessionKey) { return jSessionKey.split("-")[1]; } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/ManageService.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/ManageService.java index 52cc0825..2628cd86 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/ManageService.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/ManageService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.service.sessionmgt; @@ -26,7 +44,6 @@ import java.util.List; import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; import org.openecomp.portalapp.portal.service.EPAppService; import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.onboarding.listener.PortalTimeoutHandler; import org.openecomp.portalsdk.core.util.SystemProperties; @@ -41,13 +58,13 @@ import org.springframework.util.StringUtils; @EnableAspectJAutoProxy @EPMetricsLog public class ManageService implements PortalTimeoutHandler.SessionCommInf { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ManageService.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ManageService.class); @Autowired - EPAppService appService; + private EPAppService appService; @Autowired - SessionCommunication sessionCommunication; + private SessionCommunication sessionCommunication; public Integer fetchSessionSlotCheckInterval(String... params) throws Exception { @@ -86,7 +103,7 @@ public class ManageService implements PortalTimeoutHandler.SessionCommInf { sessionCommunication.clear(false); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in extendSessionTimeOuts(). Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "extendSessionTimeOuts failed", e); } } diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/SessionCommunication.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/SessionCommunication.java index 2bdd0ca8..13044c4d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/SessionCommunication.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/SessionCommunication.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.service.sessionmgt; @@ -27,14 +45,6 @@ import java.util.UUID; import javax.servlet.http.HttpServletResponse; -import org.slf4j.MDC; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; -import org.springframework.util.StringUtils; - -import com.att.eelf.configuration.Configuration; -import org.openecomp.portalsdk.core.exception.UrlAccessRestrictedException; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalapp.portal.logging.aop.EPAuditLog; import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; import org.openecomp.portalapp.portal.logging.format.EPAppMessagesEnum; @@ -42,31 +52,39 @@ import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; import org.openecomp.portalapp.portal.transport.OnboardingApp; import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.openecomp.portalsdk.core.exception.UrlAccessRestrictedException; +import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.slf4j.MDC; +import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import com.att.eelf.configuration.Configuration; @Service("sessionCommunication") @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy public class SessionCommunication { EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SessionCommunication.class); - + @EPAuditLog public String sendGet(OnboardingApp app) throws Exception { String appResponse = ""; - String appName = "Unknwon"; + String appName = ""; int responseCode = 0; if (app != null && app.name != null && app.name != "") { - try { - appName = app.name; + try { + appName = app.name; String url = app.restUrl + "/sessionTimeOuts"; String encriptedPwdDB = app.appPassword; String appUserName = app.username; - + setLocalMDCContext(app, "/sessionTimeOuts", url); - + URL obj = new URL(url); - + HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - + // optional default is GET con.setRequestMethod("GET"); con.setConnectTimeout(3000); @@ -74,36 +92,37 @@ public class SessionCommunication { // add request header con.setRequestProperty("username", appUserName); con.setRequestProperty("password", encriptedPwdDB); - + // con.set responseCode = con.getResponseCode(); logger.debug(EELFLoggerDelegate.debugLogger, "Response Code : " + responseCode); - + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); - + while ((inputLine = in.readLine()) != null) { response.append(inputLine); } - + in.close(); appResponse = response.toString(); } catch (UrlAccessRestrictedException e) { responseCode = HttpServletResponse.SC_UNAUTHORIZED; - logger.error(EELFLoggerDelegate.errorLogger, String.format("SessionCommunication.sendGet received an un-authorized exception. AppName: %s", appName)); + logger.error(EELFLoggerDelegate.errorLogger, String.format( + "SessionCommunication.sendGet received an un-authorized exception. AppName: %s", appName)); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeRestApiAuthenticationError, e); } catch (Exception e) { responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; String message = String.format( "SessionCommunication.sendGet encountered an Exception. AppName: %s, Details: %s", appName, - EcompPortalUtils.getStackTrace(e)); + e.toString()); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeHttpConnectionError, e); - logger.error(EELFLoggerDelegate.errorLogger, message); + logger.error(EELFLoggerDelegate.errorLogger, message, e); } finally { EcompPortalUtils.setExternalAppResponseCode(responseCode); } - }else{ + } else { logger.error(EELFLoggerDelegate.errorLogger, "SessionCommunication sendGet: app is null"); } return appResponse; @@ -111,19 +130,17 @@ public class SessionCommunication { @EPAuditLog public Boolean pingSession(OnboardingApp app, String sessionTimeoutMap) throws Exception { - String appName = "Unknwon"; + String appName = ""; int responseCode = 0; try { - if(app==null) - throw new Exception("SessionCommunication.pingSession app is null"); + if (app == null) + throw new Exception("SessionCommunication.pingSession: app is null"); if (app != null && app.name != null && app.name != "") { appName = app.name; } String url = app.restUrl + "/updateSessionTimeOuts"; String encriptedPwdDB = app.appPassword; String appUserName = app.username; - // String decreptedPwd = CipherUtil.decrypt(encriptedPwdDB, - // SystemProperties.getProperty(SystemProperties.Decryption_Key)); setLocalMDCContext(app, "/updateSessionTimeOuts", url); @@ -158,14 +175,13 @@ public class SessionCommunication { } catch (Exception e) { responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; String message = String.format( - "SessionCommunication.pingSession encountered an Exception. AppName: %s, Details: %s", appName, - EcompPortalUtils.getStackTrace(e)); + "SessionCommunication.pingSession encountered an Exception. AppName: %s, Details: %s", appName, e.toString()); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeHttpConnectionError, e); - logger.error(EELFLoggerDelegate.errorLogger, message); + logger.error(EELFLoggerDelegate.errorLogger, message, e); } finally { EcompPortalUtils.setExternalAppResponseCode(responseCode); } - + return true; } @@ -177,51 +193,52 @@ public class SessionCommunication { try { appName = app.name; String url = app.restUrl + "/timeoutSession" + "?portalJSessionId=" + portalJSessionId; - + String encriptedPwdDB = app.appPassword; String appUserName = app.username; // String decreptedPwd = CipherUtil.decrypt(encriptedPwdDB, // SystemProperties.getProperty(SystemProperties.Decryption_Key)); - + setLocalMDCContext(app, "/timeoutSession", url); - + URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); - + // optional default is GET con.setRequestMethod("POST"); con.setConnectTimeout(3000); con.setReadTimeout(15000); - + // add request header con.setRequestProperty("username", appUserName); con.setRequestProperty("password", encriptedPwdDB); - + // con.setRequestProperty("portalJSessionId", portalJSessionId); con.setDoInput(true); con.setDoOutput(true); con.getOutputStream().flush(); con.getOutputStream().close(); - + responseCode = con.getResponseCode(); logger.debug(EELFLoggerDelegate.debugLogger, "Response Code : " + responseCode); } catch (UrlAccessRestrictedException e) { responseCode = HttpServletResponse.SC_UNAUTHORIZED; String message = String.format( - "SessionCommunication.timeoutSession received an un-authorized exception. AppName: %s", appName); + "SessionCommunication.timeoutSession received an un-authorized exception. AppName: %s", + appName); logger.error(EELFLoggerDelegate.errorLogger, message); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeRestApiAuthenticationError, e); } catch (Exception e) { responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; String message = String.format( - "SessionCommunication.timeoutSession encountered an Exception. AppName: %s, Details: %s", appName, - EcompPortalUtils.getStackTrace(e)); + "SessionCommunication.timeoutSession encountered an Exception. AppName: %s, Details: %s", + appName, e.toString()); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeHttpConnectionError, e); - logger.error(EELFLoggerDelegate.errorLogger, message); + logger.error(EELFLoggerDelegate.errorLogger, message, e); } finally { EcompPortalUtils.setExternalAppResponseCode(responseCode); } - }else{ + } else { logger.error(EELFLoggerDelegate.errorLogger, "SessionCommunication pingSession: app is null"); } return true; @@ -231,18 +248,17 @@ public class SessionCommunication { private void setLocalMDCContext(OnboardingApp app, String restPath, String url) { setRequestId(); MDC.put(EPCommonSystemProperties.PROTOCOL, EPCommonSystemProperties.HTTP); - if (url!=null && url.contains("https")) { + if (url != null && url.contains("https")) { MDC.put(EPCommonSystemProperties.PROTOCOL, EPCommonSystemProperties.HTTPS); } MDC.put(EPCommonSystemProperties.FULL_URL, url); MDC.put(EPCommonSystemProperties.TARGET_ENTITY, app.myLoginsAppName); MDC.put(EPCommonSystemProperties.TARGET_SERVICE_NAME, restPath); } - + /** - * Generates request id, service name fields and loads them - * into MDC, as these values could be empty as these - * session timeout requests are generated at + * Generates request id, service name fields and loads them into MDC, as these + * values could be empty as these session timeout requests are generated at * scheduled intervals using quartz scheduler. */ @EPMetricsLog @@ -251,15 +267,15 @@ public class SessionCommunication { if (StringUtils.isEmpty(requestId)) { MDC.put(Configuration.MDC_KEY_REQUEST_ID, UUID.randomUUID().toString()); } - + MDC.put(Configuration.MDC_SERVICE_NAME, "/quartz/keepSessionAlive"); MDC.put(EPCommonSystemProperties.PARTNER_NAME, EPCommonSystemProperties.ECOMP_PORTAL_BE); } - + /** - * Remove the values from MDC as these requests are - * executed at regular intervals based on quartz rather - * incoming REST API requests. + * Remove the values from MDC as these requests are executed at regular + * intervals based on quartz rather incoming REST API requests. + * * @param bAll */ @EPMetricsLog diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/TimeoutHandler.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/TimeoutHandler.java index 53258c06..d7945c53 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/TimeoutHandler.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/service/sessionmgt/TimeoutHandler.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.service.sessionmgt; @@ -59,9 +77,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; @EnableAspectJAutoProxy @EPMetricsLog public class TimeoutHandler extends QuartzJobBean { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(TimeoutHandler.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(TimeoutHandler.class); - ObjectMapper mapper = new ObjectMapper(); + private ObjectMapper mapper = new ObjectMapper(); /** * Supports static call {@link #timeoutSessions(HttpSession)} @@ -69,7 +87,7 @@ public class TimeoutHandler extends QuartzJobBean { private static List<OnboardingApp> onboardedAppList = null; @Autowired - SessionCommunication sessionCommunication; + private SessionCommunication sessionCommunication; @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { @@ -179,8 +197,7 @@ public class TimeoutHandler extends QuartzJobBean { try { sessionTimeoutMapStr = mapper.writeValueAsString(sessionTimeoutMap); } catch (JsonProcessingException je) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while processing sessionTimeOutMap object to a String. Details: " - + EcompPortalUtils.getStackTrace(je)); + logger.error(EELFLoggerDelegate.errorLogger, "executeInternal failed while processing sessionTimeOutMap object to a String", je); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeInvalidJsonInput, je); } pingAppSessions(app, sessionTimeoutMapStr); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/EPUserUtils.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/EPUserUtils.java index 533ed53d..4c3462af 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/EPUserUtils.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/EPUserUtils.java @@ -1,31 +1,47 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.util; -import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.UUID; @@ -33,24 +49,15 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.criterion.Projections; -import org.hibernate.criterion.Restrictions; -import org.hibernate.transform.Transformers; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; import org.openecomp.portalapp.portal.domain.EPRole; import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalapp.portal.domain.EPUserApp; import org.openecomp.portalapp.portal.service.EPRoleFunctionService; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.domain.RoleFunction; import org.openecomp.portalsdk.core.exception.SessionExpiredException; import org.openecomp.portalsdk.core.lm.FusionLicenseManager; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.menu.MenuBuilder; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties; import org.openecomp.portalsdk.core.service.DataAccessService; import org.openecomp.portalsdk.core.util.SystemProperties; import org.openecomp.portalsdk.core.web.support.AppUtils; @@ -65,9 +72,6 @@ public class EPUserUtils { public static final String ALL_ROLE_FUNCTIONS = "allRoleFunctions"; private static DataAccessService dataAccessService; - - @Autowired - private static SessionFactory sessionFactory; /** * Gets the EPUser object from the session. @@ -98,8 +102,8 @@ public class EPUserUtils { * Menu data * @param loginMethod_ignored * How the user authenticated; ignored - * @param allRoleFunctions - * Set of user's roles + * @param ePRoleFunctionService + * role function service */ @SuppressWarnings("rawtypes") public static void setUserSession(HttpServletRequest request, EPUser user, Set applicationMenuData, @@ -111,9 +115,9 @@ public class EPUserUtils { session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); setAllRoleFunctions(ePRoleFunctionService.getRoleFunctions(), session); - - ePRoleFunctionService.getRoleFunctions(request,user); - + + ePRoleFunctionService.getRoleFunctions(request, user); + // truncate the role (and therefore the role function) data to save // memory in the session user.setEPRoles(null); @@ -190,10 +194,9 @@ public class EPUserUtils { session.removeAttribute(SystemProperties.getProperty(SystemProperties.ROLE_FUNCTIONS_ATTRIBUTE_NAME)); } - /** - * Gets role information from the user session, in the cached user object. - * As a side effect sets a session variable with the roles. + * Gets role information from the user session, in the cached user object. As a + * side effect sets a session variable with the roles. * * @param request * HttpServletRequest @@ -352,7 +355,7 @@ public class EPUserUtils { } } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "HEADER!!!! Exception : " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getRequestId failed", e); } return (requestId.isEmpty() ? UUID.randomUUID().toString() : requestId); diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/SystemType.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/SystemType.java index 44b8d40b..31d54fda 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/SystemType.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/util/SystemType.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.util; diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalsdk/core/lm/FusionLicenseManagerUtils.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalsdk/core/lm/FusionLicenseManagerUtils.java index 72461206..ecfc0ea4 100644 --- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalsdk/core/lm/FusionLicenseManagerUtils.java +++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalsdk/core/lm/FusionLicenseManagerUtils.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalsdk.core.lm; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/EPLoginBeanTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/EPLoginBeanTest.java new file mode 100644 index 00000000..e540bd85 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/EPLoginBeanTest.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.command; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import org.junit.Test; +import org.openecomp.portalapp.command.EPLoginBean; + +public class EPLoginBeanTest { + + +public EPLoginBean ePLoginBean(){ + + EPLoginBean ePLoginBean = new EPLoginBean(); + ePLoginBean.setLoginId("guestT"); + ePLoginBean.setLoginPwd("password"); + ePLoginBean.setHrid("hrId"); + ePLoginBean.setOrgUserId("guestT"); + ePLoginBean.setBusinessDirectMenu(null); + ePLoginBean.setSiteAccess("site_test"); + ePLoginBean.setLoginErrorMessage("error"); + ePLoginBean.setUser(null); + ePLoginBean.setMenu(null); + return ePLoginBean; + } + + @Test + public void ePLoginBeanTest(){ + EPLoginBean ePLoginBean = ePLoginBean(); + + assertEquals(ePLoginBean.getLoginId(), "guestT"); + assertEquals(ePLoginBean.getLoginPwd(), "password"); + assertEquals(ePLoginBean.getHrid(), "hrId"); + assertEquals(ePLoginBean.getOrgUserId(), "guestT"); + assertNull(ePLoginBean.getBusinessDirectMenu()); + assertEquals(ePLoginBean.getSiteAccess(), "site_test"); + assertEquals(ePLoginBean.getLoginErrorMessage(), "error"); + assertNull(ePLoginBean.getUser()); + assertNull(ePLoginBean.getMenu()); + + + } +} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/PostSearchBeanTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/PostSearchBeanTest.java new file mode 100644 index 00000000..324d91d7 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/command/PostSearchBeanTest.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.command; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.mockito.InjectMocks; +import org.openecomp.portalapp.portal.core.MockEPUser; +import org.openecomp.portalapp.portal.domain.EPUser; + +public class PostSearchBeanTest { + + @InjectMocks + PostSearchBean mockPostSearchBean = new PostSearchBean(); + + MockEPUser mockUser = new MockEPUser(); + public PostSearchBean mockPostSearchBean(){ + + PostSearchBean postSearchBean = new PostSearchBean(); + EPUser user = mockUser.mockEPUser(); + postSearchBean.setUser(user); + postSearchBean.setUserOrig(null); + postSearchBean.setSelected(null); + postSearchBean.setHrid(null); + postSearchBean.setPostUserId(null); + postSearchBean.setPostFirstName(null); + postSearchBean.setPostLastName(null); + postSearchBean.setPostOrgCode(null); + postSearchBean.setPostPhone(null); + postSearchBean.setPostEmail(null); + postSearchBean.setPostAddress1(null); + postSearchBean.setPostAddress2(null); + postSearchBean.setPostCity(null); + postSearchBean.setPostState(null); + postSearchBean.setPostZipCode(null); + postSearchBean.setPostLocationClli(null); + postSearchBean.setPostBusinessCountryCode(null); + postSearchBean.setPostBusinessCountryName(null); + postSearchBean.setPostDepartment(null); + postSearchBean.setPostDepartmentName(null); + postSearchBean.setPostBusinessUnit(null); + postSearchBean.setPostBusinessUnitName(null); + postSearchBean.setPostJobTitle(null); + postSearchBean.setOrgManagerUserId(null); + postSearchBean.setPostCommandChain(null); + postSearchBean.setPostCompanyCode(null); + postSearchBean.setPostCostCenter(null); + postSearchBean.setPostSiloStatus(null); + postSearchBean.setPostFinancialLocCode(null); + postSearchBean.setPostManagerUserId(null); + return postSearchBean; + } + + @Test + public void postSearchBeanTest() + { + PostSearchBean postSearchBean = mockPostSearchBean(); + EPUser user = mockUser.mockEPUser(); + assertEquals(postSearchBean.getUser().getActive(), user.getActive()); + assertNull(postSearchBean.getUserOrig()); + assertNull(postSearchBean.getSelected()); + assertNull(postSearchBean.getHrid()); + assertNull(postSearchBean.getPostOrgUserId()); + assertNull(postSearchBean.getPostFirstName()); + assertNull(postSearchBean.getPostLastName()); + assertNull(postSearchBean.getPostOrgCode()); + assertNull(postSearchBean.getPostPhone()); + assertNull(postSearchBean.getPostEmail()); + assertNull(postSearchBean.getPostAddress1()); + assertNull(postSearchBean.getPostAddress2()); + assertNull(postSearchBean.getPostCity()); + assertNull(postSearchBean.getPostState()); + assertNull(postSearchBean.getPostZipCode()); + assertNull(postSearchBean.getPostLocationClli()); + assertNull(postSearchBean.getPostBusinessCountryCode()); + assertNull(postSearchBean.getPostBusinessCountryName()); + assertNull(postSearchBean.getPostDepartment()); + assertNull(postSearchBean.getPostDepartmentName()); + assertNull(postSearchBean.getPostBusinessUnit()); + assertNull(postSearchBean.getPostBusinessUnitName()); + assertNull(postSearchBean.getPostJobTitle()); + assertNull(postSearchBean.getOrgManagerUserId()); + assertNull(postSearchBean.getPostCommandChain()); + assertNull(postSearchBean.getPostCompanyCode()); + assertNull(postSearchBean.getPostCostCenter()); + assertNull(postSearchBean.getPostSiloStatus()); + assertNull(postSearchBean.getPostFinancialLocCode()); + assertNull(postSearchBean.getPostManagerUserId()); + } + + @Test + public void isCriteriaUpdatedIfUserNotNullTest() + { + assertFalse(mockPostSearchBean.isCriteriaUpdated()); + } + + @Test + public void isCriteriaUpdatedIfUserNullTest() + { + mockPostSearchBean.setUser(null); + assertTrue(mockPostSearchBean.isCriteriaUpdated()); + } + + + @Test + public void isCriteriaUpdatedIfUserTest() + { + mockPostSearchBean.setUser(null); + mockPostSearchBean.setUserOrig(null); + assertFalse(mockPostSearchBean.isCriteriaUpdated()); + } + +} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/NotificationCleanupTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/NotificationCleanupTest.java new file mode 100644 index 00000000..0cd82ae7 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/NotificationCleanupTest.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.config; + +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.openecomp.portalapp.portal.service.UserNotificationService; +import org.openecomp.portalapp.portal.service.UserNotificationServiceImpl; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.springframework.context.ApplicationContext; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(NotificationCleanupConfig.class) +public class NotificationCleanupTest { + + @InjectMocks + NotificationCleanup notificationCleanup = new NotificationCleanup(); + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + @Mock + UserNotificationService userNotificationService = new UserNotificationServiceImpl(); + @Mock + ApplicationContext applicationContext; + + @Test + public void runTest() { + PowerMockito.mockStatic(NotificationCleanupConfig.class); + Mockito.when(NotificationCleanupConfig.getApplicationContext()).thenReturn(applicationContext); + Mockito.when((applicationContext).getBean(UserNotificationService.class)).thenReturn(userNotificationService); + Mockito.doNothing().when(userNotificationService).deleteNotificationsFromEpUserNotificationTable(); + Mockito.doNothing().when(userNotificationService).deleteNotificationsFromEpRoleNotificationTable(); + + Mockito.doNothing().when(userNotificationService).deleteNotificationsFromEpNotificationTable(); + notificationCleanup.run(); + + } + +} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/PortalCentralAccessConfigurationTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/PortalCentralAccessConfigurationTest.java new file mode 100644 index 00000000..d58beac9 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/config/PortalCentralAccessConfigurationTest.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.config; + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.openecomp.portalapp.portal.service.EPRoleFunctionService; +import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceCentralizedImpl; +import org.openecomp.portalapp.portal.service.EPRoleFunctionServiceImpl; + +public class PortalCentralAccessConfigurationTest { + + @InjectMocks + PortalCentralAccessConfiguration portalCentralAccessConfiguration = new PortalCentralAccessConfiguration(); + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + @Mock + EPRoleFunctionService ePRoleFunctionServiceImpl = new EPRoleFunctionServiceImpl(); + + @Mock + EPRoleFunctionService ePRoleFunctionServiceCentralizedImpl = new EPRoleFunctionServiceCentralizedImpl(); + + @Test + public void ePRoleFunctionServiceImplTest() + { + EPRoleFunctionService expectedPRoleFunctionServiceImpl = portalCentralAccessConfiguration.ePRoleFunctionServiceImpl(); + assertEquals(expectedPRoleFunctionServiceImpl.getClass(), EPRoleFunctionServiceImpl.class); + } + + @Test + public void ePRoleFunctionServiceCentralImplTest() + { + EPRoleFunctionService expectedPRoleFunctionServiceImpl = portalCentralAccessConfiguration.ePRoleFunctionServiceCentralizedImpl(); + assertEquals(expectedPRoleFunctionServiceImpl.getClass(), EPRoleFunctionServiceCentralizedImpl.class); + } + +} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppCatalogControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppCatalogControllerTest.java index 16d2c8d5..a04c1b07 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppCatalogControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppCatalogControllerTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppContactUsControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppContactUsControllerTest.java index 01cf27e0..487b116e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppContactUsControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppContactUsControllerTest.java @@ -1,34 +1,55 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; +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.Mock; import org.mockito.Mockito; @@ -41,8 +62,16 @@ import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; import org.openecomp.portalapp.portal.service.AppContactUsService; import org.openecomp.portalapp.portal.service.AppContactUsServiceImpl; +import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; import org.openecomp.portalapp.util.EPUserUtils; - +import org.openecomp.portalsdk.core.domain.support.CollaborateList; +import org.openecomp.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, EPCommonSystemProperties.class}) public class AppContactUsControllerTest extends MockitoTestSuite{ @Mock @@ -271,4 +300,39 @@ public class AppContactUsControllerTest extends MockitoTestSuite{ assertEquals(actualSaveAppContactUS.getMessage(), "failure"); } + @Test + public void getPortalDetailsTest(){ + PortalRestResponse<String> actualResponse = new PortalRestResponse<String>(); + PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); + expectedResponse.setStatus(PortalRestStatusEnum.OK); + expectedResponse.setMessage("success"); + expectedResponse.setResponse("\"ush_ticket_url\":\"http://todo_enter_ush_ticket_url\",\"portal_info_url\":\"https://todo_enter_portal_info_url\",\"feedback_email_address\":\"portal@lists.openecomp.org\""); + PowerMockito.mockStatic(SystemProperties.class); + PowerMockito.mockStatic(EPCommonSystemProperties.class); + + Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.USH_TICKET_URL)).thenReturn("http://todo_enter_ush_ticket_url"); + Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.PORTAL_INFO_URL)).thenReturn("https://todo_enter_portal_info_url"); + Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.FEEDBACK_EMAIL_ADDRESS)).thenReturn("portal@lists.openecomp.org"); + + actualResponse = appContactUsController.getPortalDetails(mockedRequest); + assertTrue(actualResponse.getStatus().compareTo(PortalRestStatusEnum.OK) == 0); + } + + @Test + public void getPortalDetailsExceptionTest(){ + PortalRestResponse<String> actualResponse = new PortalRestResponse<String>(); + PortalRestResponse<String> expectedResponse = new PortalRestResponse<String>(); + expectedResponse.setStatus(PortalRestStatusEnum.ERROR); + expectedResponse.setMessage("failure"); + expectedResponse.setResponse(null); + PowerMockito.mockStatic(SystemProperties.class); + PowerMockito.mockStatic(EPCommonSystemProperties.class); + + Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.USH_TICKET_URL)).thenThrow(nullPointerException); + Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.PORTAL_INFO_URL)).thenReturn("https://todo_enter_portal_info_url"); + Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.FEEDBACK_EMAIL_ADDRESS)).thenReturn("portal@lists.openecomp.org"); + + actualResponse = appContactUsController.getPortalDetails(mockedRequest); + assertEquals(actualResponse, expectedResponse); + } } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequestTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequestTest.java index e62a940c..a979a5b1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequestTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequestTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerTest.java index d4181a62..e5c30ed5 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AuditLogControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AuditLogControllerTest.java index 971089ee..68371d06 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AuditLogControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/AuditLogControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderControllerTest.java index ec8d0e79..41233c82 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertTrue; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountControllerTest.java index 793d6878..5a27755a 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/CommonWidgetControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/CommonWidgetControllerTest.java index d6d149a4..51d871d9 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/CommonWidgetControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/CommonWidgetControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertTrue; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ConsulClientControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ConsulClientControllerTest.java index 672f4212..d9e50467 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ConsulClientControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ConsulClientControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertTrue; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardControllerTest.java index d861955c..0e8b74d8 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardControllerTest.java @@ -1,6 +1,43 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; import java.io.IOException; import java.util.ArrayList; @@ -408,20 +445,19 @@ public class DashboardControllerTest { assertEquals(expectedData,actualResponse); } -// @Test -// public void activeUsersExceptionTest(){ -// EPUser user = mockUser.mockEPUser(); -// user.setLoginId("test"); -// String loginId = "abc"; -// PortalRestResponse<List<String>> expectedData = new PortalRestResponse<List<String>>(); -// expectedData.setStatus(PortalRestStatusEnum.ERROR); -// expectedData.setMessage("java.lang.NullPointerException"); -// expectedData.setResponse(null); -// -//// PowerMockito.mockStatic(EPUserUtils.class); -// Mockito.when(searchService.getRelatedUsers(user.getLoginId(user.getLoginId()))).thenReturn(nullPointerException); -// PortalRestResponse<List<String>> actualResponse = dashboardController.activeUsers(mockedRequest); -// System.out.println(actualResponse); -// //assertEquals(expectedData,actualResponse); -// } + @Test + public void activeUsersExceptionTest(){ + EPUser user = mockUser.mockEPUser(); + user.setLoginId("test"); + PortalRestResponse<List<String>> expectedData = new PortalRestResponse<List<String>>(); + expectedData.setStatus(PortalRestStatusEnum.ERROR); + expectedData.setMessage("null - check logs."); + expectedData.setResponse(null); + + PowerMockito.mockStatic(EPUserUtils.class); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(searchService.getRelatedUsers(user.getLoginId())).thenThrow(nullPointerException); + PortalRestResponse<List<String>> actualResponse = dashboardController.activeUsers(mockedRequest); + assertTrue(actualResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0); + } } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultControllerTest.java index 7f87c151..9ac81b6c 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPFusionBaseControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPFusionBaseControllerTest.java index e6db1d07..ef857d0d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPFusionBaseControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPFusionBaseControllerTest.java @@ -1,63 +1,151 @@ -//package org.openecomp.portalapp.portal.test.controller; -// -//import java.util.HashMap; -//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.Mock; -//import org.mockito.Mockito; -//import org.mockito.MockitoAnnotations; -//import org.openecomp.portalapp.controller.EPFusionBaseController; -//import org.openecomp.portalapp.portal.core.MockEPUser; -//import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -//import org.openecomp.portalapp.portal.service.DashboardSearchService; -//import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -//import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -//import org.openecomp.portalapp.util.EPUserUtils; -//import org.openecomp.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({EPUserUtils.class, SystemProperties.class}) -//public class EPFusionBaseControllerTest { -// -// @Mock -// DashboardSearchService searchService = new DashboardSearchServiceImpl(); -// -// @InjectMocks -// EPFusionBaseController epFusionBaseController; /*= mock(EPFusionBaseController.class);*/ -// -// @Before -// public void setup() { -// MockitoAnnotations.initMocks(this); -// } -// -// MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); -// -// HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); -// HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); -// -// NullPointerException nullPointerException = new NullPointerException(); -// -// MockEPUser mockUser = new MockEPUser(); -// -// @Test -// public void messagesTest(){ -// Map<String, Object> expectedData = new HashMap<String, Object>(); -// Map<String, Object> actualData = null; -// -// PowerMockito.mockStatic(SystemProperties.class); -// Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)).then(null); -// actualData = epFusionBaseController.messages(mockedRequest); -// System.out.println(); -// -// } -//} +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.HashSet; +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.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.openecomp.portalapp.controller.EPFusionBaseController; +import org.openecomp.portalapp.portal.core.MockEPUser; +import org.openecomp.portalapp.portal.domain.EPUser; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; +import org.openecomp.portalapp.portal.service.DashboardSearchService; +import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; +import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; +import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.openecomp.portalapp.util.EPUserUtils; +import org.openecomp.portalsdk.core.domain.MenuData; +import org.openecomp.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({EPUserUtils.class, SystemProperties.class, EPCommonSystemProperties.class, EcompPortalUtils.class}) +public class EPFusionBaseControllerTest { + + @Mock + DashboardSearchService searchService = new DashboardSearchServiceImpl(); + + @InjectMocks + EPFusionBaseController epFusionBaseController = new EPFusionBaseController() { + }; + + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); + + HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); + HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); + + NullPointerException nullPointerException = new NullPointerException(); + + MockEPUser mockUser = new MockEPUser(); + + @Test + public void messagesExceptionTest(){ + Map<String, Object> expectedData = new HashMap<String, Object>(); + Map<String, Object> actualData = null; + PowerMockito.mockStatic(SystemProperties.class); + PowerMockito.mockStatic(EPCommonSystemProperties.class); + PowerMockito.mockStatic(EcompPortalUtils.class); + Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)).thenReturn("test"); + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Set<MenuData> menuResult = null; + HttpSession session = mockedRequest.getSession(); + Mockito.when(session + .getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME))).thenReturn(menuResult); + actualData = epFusionBaseController.messages(mockedRequest); + assertEquals(expectedData,actualData ); + System.out.println(); + + } + + @Test + public void messagesTest(){ + Map<String, Object> expectedData = new HashMap<String, Object>(); + Map<String, Object> actualData = null; + PowerMockito.mockStatic(SystemProperties.class); + PowerMockito.mockStatic(EPCommonSystemProperties.class); + PowerMockito.mockStatic(EcompPortalUtils.class); + + Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)).thenReturn("test"); + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Set<MenuData> menuResult = new HashSet<>(); + MenuData menuData= new MenuData(); + menuResult.add(menuData); + menuData.setChildMenus(menuResult); + HttpSession session = mockedRequest.getSession(); + Mockito.when(session + .getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME))).thenReturn(menuResult); + actualData = epFusionBaseController.messages(mockedRequest); + assertEquals(actualData.size(), 2); + } + + @Test + public void isAccessibleTest() + { + assertTrue(epFusionBaseController.isAccessible()); + } + @Test + public void isRESTfulCallTest() + { + assertTrue(epFusionBaseController.isRESTfulCall()); + } +} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPRestrictedBaseControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPRestrictedBaseControllerTest.java new file mode 100644 index 00000000..6bcf2733 --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/EPRestrictedBaseControllerTest.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.MockitoAnnotations; +import org.openecomp.portalapp.controller.EPRestrictedBaseController; + +public class EPRestrictedBaseControllerTest { + + @InjectMocks + EPRestrictedBaseController ePRestrictedBaseController = new EPRestrictedBaseController() ; + + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + @Test + public void isAccessibleTest() + { + assertFalse(ePRestrictedBaseController.isAccessible()); + } + + @Test + public void isRESTfulCallTest() + { + assertFalse(ePRestrictedBaseController.isRESTfulCall()); + } +} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesControllerTest.java index 81962240..e578844f 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulControllerTest.java index 9bc44174..4bd3288a 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/FunctionalMenuControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/FunctionalMenuControllerTest.java index af0a588f..b72ef9af 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/FunctionalMenuControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/FunctionalMenuControllerTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; @@ -84,6 +102,8 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { @Mock AdminRolesService adminRolesService = new AdminRolesServiceImpl(); + + NullPointerException nullPointerException = new NullPointerException(); @Before public void setup() { @@ -200,6 +220,16 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { } @Test + public void getMenuItemsExceptionTest(){ + List<FunctionalMenuItem> actualmenuItems = null; + List<FunctionalMenuItem> expectedmenuItems = null; + + Mockito.when(functionalMenuController.getMenuItemsForAuthUser(mockedRequest, mockedResponse)).thenThrow(nullPointerException); + actualmenuItems = functionalMenuController.getMenuItemsForAuthUser(mockedRequest, mockedResponse); + assertEquals(actualmenuItems, expectedmenuItems); + } + + @Test public void getFunctionalMenuStaticInfoExceptionTest(){ String fnMenuStaticactualResponse = null; String fnMenuStaticexpectedResponse = null; @@ -274,6 +304,20 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { } @Test + public void getFunctionalMenuItemDetailsExceptionTest(){ + Integer menuId = 1234; + FunctionalMenuItem actualmenuItem = null; + FunctionalMenuItem expectedmenuItem = null; + EPUser user = mockUser.mockEPUser(); + Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(functionalMenuService.getFunctionalMenuItemDetails(menuId)).thenThrow(nullPointerException); + + actualmenuItem = functionalMenuController.getFunctionalMenuItemDetails(mockedRequest, menuId, mockedResponse); + assertEquals(actualmenuItem, expectedmenuItem); + } + + @Test public void getFunctionalMenuItemDetailsTest(){ Integer menuId = 1234; FunctionalMenuItem actualmenuItem = null; @@ -314,6 +358,27 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { } @Test + public void getMenuItemsForEditingExceptionTest(){ + List<FunctionalMenuItem> actualMenuItems = null; + List<FunctionalMenuItem> expectedMenuItems = null; + EPUser user = mockUser.mockEPUser(); + Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(functionalMenuService.getFunctionalMenuItems(true)).thenThrow(nullPointerException); + actualMenuItems = functionalMenuController.getMenuItemsForEditing(mockedRequest, mockedResponse); + assertEquals(actualMenuItems, expectedMenuItems); + } + + @Test + public void getMenuItemsForNotificationsExceptionTest(){ + List<FunctionalMenuItem> actualMenuItems = null; + List<FunctionalMenuItem> expectedMenuItems = null; + Mockito.when(functionalMenuService.getFunctionalMenuItemsForNotificationTree(true)).thenThrow(nullPointerException); + + actualMenuItems = functionalMenuController.getMenuItemsForNotifications(mockedRequest, mockedResponse); + assertEquals(actualMenuItems, expectedMenuItems); + } + @Test public void getMenuItemsForNotificationsTest(){ List<FunctionalMenuItem> actualMenuItems = null; List<FunctionalMenuItem> expectedMenuItems = new ArrayList<FunctionalMenuItem>(); @@ -335,6 +400,17 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { } @Test + public void getMenuItemsForAppExceptionTest(){ + Integer appId = 1234; + List<FunctionalMenuItem> actualMenuItems = null; + List<FunctionalMenuItem> expectedMenuItems = null; + Mockito.when(functionalMenuService.getFunctionalMenuItemsForApp(appId)).thenThrow(nullPointerException); + + actualMenuItems = functionalMenuController.getMenuItemsForApp(mockedRequest, appId); + assertEquals(actualMenuItems, expectedMenuItems); + } + + @Test public void getMenuItemsForUserTest(){ String orgUserId ="test"; List<FunctionalMenuItem> actualMenuItems = null; @@ -346,6 +422,17 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { } @Test + public void getMenuItemsForUserExceptionTest(){ + String orgUserId ="test"; + List<FunctionalMenuItem> actualMenuItems = null; + List<FunctionalMenuItem> expectedMenuItems = null; + Mockito.when(functionalMenuService.getFunctionalMenuItemsForUser(orgUserId)).thenThrow(nullPointerException); + + actualMenuItems = functionalMenuController.getMenuItemsForUser(mockedRequest, orgUserId); + assertEquals(actualMenuItems, expectedMenuItems); + } + + @Test public void createFunctionalMenuItemTest(){ FieldsValidator actualFieldsValidator = new FieldsValidator(); FieldsValidator expectedFieldsValidator = new FieldsValidator(); @@ -503,4 +590,18 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { assertEquals(actualportalRestResponse, expectedportalRestResponse); } + @Test + public void getECOMPTitleExceptionTest(){ + PortalRestResponse<String> actualportalRestResponse = null; + PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); + expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR); + expectedportalRestResponse.setMessage(null); + expectedportalRestResponse.setResponse(null); + PowerMockito.mockStatic(SystemProperties.class); + + Mockito.when(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME)).thenThrow(nullPointerException); + actualportalRestResponse = functionalMenuController.getECOMPTitle(mockedRequest, mockedResponse); + assertEquals(actualportalRestResponse, expectedportalRestResponse); + } + } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/GetAccessControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/GetAccessControllerTest.java index 8ee27f8d..e18704fe 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/GetAccessControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/GetAccessControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertTrue; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ManifestControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ManifestControllerTest.java index c7a870cf..61d5bb34 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ManifestControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/ManifestControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertTrue; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceControllerTest.java index 0b12e3bc..3b569aca 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -15,13 +52,12 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.MicroserviceController; import org.openecomp.portalapp.portal.domain.MicroserviceData; import org.openecomp.portalapp.portal.domain.WidgetCatalog; import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.portal.service.ConsulHealthService; import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl; import org.openecomp.portalapp.portal.service.MicroserviceService; @@ -39,7 +75,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; @RunWith(PowerMockRunner.class) -@PrepareForTest(WidgetServiceHeaders.class) +@PrepareForTest({WidgetServiceHeaders.class, EcompPortalUtils.class}) public class MicroserviceControllerTest extends MockitoTestSuite{ @InjectMocks @@ -164,6 +200,7 @@ public class MicroserviceControllerTest extends MockitoTestSuite{ public void deleteMicroserviceExceptionTest() throws Exception { PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); expectedportalRestResponse.setMessage("FAILURE"); + PowerMockito.mockStatic(EcompPortalUtils.class); expectedportalRestResponse.setResponse( "I/O error on GET request for \"" + EcompPortalUtils.widgetMsProtocol() + "://null/widget/microservices/widgetCatalog/service/1\":null; nested exception is java.net.UnknownHostException: null"); PortalRestStatusEnum portalRestStatusEnum = null; @@ -191,13 +228,14 @@ public class MicroserviceControllerTest extends MockitoTestSuite{ List.add(widgetCatalog); List.add(widgetCatalog1); PowerMockito.mockStatic(WidgetServiceHeaders.class); + PowerMockito.mockStatic(EcompPortalUtils.class); String whatService = "widgets-service"; Mockito.when(consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))).thenReturn("Test"); Mockito.when(ans.getBody()).thenReturn(List); ParameterizedTypeReference<List<WidgetCatalog>> typeRef = new ParameterizedTypeReference<List<WidgetCatalog>>() { }; Mockito.when(template.exchange( - HTTPS + consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port")) + EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port")) + "/widget/microservices/widgetCatalog/service/" + 1, HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), typeRef)).thenReturn(ans); @@ -216,6 +254,7 @@ public class MicroserviceControllerTest extends MockitoTestSuite{ expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); List<WidgetCatalog> List = new ArrayList<WidgetCatalog>(); PowerMockito.mockStatic(WidgetServiceHeaders.class); + PowerMockito.mockStatic(EcompPortalUtils.class); String whatService = "widgets-service"; Mockito.when(consulHealthService.getServiceLocation(whatService, SystemProperties.getProperty("microservices.widget.local.port"))).thenReturn("Test"); Mockito.when(ans.getBody()).thenReturn(List); diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyControllerTest.java index 0cb8dcdb..e712e4d2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertTrue; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PolicyControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PolicyControllerTest.java new file mode 100644 index 00000000..84b600be --- /dev/null +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PolicyControllerTest.java @@ -0,0 +1,159 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.BadRequestException; + +import org.json.simple.JSONObject; +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.openecomp.portalapp.portal.core.MockEPUser; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; +import org.openecomp.portalapp.portal.scheduler.SchedulerRestInterface; +import org.openecomp.portalapp.portal.scheduler.policy.PolicyProperties; +import org.openecomp.portalapp.portal.scheduler.policy.PolicyResponseWrapper; +import org.openecomp.portalapp.portal.scheduler.policy.PolicyRestInterfaceFactory; +import org.openecomp.portalapp.portal.scheduler.policy.PolicyRestInterfaceIfc; +import org.openecomp.portalapp.portal.scheduler.policy.PolicyUtil; +import org.openecomp.portalapp.portal.scheduler.policy.RestObject; +import org.openecomp.portalsdk.core.util.SystemProperties; +import org.openecomp.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.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import junit.framework.Assert; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({ UserUtils.class, SystemProperties.class, PolicyProperties.class, PolicyRestInterfaceFactory.class, + PolicyUtil.class }) +public class PolicyControllerTest { + + @Mock + SchedulerRestInterface schedulerRestInterface; + + @InjectMocks + PolicyController policyController = new PolicyController(); + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + MockEPUser mockUser = new MockEPUser(); + MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); + + HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); + HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); + NullPointerException nullPointerException = new NullPointerException(); + + @Before + public void setUp() { + + PowerMockito.mockStatic(SystemProperties.class); + PowerMockito.mockStatic(PolicyProperties.class); + Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_GET_CONFIG_VAL)).thenReturn("/api/getConfig"); + Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_CLIENT_MECHID_VAL)) + .thenReturn("m06814@controller.dcae.ecomp.att.com"); + Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_CLIENT_PASSWORD_VAL)) + .thenReturn("OBF:1ffu1qvu1t2z1l161fuk1i801nz91ro41xf71xfv1rqi1nx51i7y1fuq1kxw1t371qxw1fh0"); + Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_USERNAME_VAL)).thenReturn("testpdp"); + Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_PASSWORD_VAL)) + .thenReturn("OBF:1igd1kft1l1a1sw61svs1kxs1kcl1idt"); + Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_ENVIRONMENT_VAL)).thenReturn("TEST"); + Mockito.when(SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL)) + .thenReturn("https://policypdp-conexus-e2e.ecomp.cci.att.com:8081/pdp"); + + } + + @SuppressWarnings({ "unchecked", "deprecation" }) + @Test + public void getPolicyInfoTest1() throws Exception { + + JSONObject jsonObject = Mockito.mock(JSONObject.class); + PowerMockito.mockStatic(PolicyRestInterfaceFactory.class); + PowerMockito.mockStatic(SystemProperties.class); + PolicyRestInterfaceIfc policyRestInterface = Mockito.mock(PolicyRestInterfaceIfc.class); + PowerMockito.mockStatic(PolicyUtil.class); + // RestObject restObj=Mockito.mock(RestObject.class); + PolicyResponseWrapper policyWrapper = Mockito.mock(PolicyResponseWrapper.class); + PowerMockito.when(PolicyUtil.wrapResponse(Matchers.any(RestObject.class))).thenReturn(policyWrapper); + Mockito.when(policyWrapper.getResponse()).thenReturn("Success"); + Mockito.when(policyWrapper.getStatus()).thenReturn(200); + + PowerMockito.when(PolicyRestInterfaceFactory.getInstance()).thenReturn(policyRestInterface); + Mockito.doNothing().when(policyRestInterface).Post(Matchers.anyString(), Matchers.anyObject(), + Matchers.anyString(), Matchers.anyString(), Matchers.anyObject()); + + ResponseEntity<String> responsePolicy = policyController.getPolicyInfo(mockedRequest, jsonObject); + Assert.assertEquals(responsePolicy.getStatusCode(), HttpStatus.OK); + } + + @SuppressWarnings("unchecked") + @Test(expected = Exception.class) + public void getPolicyInfoTestexpected() throws Exception { + + JSONObject jsonObject = Mockito.mock(JSONObject.class); + PowerMockito.mockStatic(PolicyRestInterfaceFactory.class); + PowerMockito.mockStatic(SystemProperties.class); + PolicyRestInterfaceIfc policyRestInterface = Mockito.mock(PolicyRestInterfaceIfc.class); + PowerMockito.mockStatic(PolicyUtil.class); + // RestObject restObj=Mockito.mock(RestObject.class); + PolicyResponseWrapper policyWrapper = Mockito.mock(PolicyResponseWrapper.class); + PowerMockito.when(PolicyUtil.wrapResponse(Matchers.any(RestObject.class))).thenReturn(policyWrapper); + Mockito.when(policyWrapper.getResponse()).thenThrow(new BadRequestException()); + Mockito.when(policyWrapper.getStatus()).thenThrow(new BadRequestException()); + + PowerMockito.when(PolicyRestInterfaceFactory.getInstance()).thenReturn(policyRestInterface); + Mockito.doNothing().when(policyRestInterface).Post(Matchers.anyString(), Matchers.anyObject(), + Matchers.anyString(), Matchers.anyString(), Matchers.anyObject()); + + policyController.getPolicyInfo(mockedRequest, jsonObject); + } + +} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerTest.java index 6917b6e7..142d5ff4 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -15,12 +52,9 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.PortalAdminController; import org.openecomp.portalapp.portal.core.MockEPUser; -import org.openecomp.portalapp.portal.domain.EPRole; import org.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.exceptions.NoHealthyServiceException; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.portal.service.AdminRolesService; import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; import org.openecomp.portalapp.portal.service.PortalAdminService; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RoleManageControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RoleManageControllerTest.java index ea7b532e..08cddd69 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RoleManageControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RoleManageControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemControllerTest.java index e55b9a9c..d7cdfe7a 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SchedulerControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SchedulerControllerTest.java index c5280814..755ec51c 100644 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/SchedulerControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SchedulerControllerTest.java @@ -1,6 +1,41 @@ -package org.openecomp.portalapp.portal.test.controller; - -import java.sql.DriverManager; +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -13,11 +48,10 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.controller.SchedulerController; +import org.openecomp.portalapp.portal.core.MockEPUser; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.portal.scheduler.SchedulerProperties; import org.openecomp.portalapp.portal.scheduler.SchedulerRestInterface; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; import org.openecomp.portalsdk.core.util.SystemProperties; import org.openecomp.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SessionCommunicationControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SessionCommunicationControllerTest.java index 0f6f6ca6..e425e270 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SessionCommunicationControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SessionCommunicationControllerTest.java @@ -1,11 +1,47 @@ -package org.openecomp.portalapp.portal.controller; +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; 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; @@ -13,8 +49,8 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.openecomp.portalapp.controller.sessionmgt.SessionCommunicationController; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.portal.core.MockEPUser; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.service.sessionmgt.ManageService; public class SessionCommunicationControllerTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java index 8e5d3e15..8cf3e9c0 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java index 1224898b..bdede7d1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java index 9344150f..1c849420 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/TicketEventControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/TicketEventControllerTest.java index 9347cf6a..ad696c2c 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/TicketEventControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/TicketEventControllerTest.java @@ -1,8 +1,48 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.util.ArrayList; +import java.util.List; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -11,24 +51,31 @@ 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.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.TicketEventController; import org.openecomp.portalapp.portal.core.MockEPUser; +import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; +import org.openecomp.portalapp.portal.service.TicketEventService; import org.openecomp.portalapp.portal.service.UserNotificationService; import org.openecomp.portalsdk.core.web.support.UserUtils; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; +import com.fasterxml.jackson.databind.JsonNode; + @RunWith(PowerMockRunner.class) @PrepareForTest(UserUtils.class) public class TicketEventControllerTest { @Mock UserNotificationService userNotificationService; - + + @Mock + TicketEventService ticketEventService; + @InjectMocks TicketEventController ticketEventController = new TicketEventController(); @@ -44,13 +91,63 @@ public class TicketEventControllerTest { HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); NullPointerException nullPointerException = new NullPointerException(); -// @Test -// public void saveTest() throws Exception { -// String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}"; -// PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest, -// mockedResponse, ticketEventJson); -// assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.OK) == 0); -// } + @Test + public void saveUserValidationTest() throws Exception { + PortalRestResponse<String> actualPortalRestResponse = new PortalRestResponse<String>(); + PortalRestResponse<String> expectedPortalRestResponse = new PortalRestResponse<String>(); + expectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); + expectedPortalRestResponse.setMessage("Invalid Org User ID"); + expectedPortalRestResponse.setResponse(null); + String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site." + + " The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", " + + "\"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601," + + "\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; " + + "ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\"," + + "\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\"," + + "\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": " + + "{\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", " + + "\"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"}," + + "\"SubscriberInfo\": {\"UserList\": [\"guest\"] }}"; + + actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest, + mockedResponse, ticketEventJson); + assertEquals(actualPortalRestResponse, expectedPortalRestResponse); + } + + @Test + public void saveTest() throws Exception { + String UserIds[] = new String[1]; + UserIds[0] = "guest"; + ArrayList<EPUser> users = new ArrayList<>(); + EPUser user = new EPUser(); + user.setOrgUserId("guest"); + user.setId((long)1); + users.add(user); + List<String> userIdlist = new ArrayList<>(); + userIdlist.add("guest"); + JsonNode application = null ; + String ticketEventJson = "{\"application\":\"cbus\",\"event\":{\"body\":{\"ticketStatePhrase\":\"We recently detected a problem with the equipment at your site. " + + "The event is in queue for immediate work.\",\"ivrNotificationFlag\":\"1\",\"expectedRestoreDate\":0,\"bridgeTransport\":\"AOTS\",\"reptRequestType\":0," + + "\"ticketNum\":\"000002000857405\",\"assetID\":\"CISCO_1921C1_ISR_G2\",\"eventDate\":1490545134601," + + "\"eventAbstract\":\"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; " + + "ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\"," + + "\"severity\":\"2 - Major\",\"ticketPriority\":\"3\",\"reportedCustomerImpact\":0,\"testAutoIndicator\":0," + + "\"supportGroupName\":\"US-TEST-ORT\",\"lastModifiedDate\":\"1487687703\",\"messageGroup\":\"SNMP\",\"csi\":0,\"mfabRestoredTime\":0}," + + "\"header\":{\"timestamp\":\"2017-02-21T14:35:05.219+0000\",\"eventSource\":\"aotstm\",\"entityId\":\"000002000857405\",\"sequenceNumber\":2}," + + "\"blinkMsgId\":\"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\":\"130.4.165.158\"},\"SubscriberInfo\":{\"UserList\":[\"guest\"]}}"; + PortalRestResponse<String> actualPortalRestResponse = new PortalRestResponse<String>(); + PortalRestResponse<String> expectedPortalRestResponse = new PortalRestResponse<String>(); + expectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); + expectedPortalRestResponse.setMessage("processEventNotification: notification created"); + expectedPortalRestResponse.setResponse("NotificationId"); + + + Mockito.when(userNotificationService.getUsersByOrgIds(userIdlist)).thenReturn(users); + Mockito.when(ticketEventService.getNotificationHyperLink(application, "", "")).thenReturn(""); + actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest, + mockedResponse, ticketEventJson); + assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.OK) == 0); + } @Test public void saveTestForException() throws Exception { @@ -96,4 +193,14 @@ public class TicketEventControllerTest { assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0); assertEquals(actualPortalRestResponse.getMessage(), "At least one user Id is mandatory"); } + + @Test + public void saveTestForApplicationValid() throws Exception { + String ticketEventJson = "{\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}"; + PortalRestResponse<String> actualPortalRestResponse = ticketEventController.handleRequest(mockedRequest, + mockedResponse, ticketEventJson); + assertTrue(actualPortalRestResponse.getStatus().compareTo(PortalRestStatusEnum.ERROR) == 0); + assertEquals(actualPortalRestResponse.getMessage(), "Application is mandatory"); + + } }
\ No newline at end of file diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserControllerTest.java index acfa25a4..b821b31a 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserNotificationControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserNotificationControllerTest.java index ebe5f7cd..ff08d8a6 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserNotificationControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserNotificationControllerTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserRolesControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserRolesControllerTest.java index 56fa6a4d..138c207b 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserRolesControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/UserRolesControllerTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppControllerTest.java index fde29913..43f40192 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppControllerTest.java @@ -1,9 +1,43 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; -import static org.junit.Assert.*; - -import java.io.InputStream; -import java.nio.charset.StandardCharsets; +import static org.junit.Assert.assertTrue; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -17,8 +51,6 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.WebAnalyticsExtAppController; -import org.openecomp.portalapp.portal.domain.EPApp; import org.openecomp.portalapp.portal.service.AdminRolesService; import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; import org.openecomp.portalapp.portal.service.AppsCacheService; @@ -28,7 +60,6 @@ import org.openecomp.portalsdk.core.onboarding.crossapi.PortalAPIResponse; import org.openecomp.portalsdk.core.service.AuditService; import org.openecomp.portalsdk.core.service.AuditServiceImpl; import org.openecomp.portalsdk.core.util.SystemProperties; -import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogControllerTest.java deleted file mode 100644 index 4087a599..00000000 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogControllerTest.java +++ /dev/null @@ -1,87 +0,0 @@ -//package org.openecomp.portalapp.portal.controller; -// -//import javax.servlet.http.HttpServletRequest; -//import javax.servlet.http.HttpServletResponse; -// -//import org.junit.Before; -//import org.junit.runner.RunWith; -//import org.mockito.InjectMocks; -//import org.mockito.Mock; -//import org.mockito.MockitoAnnotations; -//import org.openecomp.portalapp.portal.core.MockEPUser; -//import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -//import org.openecomp.portalapp.portal.service.ConsulHealthService; -//import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl; -//import org.openecomp.portalapp.portal.service.MicroserviceService; -//import org.openecomp.portalapp.portal.service.MicroserviceServiceImpl; -//import org.openecomp.portalapp.portal.service.WidgetParameterService; -//import org.openecomp.portalapp.portal.service.WidgetParameterServiceImpl; -//import org.openecomp.portalapp.util.EPUserUtils; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({EPUserUtils.class}) -//public class WidgetsCatalogControllerTest { -// -// @Mock -// ConsulHealthService consulHealthService = new ConsulHealthServiceImpl(); -// -// @Mock -// MicroserviceService microserviceService = new MicroserviceServiceImpl(); -// -// @Mock -// WidgetParameterService widgetParameterService = new WidgetParameterServiceImpl(); -// -// @InjectMocks -// WidgetsCatalogController widgetsCatalogController = new WidgetsCatalogController(); -// -// @Before -// public void setup() { -// MockitoAnnotations.initMocks(this); -// } -// -// MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); -// -// HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); -// HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); -// -// NullPointerException nullPointerException = new NullPointerException(); -// -// MockEPUser mockUser = new MockEPUser(); -// -// /*public List<WidgetCatalog> getUserWidgetCatalog(HttpServletRequest request, HttpServletResponse response, -// @PathVariable("loginName") String loginName) throws RestClientException, Exception { -// List<WidgetCatalog> widgets = new ArrayList<>(); -// try { -// CustomLoggingFilter d; -// ResponseEntity<ArrayList> ans = template.exchange( -// EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, -// SystemProperties.getProperty("microservices.widget.local.port")) -// + "/widget/microservices/widgetCatalog/" + loginName, -// HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class); -// widgets = ans.getBody(); -// } catch (Exception e) { -// logger.error(EELFLoggerDelegate.errorLogger, "getUserWidgetCatalog failed", e); -// // returning null because null help check on the UI if there was a -// // communication problem with Microservice. -// return null; -// } -// return widgets; -// } -// -// @Test -// public void getWidgetDataTest(){ -// -// String resourceType = null; -// List<WidgetCatalog> expectedData = new ArrayList<WidgetCatalog>(); -// expectedData.setStatus(PortalRestStatusEnum.ERROR); -// expectedData.setMessage("Unexpected resource type null"); -// expectedData.setResponse(null); -// -// PortalRestResponse<CommonWidgetMeta> actualResponse = dashboardController.getWidgetData(mockedRequest, resourceType); -// assertEquals(expectedData,actualResponse); -// -// -// }*/ -//} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupControllerTest.java index bba49f71..7f8d6a48 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertTrue; @@ -12,14 +49,12 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.controller.WidgetsCatalogMarkupController; import org.openecomp.portalapp.portal.domain.WidgetServiceHeaders; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.portal.service.ConsulHealthService; import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl; import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; -import org.openecomp.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -27,7 +62,7 @@ import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; @RunWith(PowerMockRunner.class) -@PrepareForTest(WidgetServiceHeaders.class) +@PrepareForTest({WidgetServiceHeaders.class, EcompPortalUtils.class}) public class WidgetsCatalogMarkupControllerTest extends MockitoTestSuite { @InjectMocks @@ -47,7 +82,7 @@ public class WidgetsCatalogMarkupControllerTest extends MockitoTestSuite { CipherUtil cipherUtil= new CipherUtil(); @Mock - EcompPortalUtils EcompPortalUtils =new EcompPortalUtils(); + EcompPortalUtils ecompPortalUtils =new EcompPortalUtils(); @Mock WidgetServiceHeaders WidgetServiceHeaders ; @@ -63,6 +98,7 @@ public class WidgetsCatalogMarkupControllerTest extends MockitoTestSuite { { String whatService = "widgets-service"; PowerMockito.mockStatic(WidgetServiceHeaders.class); + PowerMockito.mockStatic(EcompPortalUtils.class); Mockito.when(template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService, null) + "/widget/microservices/markup/" + 1, String.class, WidgetServiceHeaders.getInstance())).thenReturn("Success"); String response = widgetsCatalogMarkupController.getWidgetMarkup(mockedRequest, mockedResponse, 1); diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/MockEPUser.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/MockEPUser.java index 9c220ce6..4cc471b0 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/MockEPUser.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/MockEPUser.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.core; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/PopulateSampleTestData.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/PopulateSampleTestData.java deleted file mode 100644 index 2458f471..00000000 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/PopulateSampleTestData.java +++ /dev/null @@ -1,66 +0,0 @@ -///*- -// * ================================================================================ -// * ECOMP Portal -// * ================================================================================ -// * Copyright (C) 2017 AT&T Intellectual Property -// * ================================================================================ -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * ================================================================================ -// */ -//package org.openecomp.portalapp.portal.core; -// -//import java.sql.Connection; -//import java.sql.SQLException; -// -//import javax.sql.DataSource; -// -//import org.junit.Before; -//import org.junit.Test; -//import org.openecomp.portalapp.framework.ApplicationCommonContextTestSuite; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.core.io.ClassPathResource; -//import org.springframework.jdbc.datasource.DataSourceUtils; -//import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -// -//public class PopulateSampleTestData extends ApplicationCommonContextTestSuite { -// -// @Autowired -// DataSource dataSource; -// -// @Before -// public void populateTestData() throws SQLException { -// -// String sql = "PopulateTestData.sql"; -// createConnection(sql); -// } -// -// public void createConnection(String sql) { -// Connection connection = null; -// ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); -// populator.addScript(new ClassPathResource(sql)); -// try { -// connection = DataSourceUtils.getConnection(dataSource); -// populator.populate(connection); -// } finally { -// if (connection != null) { -// DataSourceUtils.releaseConnection(connection, dataSource); -// } -// } -// } -// -// @Test -// public void populateTest() { -// assert (true); -// } -// -//} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/RemoveSampleTestData.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/RemoveSampleTestData.java deleted file mode 100644 index 1e20cd16..00000000 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/RemoveSampleTestData.java +++ /dev/null @@ -1,65 +0,0 @@ -///*- -// * ================================================================================ -// * ECOMP Portal -// * ================================================================================ -// * Copyright (C) 2017 AT&T Intellectual Property -// * ================================================================================ -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * ================================================================================ -// */ -//package org.openecomp.portalapp.portal.core; -// -//import java.sql.Connection; -//import java.sql.SQLException; -// -//import javax.sql.DataSource; -// -//import org.junit.After; -//import org.junit.Test; -//import org.openecomp.portalapp.framework.ApplicationCommonContextTestSuite; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.core.io.ClassPathResource; -//import org.springframework.jdbc.datasource.DataSourceUtils; -//import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -// -//public class RemoveSampleTestData extends ApplicationCommonContextTestSuite { -// @Autowired -// DataSource dataSource; -// -// public static int count = 0; -// -// @After -// public void removeTestData() throws SQLException { -// String sql = "RemoveTestData.sql"; -// createConnection(sql); -// } -// -// public void createConnection(String sql) { -// Connection connection = null; -// ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); -// populator.addScript(new ClassPathResource(sql)); -// try { -// connection = DataSourceUtils.getConnection(dataSource); -// populator.populate(connection); -// } finally { -// if (connection != null) { -// DataSourceUtils.releaseConnection(connection, dataSource); -// } -// } -// } -// -// @Test -// public void removeTest() { -// assert (true); -// } -//} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/RestURLsTestSuite.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/RestURLsTestSuite.java deleted file mode 100644 index 4ff2b8da..00000000 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/core/RestURLsTestSuite.java +++ /dev/null @@ -1,334 +0,0 @@ -///*- -// * ================================================================================ -// * ECOMP Portal -// * ================================================================================ -// * Copyright (C) 2017 AT&T Intellectual Property -// * ================================================================================ -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * ================================================================================ -// */ -//package org.openecomp.portalapp.portal.core; -// -//import static org.junit.Assert.assertEquals; -//import static org.junit.Assert.assertTrue; -// -//import java.io.IOException; -//import java.nio.charset.Charset; -//import java.util.ArrayList; -// -//import org.junit.Assert; -//import org.junit.Test; -//import org.openecomp.portalapp.framework.ApplicationCommonContextTestSuite; -//import org.openecomp.portalapp.portal.domain.EPUser; -//import org.openecomp.portalapp.portal.test.core.MockEPUser; -//import org.openecomp.portalapp.portal.transport.AppNameIdIsAdmin; -//import org.openecomp.portalapp.portal.transport.AppsListWithAdminRole; -//import org.openecomp.portalsdk.core.util.SystemProperties; -//import org.springframework.http.MediaType; -//import org.springframework.test.web.servlet.ResultActions; -//import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -//import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -// -//import com.fasterxml.jackson.annotation.JsonInclude; -//import com.fasterxml.jackson.databind.ObjectMapper; -// -///** -// * -// * Use RestURLsTestSuite to test Rest API URL's -// */ -//public class RestURLsTestSuite extends ApplicationCommonContextTestSuite { -// -// public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(), -// MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8")); -// -// String url = null; -// -// MockEPUser mockUser = new MockEPUser(); -// -// public byte[] convertObjectToJsonBytes(Object object) throws IOException { -// ObjectMapper mapper = new ObjectMapper(); -// mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); -// return mapper.writeValueAsBytes(object); -// } -// -// public void requestBuilder(String url) throws Exception { -// EPUser user = mockUser.mockEPUser(); -// -// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get(url); -// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); -// ResultActions ra = getMockMvc().perform(requestBuilder); -// assertData(ra); -// } -// -// public void assertData(ResultActions ra) { -// Assert.assertEquals("application/json", ra.andReturn().getResponse().getContentType()); -// Assert.assertEquals(200, ra.andReturn().getResponse().getStatus()); -// -// } -// -// @Test -// public void getMenuItemsTest() throws Exception { -// url = "/portalApi/functionalMenu"; -// requestBuilder(url); -// } -// -// @Test -// public void getMenuItemsForNotificationsTest() throws Exception { -// url = "/portalApi/functionalMenuForNotificationTree"; -// requestBuilder(url); -// } -// -// @Test -// public void getUserAppsTestnew() throws Exception { -// url = "/portalApi/userApps"; -// requestBuilder(url); -// } -// -// @Test -// public void getPersUserAppsTest() throws Exception { -// url = "/portalApi/persUserApps"; -// requestBuilder(url); -// } -// -// @Test -// public void getAppCatalogTest() throws Exception { -// url = "/portalApi/appCatalog"; -// requestBuilder(url); -// } -// -// @Test -// public void getAppListNewTest() throws Exception { -// ResultActions ra = getMockMvc() -// .perform(MockMvcRequestBuilders.get("/portalApi/userApplicationRoles").param("userId", "guest")); -// assertData(ra); -// } -// -// @Test -// public void getAvailableAppListTest() throws Exception { -// url = "/portalApi/availableApps"; -// requestBuilder(url); -// } -// -// @Test -// public void getAllAppsTest() throws Exception { -// url = "/portalApi/allAvailableApps"; -// requestBuilder(url); -// } -// -// @Test -// public void getUserProfileTest() throws Exception { -// url = "/portalApi/userProfile"; -// requestBuilder(url); -// } -// -// @Test -// public void getRolesByAppTest() throws Exception { -// EPUser user = mockUser.mockEPUser(); -// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/adminAppsRoles/550"); -// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); -// ResultActions ra = getMockMvc().perform(requestBuilder); -// assertData(ra); -// } -// -// @Test -// public void getAppsWithAdminRoleStateForUserTest() throws Exception { -// url = "/portalApi/adminAppsRoles?user=guest"; -// requestBuilder(url); -// -// } -// -// @Test -// public void getUsersFromAppEndpointTest() throws Exception { -// url = "/portalApi/app/550/users"; -// requestBuilder(url); -// } -// -// @Test -// public void getOnboardingAppsTest() throws Exception { -// url = "/portalApi/onboardingApps"; -// requestBuilder(url); -// } -// -// @Test -// public void getMenuItemsForAuthUserTest() throws Exception { -// url = "/portalApi/functionalMenuForAuthUser"; -// requestBuilder(url); -// } -// -// @Test -// public void getMenuItemsForEditingTest() throws Exception { -// url = "/portalApi/functionalMenuForEditing"; -// requestBuilder(url); -// } -// -// @Test -// public void getAppRolesTest() throws Exception { -// url = "/portalApi/appRoles/455"; -// requestBuilder(url); -// } -// -// @Test -// public void regenerateAncestorTableTest() throws Exception { -// -// EPUser user = mockUser.mockEPUser(); -// -// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders -// .get("/portalApi/regenerateFunctionalMenuAncestors"); -// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); -// ResultActions ra = getMockMvc().perform(requestBuilder); -// assertEquals("application/json;charset=UTF-8", ra.andReturn().getResponse().getContentType()); -// Assert.assertEquals(200, ra.andReturn().getResponse().getStatus()); -// -// } -// -// @Test -// public void getAppListTest() throws Exception { -// url = "/portalApi/getAppList"; -// requestBuilder(url); -// } -// -// @Test -// public void getFavoritesForUserTest() throws Exception { -// url = "/portalApi/getFavoriteItems"; -// requestBuilder(url); -// } -// -// @Test -// public void getManifestTest() throws Exception { -// url = "/portalApi/manifest"; -// requestBuilder(url); -// } -// -// @Test -// public void getActiveUsersTest() throws Exception { -// url = "/portalApi/dashboard/activeUsers"; -// requestBuilder(url); -// } -// -// @Test -// public void searchPortalTest() throws Exception { -// EPUser user = mockUser.mockEPUser(); -// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/dashboard/search") -// .param("searchString", "guest"); -// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); -// ResultActions ra = getMockMvc().perform(requestBuilder); -// assertData(ra); -// } -// -// @Test -// public void getWidgetDataTest() throws Exception { -// EPUser user = mockUser.mockEPUser(); -// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/portalApi/dashboard/widgetData") -// .param("resourceType", "guest"); -// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); -// ResultActions ra = getMockMvc().perform(requestBuilder); -// assertData(ra); -// } -// -// @Test -// public void getAppsAndContactsTest() throws Exception { -// url = "/portalApi/contactus/allapps"; -// requestBuilder(url); -// } -// -// @Test -// public void getPortalDetailsTest() throws Exception { -// url = "/portalApi/contactus/feedback"; -// requestBuilder(url); -// } -// -// @Test -// public void getAppCategoryFunctionsTest() throws Exception { -// url = "/portalApi/contactus/functions"; -// requestBuilder(url); -// } -// -// @Test -// public void getOnlineUserUpdateRateTest() throws Exception { -// url = "/portalApi/dashboard/onlineUserUpdateRate"; -// requestBuilder(url); -// } -// -// @Test -// public void getMenuIdRoleIdTest() throws Exception { -// url = "/portalApi/getFunctionalMenuRole"; -// requestBuilder(url); -// } -// -// @Test -// public void getNotificationsTest() throws Exception { -// url = "/portalApi/getNotifications"; -// requestBuilder(url); -// } -// -// @Test -// public void getAdminNotificationsTest() throws Exception { -// url = "/portalApi/getAdminNotifications"; -// requestBuilder(url); -// } -// -// @Test -// public void getNotificationAppRolesTest() throws Exception { -// url = "/portalApi/getNotificationAppRoles"; -// requestBuilder(url); -// } -// -// @Test -// public void getNotificationUpdateRateTest() throws Exception { -// url = "/portalApi/notificationUpdateRate"; -// requestBuilder(url); -// } -// -// @Test -// public void notificationReadTest() throws Exception { -// url = "/portalApi/notificationRead?notificationId=262"; -// requestBuilder(url); -// } -// -// @Test -// public void testGetRolesTest() throws Exception { -// url = "/portalApi/notificationRole/248/roles"; -// requestBuilder(url); -// } -// -// @Test -// public void putAppsWithAdminRoleStateForUserTest() throws Exception { -// -// AppsListWithAdminRole appsListWithAdminRole = new AppsListWithAdminRole(); -// appsListWithAdminRole.setOrgUserId("guest"); -// ArrayList<AppNameIdIsAdmin> appsRoles = new ArrayList<AppNameIdIsAdmin>(); -// AppNameIdIsAdmin appNameIdIsAdmin = new AppNameIdIsAdmin(); -// appNameIdIsAdmin.setId((long) 455); -// appNameIdIsAdmin.setAppName("CCD"); -// appNameIdIsAdmin.setIsAdmin(true); -// appNameIdIsAdmin.setRestrictedApp(false); -// appsRoles.add(appNameIdIsAdmin); -// appsListWithAdminRole.setAppsRoles(appsRoles); -// EPUser user = mockUser.mockEPUser(); -// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.put("/portalApi/adminAppsRoles") -// .contentType(APPLICATION_JSON_UTF8).content(convertObjectToJsonBytes(appsListWithAdminRole)); -// -// requestBuilder.sessionAttr(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME), user); -// ResultActions ra = getMockMvc().perform(requestBuilder); -// assertData(ra); -// } -// -// @Test -// public void ticketEventControllerForExternalSystem() throws Exception { -// String ticketEventJson = "{\"application\": \"cbus\",\"event\": {\"body\": {\"ticketStatePhrase\": \"We recently detected a problem with the equipment at your site. The event is in queue for immediate work.\", \"ivrNotificationFlag\": \"1\",\"expectedRestoreDate\": 0,\"bridgeTransport\": \"AOTS\", \"reptRequestType\": 0,\"ticketNum\": \"000002000857405\",\"assetID\": \"CISCO_1921C1_ISR_G2\", \"eventDate\": 1490545134601,\"eventAbstract\": \"ospfIfConfigError trap received from Cisco_1921c1_ISR_G2 with arguments: ospfRouterId=Cisco_1921c1_ISR_G2; ospfIfIpAddress=1921c1_288266; ospfAddressLessIf=0; ospfPacketSrc=172.17.0.11; ospfConfigErrorType=2; ospfPacketType=1\",\"severity\": \"2 - Major\",\"ticketPriority\": \"3\",\"reportedCustomerImpact\": 0,\"testAutoIndicator\": 0,\"supportGroupName\": \"US-TEST-ORT\",\"lastModifiedDate\": \"1487687703\",\"messageGroup\": \"SNMP\",\"csi\": 0,\"mfabRestoredTime\": 0},\"header\": {\"timestamp\": \"2017-02-21T14:35:05.219+0000\",\"eventSource\": \"aotstm\",\"entityId\": \"000002000857405\", \"sequenceNumber\": 2 },\"blinkMsgId\": \"f38c071e-1a47-4b55-9e72-1db830100a61\",\"sourceIP\": \"130.4.165.158\"},\"SubscriberInfo\": {\"UserList\": [\"hk8777\"] }}"; -// MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/auxapi/ticketevent") -// .contentType(APPLICATION_JSON_UTF8).content(ticketEventJson); -// ResultActions ra = getMockMvc().perform(requestBuilder); -// assertTrue(ra.andReturn().getResponse().getContentType().contains("application/json")); -// } -//} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserAppTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserAppTest.java index 8e56a770..c6160b2d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserAppTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserAppTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserApplicationsTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserApplicationsTest.java index 2c3c9303..bf931a60 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserApplicationsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AdminUserApplicationsTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AppContactUsTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AppContactUsTest.java index 474434d1..8043a9dc 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AppContactUsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/AppContactUsTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/CentralRoleFunctionTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/CentralRoleFunctionTest.java index 4c05160d..fb0aee8e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/CentralRoleFunctionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/CentralRoleFunctionTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunctionTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunctionTest.java index 864b6aa6..0b46857c 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunctionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppRoleFunctionTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppTest.java index eb92b889..08383095 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPAppTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointAccountTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointAccountTest.java index c19ecf8b..db407633 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointAccountTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointAccountTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointTest.java index 45184de4..76cd5806 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPEndpointTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPRoleTest.java index 830eaa5b..891ad0eb 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPRoleTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRolesTest.java index 40bb16c1..7090d495 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppCatalogRolesTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetailTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetailTest.java index fec58dbf..93405f13 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetailTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesRequestDetailTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; @@ -46,9 +83,6 @@ public class EPUserAppRolesRequestDetailTest { assertEquals(epUserAppRolesRequestDetail.getReqRoleId(), new Long(1)); assertEquals(epUserAppRolesRequestDetail.getReqType(), "test"); - assertEquals(epUserAppRolesRequestDetail.getEpRequestIdData(), epUserAppRolesRequest); -// assertEquals(epUserAppRolesRequestDetail.hashCode(), epUserAppRolesRequestDetail1.hashCode()); - } } diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesTest.java index b13ae14a..eede33eb 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppRolesTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppTest.java index 0de0b590..1ab2f67e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreferenceTest.java index 0f4bb62e..fdf864bb 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsManualSortPreferenceTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreferenceTest.java index 4f70ea78..9e608fdd 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserAppsSortPreferenceTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserNotificationTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserNotificationTest.java index e896d081..88c02ae5 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserNotificationTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserNotificationTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserTest.java index 98065a2b..1561cb87 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPUserTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreferenceTest.java index fd7cb76f..61054ab9 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EPWidgetsManualSortPreferenceTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleIdTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleIdTest.java index bca8c491..3adfa236 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleIdTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleIdTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleTest.java index fc2c7b07..6b6dd67d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/EcompAppRoleTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetailsTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetailsTest.java index 5d62d34e..1220aa12 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetailsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalRoleDetailsTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccessTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccessTest.java index aea2c426..d5c964fc 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccessTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemAccessTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemRoleApprovalTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemRoleApprovalTest.java index b014b66f..cfc6ab48 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemRoleApprovalTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ExternalSystemRoleApprovalTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppIDTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppIDTest.java index 0e5bf9c5..17a3c320 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppIDTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/FunctionalMenuItemWithAppIDTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/GetAccessResultIdTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/GetAccessResultIdTest.java index 004d06b5..b0cf94dd 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/GetAccessResultIdTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/GetAccessResultIdTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceDataTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceDataTest.java index 94014614..c6681089 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceDataTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceDataTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import java.util.ArrayList; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceParameterTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceParameterTest.java index bcd3ff36..112fc0d6 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceParameterTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/MicroserviceParameterTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserAppSelectionTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserAppSelectionTest.java index 3aff8cce..1a06b05d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserAppSelectionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserAppSelectionTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelectionTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelectionTest.java index da480134..10a4bcba 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelectionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/PersUserWidgetSelectionTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ResultTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ResultTest.java index 19991b51..cd558cfd 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ResultTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/ResultTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/SharedContextTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/SharedContextTest.java index 8e2ff420..da00649d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/SharedContextTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/SharedContextTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/UserIdRoleIdTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/UserIdRoleIdTest.java index b41bcadb..10a1f21a 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/UserIdRoleIdTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/UserIdRoleIdTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameterTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameterTest.java index 7db79b80..101896a0 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameterTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogParameterTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogTest.java index 9e606fc3..4c7844f3 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetCatalogTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetParameterResultTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetParameterResultTest.java index 4e80bdb9..65a984d8 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetParameterResultTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetParameterResultTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetTest.java index bb75836c..d9abd91d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/domain/WidgetTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.domain; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceExceptionTest.java index 71f620f3..f67b0e2d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceExceptionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/exceptions/NoHealthyServiceExceptionTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.exceptions; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/framework/ApplicationCommonContextTestSuite.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/framework/ApplicationCommonContextTestSuite.java deleted file mode 100644 index 96d7f310..00000000 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/framework/ApplicationCommonContextTestSuite.java +++ /dev/null @@ -1,172 +0,0 @@ -///*- -// * ================================================================================ -// * ECOMP Portal -// * ================================================================================ -// * Copyright (C) 2017 AT&T Intellectual Property -// * ================================================================================ -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * ================================================================================ -// */ -//package org.openecomp.portalapp.portal.framework; -// -//import java.io.IOException; -// -//import org.junit.Before; -//import org.junit.runner.RunWith; -//import org.openecomp.portalsdk.core.conf.AppConfig; -////import org.openecomp.portalapp.conf.ExternalAppConfig; -////import org.openecomp.portalapp.conf.HibernateMappingLocations; -//import org.openecomp.portalsdk.core.conf.HibernateConfiguration; -//import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable; -//import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; -//import org.openecomp.portalsdk.core.util.CacheManager; -//import org.openecomp.portalsdk.core.util.SystemProperties; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.context.annotation.Bean; -//import org.springframework.context.annotation.ComponentScan; -//import org.springframework.context.annotation.Configuration; -//import org.springframework.context.annotation.FilterType; -//import org.springframework.context.annotation.Profile; -//import org.springframework.core.io.ClassPathResource; -//import org.springframework.core.io.Resource; -//import org.springframework.test.context.ActiveProfiles; -//import org.springframework.test.context.ContextConfiguration; -//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -//import org.springframework.test.context.web.AnnotationConfigWebContextLoader; -//import org.springframework.test.context.web.WebAppConfiguration; -//import org.springframework.test.web.servlet.MockMvc; -//import org.springframework.test.web.servlet.setup.MockMvcBuilders; -//import org.springframework.web.context.WebApplicationContext; -//import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -// -///** -// * -// * In order to write a unit test, 1. inherit this class 2. place the "war" -// * folder on your test class's classpath 3. run the test with the following VM -// * argument; This is important because when starting the application from -// * Container, the System Properties file (SystemProperties.java) can have the -// * direct path but, when running from the Mock Junit container, the path should -// * be prefixed with "classpath" to enable the mock container to search for the -// * file in the classpath -Dcontainer.classpath="classpath:" -// */ -// -//@SuppressWarnings("deprecation") -//@RunWith(SpringJUnit4ClassRunner.class) -//@WebAppConfiguration -//@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = { MockAppConfig.class }) -//@ActiveProfiles(value = "test") -//public class ApplicationCommonContextTestSuite { -// -// @Autowired -// public WebApplicationContext wac; -// -// private MockMvc mockMvc; -// -// @Before -// public void setup() { -// if (mockMvc == null) { -// this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); -// -// } -// } -// -// public Object getBean(String name) { -// return this.wac.getBean(name); -// } -// -// public MockMvc getMockMvc() { -// return mockMvc; -// } -// -// public void setMockMvc(MockMvc mockMvc) { -// this.mockMvc = mockMvc; -// } -// -// public WebApplicationContext getWebApplicationContext() { -// return wac; -// } -// -//} -// -//@Configuration -//@ComponentScan(basePackages = "org.openecomp", excludeFilters = { -// // the following source configurations should not be scanned; instead of -// // using Exclusion filter, we can use the @Profile annotation to exclude -// // them -// @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.LogoutController*"), -// @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.controller.SDKLoginController*"), -// @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalapp.conf.ExternalAppConfig*"), -// @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.*.*InitUebHandler*") }) -//@Profile("test") -//class MockAppConfig extends AppConfig { -// -// @Bean -// HibernateMappingLocatable locatable() { -// return new MockHibernateMappingLocations(); -// } -// -// @Bean -// HibernateConfiguration hibConfiguration() { -// return new HibernateConfiguration(); -// } -// -// @Bean -// public SystemProperties systemProperties() { -// return new MockSystemProperties(); -// } -// -// @Bean -// public AbstractCacheManager cacheManager() { -// return new CacheManager() { -// -// public void configure() throws IOException { -// -// } -// }; -// } -// -// public String[] tileDefinitions() { -// return new String[] { "classpath:/WEB-INF/fusion/defs/definitions.xml", -// "classpath:/WEB-INF/defs/definitions.xml" }; -// } -// -// public void addInterceptors(InterceptorRegistry registry) { -// // registry.addInterceptor(new -// // SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout()); -// // registry.addInterceptor(resourceInterceptor()); -// } -// -// public static class MockSystemProperties extends SystemProperties { -// -// public MockSystemProperties() { -// } -// -// } -// -//} -// -//@Profile("test") -//class MockHibernateMappingLocations implements HibernateMappingLocatable { -// -// public Resource[] getMappingLocations() { -// return new Resource[] { new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"), -// new ClassPathResource("WEB-INF/fusion/orm/EP.hbm.xml"), -// new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml") }; -// -// } -// -// public String[] getPackagesToScan() { -// return new String[] { "org.openecomp", "src" }; -// } -// -//} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java index ccda5f3e..6ba142b1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.framework; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java index f87f5bd1..651f7f61 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.listener; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/FusionLicenseManagerImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/FusionLicenseManagerImplTest.java index 6c1e52f7..ecdf415c 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/FusionLicenseManagerImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/FusionLicenseManagerImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.lm; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/LicenseableClassImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/LicenseableClassImplTest.java index b57291ee..64a04892 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/LicenseableClassImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/lm/LicenseableClassImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.lm; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCatalogItemTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCatalogItemTest.java index 5b8440b8..b87deb2c 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCatalogItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCatalogItemTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.model; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCategoryFunctionsItemTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCategoryFunctionsItemTest.java index 817f5e13..9c31aa45 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCategoryFunctionsItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppCategoryFunctionsItemTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.model; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppContactUsItemTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppContactUsItemTest.java index 1e286208..effb0069 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppContactUsItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/AppContactUsItemTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.model; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/SearchResultItemTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/SearchResultItemTest.java index 84527d09..e9c3faae 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/SearchResultItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/model/SearchResultItemTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.model; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImplTest.java index 5c6d04f5..e80087e8 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/AppContactUsServiceImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImplTest.java index d67f8773..853ecbe0 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/DashboardSearchServiceImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImplTest.java index 789f2bfd..072d6347 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceCentralizedImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImplTest.java index 07eeed7e..288b854f 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleFunctionServiceImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleServiceImplTest.java index 766d51be..1a2d76ca 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/EPRoleServiceImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java index 4c67fa06..f1103fbb 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/FunctionalMenuMockServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/FunctionalMenuMockServiceImplTest.java index 77988aae..62a3f850 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/FunctionalMenuMockServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/FunctionalMenuMockServiceImplTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/FunctionalMenuServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/FunctionalMenuServiceImplTest.java deleted file mode 100644 index 71bf067b..00000000 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/FunctionalMenuServiceImplTest.java +++ /dev/null @@ -1,73 +0,0 @@ -///*- -// * ================================================================================ -// * ECOMP Portal -// * ================================================================================ -// * Copyright (C) 2017 AT&T Intellectual Property -// * ================================================================================ -// * Licensed under the Apache License, Version 2.0 (the "License"); -// * you may not use this file except in compliance with the License. -// * You may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, software -// * distributed under the License is distributed on an "AS IS" BASIS, -// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// * See the License for the specific language governing permissions and -// * limitations under the License. -// * ================================================================================ -// */ -//package org.openecomp.portalapp.portal.test.service; -// -//import static org.junit.Assert.assertTrue; -// -//import java.util.ArrayList; -//import java.util.HashMap; -//import java.util.List; -//import java.util.Map; -// -//import org.junit.Test; -//import org.openecomp.portalapp.portal.service.FunctionalMenuService; -//import org.openecomp.portalapp.portal.transport.BusinessCardApplicationRole; -//import org.openecomp.portalapp.portal.transport.FunctionalMenuRole; -//import org.openecomp.portalapp.test.framework.ApplicationCommonContextTestSuite; -//import org.springframework.beans.factory.annotation.Autowired; -// -//public class FunctionalMenuServiceImplTest extends ApplicationCommonContextTestSuite { -// -// @Autowired -// FunctionalMenuService functionalMenuService; -// -// @Test -// public void getAppListTestService() throws Exception { -// -// String userId = "guestT"; -// List<BusinessCardApplicationRole> userAppRolesActualResult = null; -// -// List<BusinessCardApplicationRole> userAppRolesExpectedResult = new ArrayList<BusinessCardApplicationRole>(); -// BusinessCardApplicationRole businessCardApplicationRole = new BusinessCardApplicationRole(); -// businessCardApplicationRole.setAppName("ECOMP Portal"); -// businessCardApplicationRole.setRoleName("System Administrator"); -// userAppRolesExpectedResult.add(businessCardApplicationRole); -// Map<String, String> params = new HashMap<String, String>(); -// params.put("userId", userId); -// userAppRolesActualResult = functionalMenuService.getUserAppRolesList(userId); -// assertTrue(userAppRolesActualResult.contains(businessCardApplicationRole)); -// -// } -// -// @Test -// public void getFunctionalMenuRoleTest() throws Exception { -// -// FunctionalMenuRole expectedFunctionalMenuRole = new FunctionalMenuRole(); -// expectedFunctionalMenuRole.setId(new Integer(-1)); -// -// expectedFunctionalMenuRole.setMenuId((long) 137); -// expectedFunctionalMenuRole.setAppId(new Integer(456)); -// expectedFunctionalMenuRole.setRoleId(new Integer(6214)); -// List<FunctionalMenuRole> actualFunctionalMenuRoleList = null; -// actualFunctionalMenuRoleList = functionalMenuService.getFunctionalMenuRole(); -// assertTrue(actualFunctionalMenuRoleList.contains(expectedFunctionalMenuRole)); -// -// } -//} diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/GetAccessServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/GetAccessServiceImplTest.java index 84096f13..4d887c47 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/GetAccessServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/GetAccessServiceImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/LicenseableClassImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/LicenseableClassImplTest.java index d04355d2..e3b3d8fe 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/LicenseableClassImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/LicenseableClassImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ManifestServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ManifestServiceImplTest.java index 1c09a49d..26973b99 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ManifestServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/ManifestServiceImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import static org.junit.Assert.assertTrue; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImplTest.java index 7155e146..14e3f9f8 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImplTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/service/PersUserAppServiceImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import java.util.ArrayList; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java index 7fd3c03f..ea37b921 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AnalyticsTest.java @@ -1,3 +1,41 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java index c583c9cd..d2c92864 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppCatalogPersonalizationTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java index a1dffd28..cb52c50f 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppNameIdIsAdminTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java index 2a7c343c..1be7622e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppWithRolesForUserTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import org.junit.Test; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java index 2c601d3c..0b0edc88 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/AppsListWithAdminRoleTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java index 854afccc..327060a9 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadRoleFunctionTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java index b2bbba68..5469ff62 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BulkUploadUserRolesTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java index 0ed06b12..b01da14d 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRoleTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java index 9f5e6785..a6ecb2f9 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/BusinessCardApplicationRolesListTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java index 97c9c59f..69acdaa1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralAppTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java index 6ba0a444..0ec0a300 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralRoleTest.java @@ -1,13 +1,46 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; -import static org.junit.Assert.*; - -import java.util.Date; -import java.util.SortedSet; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import org.junit.Test; -import org.openecomp.portalapp.portal.domain.CentralRoleFunction; -import org.openecomp.portalapp.portal.transport.CentralRole; public class CentralRoleTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java index f3582647..9b4b5f8a 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserAppTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java index 9df86bc9..aad881b2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/CentralUserTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java index 6e8b4018..0d4c09a1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsManualPreferenceTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java index 6c67424a..693cd61e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPAppsSortPreferenceTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java index 78bb8474..9dc739a8 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPDeleteAppsManualSortPrefTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java index 9c82ad37..6bb70f71 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPUserAppCurrentRolesTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java index d466d91c..5b94b09e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EPWidgetsSortPreferenceTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java index 928c3737..4bfb98b2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EcompUserAppRolesTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java index 11fe2cf7..41a12f90 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemExtVOTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java index 6e1e48c6..2961a2de 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java index 35a11833..9cf1458b 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpNotificationItemVOTest.java @@ -1,11 +1,45 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; -import java.util.Date; - import org.junit.Test; -import org.openecomp.portalapp.portal.transport.EpNotificationItemVO; public class EpNotificationItemVOTest { diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java index beb67ba9..6ebc0ff8 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/EpRoleNotificationItemTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java index f490973a..60f718c5 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsDetailTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java index dfae6042..e8a212d9 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessPermsTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java index 4e736eba..6bdcb3bd 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRolePermsTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java index 19dee193..11ff44bc 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessRoleTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java index 6ffab981..d332b60a 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserRoleDetailTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java index d2be97b1..1c6a819a 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalAccessUserTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java index 5b6fe825..f99f54f2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/ExternalRoleDescriptionTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java index 7d4b96e5..15b27def 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuItemTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import java.util.ArrayList; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java index 09f4bc67..ea170e10 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/FunctionalMenuRoleTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java index ef926f6a..c54bdf9e 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RemoteUserWithRolesTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java index 66624c2a..5348f686 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/RoleInAppForUserTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java index 632eeb4f..625f0589 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserApplicationRolesTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java index 7267dcde..2238bf98 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/UserWithNameSurnameTitleTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java index 6681d0a4..236990c8 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/transport/WidgetCatalogPersonalizationTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.transport; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java index c71c8a11..4a1e58b2 100644 --- a/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.utils; diff --git a/ecomp-portal-BE-os/pom.xml b/ecomp-portal-BE-os/pom.xml index 0a45000f..ab9efd87 100644 --- a/ecomp-portal-BE-os/pom.xml +++ b/ecomp-portal-BE-os/pom.xml @@ -1,59 +1,21 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.onap.portal</groupId> + <parent> + <groupId>org.onap.portal</groupId> + <artifactId>onap-portal-parent</artifactId> + <version>1.3.0-SNAPSHOT</version> + </parent> + <artifactId>ecompportal-be-os</artifactId> <packaging>war</packaging> - <version>1.1</version> <properties> - <portal.version>1.3.0-SNAPSHOT</portal.version> - <epsdk.version>1.3.0</epsdk.version> - <!-- Jenkins SHOULD invoke mvn with argument -Dbuild.number=${BUILD_NUMBER} --> - <build.number>0</build.number> - <springframework.version>4.2.0.RELEASE</springframework.version> - <hibernate.version>4.3.11.Final</hibernate.version> - <eelf.version>1.0.0</eelf.version> - <encoding>UTF-8</encoding> - <!-- If skipTests is false use this command to generate the report: - mvn clean jacoco:prepare-agent install jacoco:report --> + <!-- If skipTests is false use this command to generate the report: mvn + clean jacoco:prepare-agent install jacoco:report --> <skipTests>false</skipTests> - <skipCoverage>false</skipCoverage> - <jacoco.data.file>${project.build.directory}/coverage-reports/jacoco-ut.exec</jacoco.data.file> - <sonar-jacoco-listeners.version>3.8</sonar-jacoco-listeners.version> - <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin> - <sonar.jacoco.reportPath>${project.build.directory}/code-coverage/jacoco.exec</sonar.jacoco.reportPath> - <sonar.jacoco.itReportPath>${project.build.directory}/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath> - <!-- Note: This list should match jacoco-maven-plugin's exclusion list below --> - <sonar.exclusions>**.js</sonar.exclusions> - <nexusproxy>https://nexus.onap.org</nexusproxy> - <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath> - <stagingNexusPath>content/repositories/staging/</stagingNexusPath> - <releaseNexusPath>content/repositories/releases/</releaseNexusPath> </properties> - <repositories> - <repository> - <id>onap-releases</id> - <name>ONAP - Release Repository</name> - <url>${nexusproxy}/${releaseNexusPath}</url> - </repository> - <repository> - <id>onap-staging</id> - <name>ONAP - Staging Repository</name> - <url>${nexusproxy}/${stagingNexusPath}</url> - </repository> - <repository> - <id>onap-snapshots</id> - <name>ONAP - Snapshot Repository</name> - <url>${nexusproxy}/${snapshotNexusPath}</url> - </repository> - <repository> - <id>onap-public</id> - <url>${nexusproxy}/content/groups/public</url> - </repository> - </repositories> - <build> <sourceDirectory>src/main/java</sourceDirectory> <!-- The war file name carries no version number --> @@ -78,76 +40,72 @@ </dependencies> </plugin> <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>0.7.6.201602180812</version> - <executions> - <execution> - <id>prepare-agent</id> - <goals> - <goal>prepare-agent</goal> - </goals> - <phase>test</phase> - <configuration> - <destFile>${sonar.jacoco.reportPath}</destFile> - <skip>${skipCoverage}</skip> - </configuration> - </execution> - <execution> - <id>report</id> - <goals> - <goal>report</goal> - </goals> - <phase>test</phase> - <configuration> - <dataFile>${sonar.jacoco.reportPath}</dataFile> - <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory> - <skip>${skipCoverage}</skip> - </configuration> - </execution> - <!-- Integration Tests (Only report goal) --> - <execution> - <id>report-integration</id> - <goals> - <goal>report-integration</goal> - </goals> - <configuration> - <dataFile>${sonar.jacoco.itReportPath}</dataFile> - <outputDirectory>${project.basedir}/target/site/it-jacoco</outputDirectory> - <skip>${skipCoverage}</skip> - </configuration> - </execution> - <!-- Will see build errors while running the test cases because of dual - instrumentation --> - <execution> - <id>default-instrument</id> - <goals> - <goal>instrument</goal> - </goals> - <configuration> - <skip>${skipCoverage}</skip> - </configuration> - </execution> - <execution> - <id>default-restore-instrumented-classes</id> - <goals> - <goal>restore-instrumented-classes</goal> - </goals> - <configuration> - <skip>${skipCoverage}</skip> - </configuration> - </execution> - </executions> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.6.201602180812</version> + <inherited>True</inherited> + <executions> + <!-- Unit-Tests --> + <execution> + <id>prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + <configuration> + <skipTests>false</skipTests> + <destFile>${sonar.jacoco.reportPath}</destFile> + </configuration> + </execution> + <execution> + <id>default-instrument</id> + <goals> + <goal>instrument</goal> + </goals> + <configuration> + <skipTests>false</skipTests> + </configuration> + </execution> + <execution> + <id>default-restore-instrumented-classes</id> + <phase>test</phase> + <goals> + <goal>restore-instrumented-classes</goal> + </goals> + <configuration> + <skipTests>false</skipTests> + </configuration> + </execution> + <execution> + <id>post-unit-test</id> + <phase>test</phase> + + <goals> + <goal>report</goal> + </goals> + <configuration> + <skipTests>false</skipTests> + <dataFile>${sonar.jacoco.reportPath}</dataFile> + <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory> + </configuration> + </execution> + <!-- Will see build errors while running the test cases because of dual + instrumentation --> + + <!-- Integration Tests (Only report goal) --> + <execution> + <id>report-integration</id> + <phase>test</phase> + <goals> + <goal>report-integration</goal> + </goals> + <configuration> + <skipTests>false</skipTests> + <dataFile>${sonar.jacoco.itReportPath}</dataFile> + <outputDirectory>${project.basedir}/target/site/it-jacoco</outputDirectory> + </configuration> + </execution> + </executions> </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> @@ -190,7 +148,7 @@ </manifestEntries> </archive> <overlays> - <!-- specify the order in which these should be applied --> + <!-- specify the order in which these should be applied --> <overlay> <groupId>org.onap.portal</groupId> <artifactId>ecompportal-be-common</artifactId> @@ -198,7 +156,7 @@ <overlay> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-app-overlay</artifactId> - </overlay> + </overlay> </overlays> </configuration> </plugin> @@ -279,23 +237,6 @@ </resources> </configuration> </execution> -<!-- <execution> --> -<!-- <id>copy-src</id> --> -<!-- <phase>generate-resources</phase> --> -<!-- <goals> --> -<!-- <goal>copy-resources</goal> --> -<!-- </goals> --> -<!-- <configuration> --> -<!-- <outputDirectory>${basedir}/target/classes</outputDirectory> --> -<!-- <overwrite>false</overwrite> --> -<!-- <skip>${skipTests}</skip> --> -<!-- <resources> --> -<!-- <resource> --> -<!-- <directory>${basedir}/../ecomp-portal-BE-common/target/classes</directory> --> -<!-- </resource> --> -<!-- </resources> --> -<!-- </configuration> --> -<!-- </execution> --> </executions> </plugin> </plugins> @@ -340,29 +281,6 @@ </build> <dependencies> - <!-- - <dependency> - <groupId>com.att.eelf</groupId> - <artifactId>eelf-core</artifactId> - <version>${eelf.version}</version> - <exclusions> - <exclusion> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - </exclusion> - <exclusion> - <groupId>org.powermock</groupId> - <artifactId>powermock-module-junit4</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>2.5</version> - </dependency> - --> <!-- Spring --> <dependency> <groupId>org.springframework</groupId> @@ -414,18 +332,12 @@ </exclusion> </exclusions> </dependency> - <!-- Hibernate --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${hibernate.version}</version> </dependency> - - <!-- jsr303 validation --> - <!-- <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> - <version>1.1.0.Final</version> </dependency> --> - <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> @@ -464,7 +376,6 @@ <artifactId>cxf-rt-rs-client</artifactId> <version>3.0.0-milestone1</version> </dependency> - <!-- Mapper --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> @@ -486,14 +397,12 @@ <artifactId>classmate</artifactId> <version>1.3.1</version> </dependency> - <!-- Use Mariadb connector/j for failover --> <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> <version>1.5.8</version> </dependency> - <!-- Elastic Search --> <dependency> <groupId>org.elasticsearch</groupId> @@ -505,7 +414,6 @@ <artifactId>jest</artifactId> <version>2.0.0</version> </dependency> - <dependency> <groupId>org.apache.jcs</groupId> <artifactId>jcs</artifactId> @@ -517,14 +425,12 @@ </exclusion> </exclusions> </dependency> - <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-websocket</artifactId> <version>8.0.28</version> <scope>provided</scope> </dependency> - <!-- Raptor required Libraries --> <!-- for static charts --> <dependency> @@ -593,10 +499,6 @@ </exclusion> </exclusions> </dependency> - - <!-- <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> - <version>2.0.8</version> <exclusions> <exclusion> <groupId>org.bouncycastle</groupId> - <artifactId>bcprov-jdk14</artifactId> </exclusion> </exclusions> </dependency> --> <!-- Quartz --> <dependency> <groupId>org.quartz-scheduler</groupId> @@ -610,13 +512,11 @@ </exclusion> </exclusions> </dependency> - <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.9</version> </dependency> - <dependency> <groupId>com.att.nsa</groupId> <artifactId>cambriaClient</artifactId> @@ -640,7 +540,6 @@ </exclusion> </exclusions> </dependency> - <!-- SDK overlay war --> <dependency> <groupId>org.onap.portal.sdk</groupId> @@ -648,30 +547,26 @@ <version>${epsdk.version}</version> <type>war</type> </dependency> - <dependency> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-app-common</artifactId> <version>${epsdk.version}</version> <type>jar</type> </dependency> - <!-- EcompPortal common overlay --> <dependency> <groupId>org.onap.portal</groupId> <artifactId>ecompportal-be-common</artifactId> - <version>${portal.version}</version> + <version>${project.version}</version> <type>war</type> </dependency> - <dependency> <groupId>org.onap.portal</groupId> <artifactId>ecompportal-be-common</artifactId> - <version>${portal.version}</version> + <version>${project.version}</version> <type>jar</type> <classifier>classes</classifier> </dependency> - <dependency> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-fw</artifactId> @@ -695,19 +590,16 @@ </exclusion> </exclusions> </dependency> - <dependency> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-core</artifactId> <version>${epsdk.version}</version> </dependency> - <dependency> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-workflow</artifactId> <version>${epsdk.version}</version> </dependency> - <!-- Raptor required Libraries --> <!-- for static charts --> <dependency> @@ -715,7 +607,6 @@ <artifactId>epsdk-analytics</artifactId> <version>${epsdk.version}</version> </dependency> - <!-- Referenced by some poms and needed for testing; do NOT use "test" scope here. --> <dependency> @@ -723,7 +614,6 @@ <artifactId>httpclient</artifactId> <version>4.5.2</version> </dependency> - <!-- for testing --> <dependency> <groupId>junit</groupId> @@ -752,14 +642,11 @@ <version>1.8.5</version> <scope>test</scope> </dependency> - <dependency> + <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.9.2</version> </dependency> - - - <!-- OpenID Connect Dependencies --> <dependency> <groupId>org.mitre</groupId> @@ -772,7 +659,6 @@ </exclusion> </exclusions> </dependency> - <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-taglibs</artifactId> @@ -784,7 +670,6 @@ </exclusion> </exclusions> </dependency> - <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> @@ -795,7 +680,6 @@ <artifactId>aspectjweaver</artifactId> <version>1.8.9</version> </dependency> - </dependencies> <reporting> @@ -803,7 +687,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> - <version>2.10.4</version> + <version>3.0.0-M1</version> <configuration> <failOnError>false</failOnError> <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet> @@ -816,15 +700,8 @@ <useStandardDocletOptions>true</useStandardDocletOptions> </configuration> </plugin> - + </plugins> </reporting> - <distributionManagement> - <site> - <id>ecomp-site</id> - <url>dav:${nexusproxy}/content/sites/site/org/onap/portal/${project.version}</url> - </site> - </distributionManagement> - </project> diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/LoginStrategy.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/LoginStrategy.java index 19637515..6cdcb6ba 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/LoginStrategy.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/LoginStrategy.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.authentication; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/OpenIdConnectLoginStrategy.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/OpenIdConnectLoginStrategy.java index 48f447b4..02cd340a 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/OpenIdConnectLoginStrategy.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/OpenIdConnectLoginStrategy.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.authentication; @@ -28,7 +46,6 @@ import org.mitre.openid.connect.model.UserInfo; import org.openecomp.portalapp.command.EPLoginBean; import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalapp.portal.utils.EPSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalapp.util.EPUserUtils; import org.openecomp.portalapp.util.SessionCookieUtil; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -39,7 +56,7 @@ import org.springframework.web.servlet.ModelAndView; public class OpenIdConnectLoginStrategy extends org.openecomp.portalsdk.core.auth.LoginStrategy implements org.openecomp.portalapp.authentication.LoginStrategy { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(OpenIdConnectLoginStrategy.class); + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(OpenIdConnectLoginStrategy.class); private static final String GLOBAL_LOCATION_KEY = "Location"; @@ -71,7 +88,6 @@ public class OpenIdConnectLoginStrategy extends org.openecomp.portalsdk.core.aut return true; } else { // in case authentication cookie is missing, send 401 UNAUTHORIZED to client and it will redirect to Logon - try { String authentication = SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM); String loginUrl = SystemProperties.getProperty(EPSystemProperties.LOGIN_URL_NO_RET_VAL); @@ -85,7 +101,7 @@ public class OpenIdConnectLoginStrategy extends org.openecomp.portalsdk.core.aut response.setHeader(GLOBAL_LOCATION_KEY, loginUrl); } } catch(Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in preHandle() while redirecting, Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "login failed", e); } } return false; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/SimpleLoginStrategy.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/SimpleLoginStrategy.java index 0c3c4996..b7e16443 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/SimpleLoginStrategy.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/authentication/SimpleLoginStrategy.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.authentication; @@ -25,15 +43,12 @@ import javax.servlet.http.HttpServletResponse; import org.openecomp.portalapp.command.EPLoginBean; import org.openecomp.portalapp.portal.service.EPLoginService; import org.openecomp.portalapp.portal.service.EPRoleFunctionService; -import org.openecomp.portalapp.portal.service.EPRoleService; import org.openecomp.portalapp.portal.utils.EPSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalapp.util.EPUserUtils; import org.openecomp.portalapp.util.SessionCookieUtil; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.menu.MenuProperties; import org.openecomp.portalsdk.core.onboarding.exception.PortalAPIException; -import org.openecomp.portalsdk.core.onboarding.util.*; import org.openecomp.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; @@ -43,8 +58,6 @@ public class SimpleLoginStrategy extends org.openecomp.portalsdk.core.auth.Login @Autowired private EPLoginService loginService; - @Autowired - private EPRoleService roleService; @Autowired private EPRoleFunctionService ePRoleFunctionService; @@ -94,7 +107,7 @@ public class SimpleLoginStrategy extends org.openecomp.portalsdk.core.auth.Login response.setHeader(GLOBAL_LOCATION_KEY, loginUrl); //returnUrl + "/index.htm"); } } catch(Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in preHandle() while redirecting, Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "login failed", e); } } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java index 92d63742..7b44add9 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.conf; @@ -114,7 +132,7 @@ public class ExternalAppConfig extends AppConfig implements Configurable { MDC.put(MDC_ALERT_SEVERITY, AlarmSeverityEnum.INFORMATIONAL.toString()); MDC.put(MDC_INSTANCE_UUID, SystemProperties.getProperty(SystemProperties.INSTANCE_UUID)); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "init failed", e); } } @@ -289,7 +307,7 @@ public class ExternalAppConfig extends AppConfig implements Configurable { try { cronSiteVal = SystemProperties.getProperty(CRON_SITE_NAME); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getScheduleName failed", e); logger.warn(EELFLoggerDelegate.errorLogger, "Cron site name not added in property file, using Default value"); } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java index 1c9f43df..121c4beb 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.conf; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java index 0ebf4e38..7f0e9569 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.conf; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ECOMPLogoutController.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ECOMPLogoutController.java index b4e3bee9..10ae7b9d 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ECOMPLogoutController.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ECOMPLogoutController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/LoginController.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/LoginController.java index 33cc4dd7..ce6cc530 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/LoginController.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/LoginController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; @@ -37,19 +55,14 @@ import org.openecomp.portalapp.command.EPLoginBean; import org.openecomp.portalapp.portal.domain.SharedContext; import org.openecomp.portalapp.portal.service.EPLoginService; import org.openecomp.portalapp.portal.service.EPRoleFunctionService; -import org.openecomp.portalapp.portal.service.EPRoleService; import org.openecomp.portalapp.portal.service.SharedContextService; import org.openecomp.portalapp.portal.utils.EPSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.service.EPProfileService; import org.openecomp.portalapp.util.EPUserUtils; import org.openecomp.portalapp.util.SessionCookieUtil; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.menu.MenuProperties; -import org.openecomp.portalsdk.core.onboarding.listener.PortalTimeoutHandler; import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.portalsdk.core.web.support.AppUtils; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -66,333 +79,307 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Controller @RequestMapping("/") -public class LoginController extends EPUnRestrictedBaseController implements LoginService{ - - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LoginController.class); - +public class LoginController extends EPUnRestrictedBaseController implements LoginService { + + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LoginController.class); + public static final String DEFAULT_SUCCESS_VIEW = "applicationsHome"; public static final String DEFAULT_FAILURE_VIEW = "login"; - public static final String ERROR_MESSAGE_KEY = "error"; + public static final String ERROR_MESSAGE_KEY = "error"; public static final String REDIRECT_URL = "redirectUrl"; - - @Autowired - EPProfileService service; + public static final String REDIRECT_COLON = "redirect:"; + @Autowired private EPLoginService loginService; @Autowired private SharedContextService sharedContextService; - - @Autowired - private EPRoleService roleService; - @Autowired private EPRoleFunctionService ePRoleFunctionService; - - String viewName = "login"; - private String welcomeView; - public String getWelcomeView() { - return welcomeView; - } + private String viewName = "login"; + + private String welcomeView; - public void setWelcomeView(String welcomeView) { - this.welcomeView = welcomeView; - } - - @RequestMapping(value = {"/login.htm" }, method = RequestMethod.GET) + @RequestMapping(value = { "/login.htm" }, method = RequestMethod.GET) public ModelAndView login(HttpServletRequest request) { Map<String, Object> model = new HashMap<String, Object>(); - String authentication = SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM); - String loginPage; - - if (authentication == null || authentication.equals("") || authentication.trim().equals("OIDC")) + if (authentication == null || "".equals(authentication) || "OICD".equals(authentication.trim())) loginPage = "openIdLogin"; else - loginPage = getViewName(); - - return new ModelAndView(loginPage,"model", model); + loginPage = getViewName(); + return new ModelAndView(loginPage, "model", model); } - + @SuppressWarnings("rawtypes") - @RequestMapping(value = {"/open_source/login" }, method = RequestMethod.POST) - public @ResponseBody String loginValidate(HttpServletRequest request, HttpServletResponse response) throws Exception{ - + @RequestMapping(value = { "/open_source/login" }, method = RequestMethod.POST) + @ResponseBody + public String loginValidate(HttpServletRequest request, HttpServletResponse response) throws Exception { + ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); - - EPLoginBean commandBean = new EPLoginBean(); - String loginId = root.get("loginId").textValue(); - String password = root.get("password").textValue(); - commandBean.setLoginId(loginId); - commandBean.setLoginPwd(CipherUtil.encrypt(password)); - HashMap additionalParamsMap = new HashMap(); - StringBuilder sbAdditionalInfo = new StringBuilder(); - - commandBean = getLoginService().findUser(commandBean, (String)request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY), - additionalParamsMap); - String fullURL = getFullURL(request); - if (commandBean.getUser() == null) { - String loginErrorMessage = (commandBean.getLoginErrorMessage() != null) ? commandBean.getLoginErrorMessage() - : "login.error.external.invalid"; - - logger.info(EELFLoggerDelegate.debugLogger, "loginId = " + loginId + " does not exist in the the DB."); - logger.info(EELFLoggerDelegate.errorLogger, "loginId = " + loginId + " does not exist in the the DB."); - sbAdditionalInfo.append(String.format("But the Login-Id: %s doesn't exist in the Database. Request-URL: %s", + + EPLoginBean commandBean = new EPLoginBean(); + String loginId = root.get("loginId").textValue(); + String password = root.get("password").textValue(); + commandBean.setLoginId(loginId); + commandBean.setLoginPwd(CipherUtil.encrypt(password)); + HashMap additionalParamsMap = new HashMap(); + StringBuilder sbAdditionalInfo = new StringBuilder(); + + commandBean = getLoginService().findUser(commandBean, + (String) request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY), additionalParamsMap); + String fullURL = getFullURL(request); + if (commandBean.getUser() == null) { + String loginErrorMessage = (commandBean.getLoginErrorMessage() != null) ? commandBean.getLoginErrorMessage() + : "login.error.external.invalid"; + logger.info(EELFLoggerDelegate.debugLogger, "loginId {} does not exist in the the DB.", loginId); + sbAdditionalInfo.append(String.format("But the Login-Id: %s doesn't exist in the Database. Request-URL: %s", loginId, fullURL)); return loginErrorMessage; - } - else { - // store the currently logged in user's information in the session - EPUserUtils.setUserSession(request, commandBean.getUser(), commandBean.getMenu(), commandBean.getBusinessDirectMenu(), SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM),ePRoleFunctionService); - - try{ - logger.info(EELFLoggerDelegate.debugLogger, "******************* store user info into share context begins"); - String sessionId = request.getSession().getId(); - List<SharedContext> existingSC = getSharedContextService().getSharedContexts(sessionId); - if(existingSC==null || existingSC.size()==0){ - getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_FIRST_NAME, commandBean.getUser().getFirstName()); - getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_LAST_NAME, commandBean.getUser().getLastName()); - getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_EMAIL, commandBean.getUser().getEmail()); - getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_ORG_USERID, commandBean.getLoginId()); - } - - }catch(Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); - logger.info(EELFLoggerDelegate.errorLogger, "failed the shared context adding process " + e.getMessage()); - logger.info(EELFLoggerDelegate.debugLogger, "********************** failed the shared context adding process " + e.getMessage()); - } - logger.info(EELFLoggerDelegate.debugLogger, "********************* PresetUp the EP service cookie and intial sessionManagement"); - - SessionCookieUtil.preSetUp(request, response); - SessionCookieUtil.setUpUserIdCookie(request, response, loginId); - - JSONObject j = new JSONObject("{success: success}"); - - return j.toString(); - - } - + } else { + // store the currently logged in user's information in the session + EPUserUtils.setUserSession(request, commandBean.getUser(), commandBean.getMenu(), + commandBean.getBusinessDirectMenu(), + SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM), ePRoleFunctionService); + + try { + logger.info(EELFLoggerDelegate.debugLogger, "loginValidate: store user info into share context begins"); + String sessionId = request.getSession().getId(); + List<SharedContext> existingSC = getSharedContextService().getSharedContexts(sessionId); + if (existingSC == null || existingSC.isEmpty()) { + getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_FIRST_NAME, + commandBean.getUser().getFirstName()); + getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_LAST_NAME, + commandBean.getUser().getLastName()); + getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_EMAIL, + commandBean.getUser().getEmail()); + getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_ORG_USERID, + commandBean.getLoginId()); + } + + } catch (Exception e) { + logger.info(EELFLoggerDelegate.errorLogger, "loginValidate: failed the shared context adding process ", + e); + } + logger.info(EELFLoggerDelegate.debugLogger, + "loginValidate: PresetUp the EP service cookie and intial sessionManagement"); + + SessionCookieUtil.preSetUp(request, response); + SessionCookieUtil.setUpUserIdCookie(request, response, loginId); + + JSONObject j = new JSONObject("{success: success}"); + + return j.toString(); + } } - - /* Work around a bug in ecompsdkos version 1.1.0 which hard-codes this endpoint. */ - @RequestMapping(value = {"/process_csp" }, method = RequestMethod.GET) + + /* + * Work around a bug in ecompsdkos version 1.1.0 which hard-codes this endpoint. + */ + @RequestMapping(value = { "/process_csp" }, method = RequestMethod.GET) public ModelAndView processCsp(HttpServletRequest request, HttpServletResponse response) throws Exception { return processSingleSignOn(request, response); } - /* Remove this method after epsdk-app-common/.../SingleSignOnController.java is repaired. */ + /* + * Remove this method after epsdk-app-common/.../SingleSignOnController.java is + * repaired. + */ + + @RequestMapping(value = { "/processSingleSignOn" }, method = RequestMethod.GET) + public ModelAndView processSingleSignOn(HttpServletRequest request, HttpServletResponse response) throws Exception { - @RequestMapping(value = {"/processSingleSignOn" }, method = RequestMethod.GET) - public ModelAndView processSingleSignOn(HttpServletRequest request, HttpServletResponse response) throws Exception{ - - Map<Object, Object> model = new HashMap<Object, Object>(); + Map<Object, Object> model = new HashMap<Object, Object>(); HashMap<Object, Object> additionalParamsMap = new HashMap<Object, Object>(); EPLoginBean commandBean = new EPLoginBean(); MDC.put(MDC_KEY_REQUEST_ID, getRequestId(request)); - String orgUserId = ""; - //get userId from cookie - orgUserId = SessionCookieUtil.getUserIdFromCookie(request, response); - logger.info(EELFLoggerDelegate.debugLogger, "******************** process_singelSignOn process begins"); - logger.info(EELFLoggerDelegate.debugLogger, "******************* We get the orgUserId " + orgUserId); + // get userId from cookie + String orgUserId = SessionCookieUtil.getUserIdFromCookie(request, response); + logger.info(EELFLoggerDelegate.debugLogger, "processSingleSignOn: begins with orgUserId {}", orgUserId); StringBuilder sbAdditionalInfo = new StringBuilder(); - if ((orgUserId == null || orgUserId.length() == 0)) { + if (orgUserId == null || orgUserId.length() == 0) { model.put(ERROR_MESSAGE_KEY, SystemProperties.MESSAGE_KEY_LOGIN_ERROR_COOKIE_EMPTY); - if(request.getParameter("redirectUrl")!=null && request.getParameter("redirectUrl").length()!=0){ - return new ModelAndView("redirect:" + DEFAULT_FAILURE_VIEW + ".htm" + "?redirectUrl=" + request.getParameter("redirectUrl")); - }else{ - return new ModelAndView("redirect:" + DEFAULT_FAILURE_VIEW + ".htm"); + if (request.getParameter(REDIRECT_URL) != null && request.getParameter(REDIRECT_URL).length() != 0) { + return new ModelAndView(REDIRECT_COLON + DEFAULT_FAILURE_VIEW + ".htm" + "?redirectUrl=" + + request.getParameter(REDIRECT_URL)); + } else { + return new ModelAndView(REDIRECT_COLON + DEFAULT_FAILURE_VIEW + ".htm"); } - } - else { - + } else { + StopWatch stopWatch = new StopWatch("LoginController.Login"); stopWatch.start(); - + try { - logger.info(EELFLoggerDelegate.metricsLogger, "Operation findUser is started to locate " + orgUserId + " in the database."); - logger.info(EELFLoggerDelegate.debugLogger, "Operation findUser is started to locate " + orgUserId + " in the database."); + logger.info(EELFLoggerDelegate.debugLogger, + "Operation findUser is started to locate user {} in the database.", orgUserId); commandBean.setLoginId(orgUserId); commandBean.setOrgUserId(orgUserId); - commandBean = getLoginService().findUser(commandBean, (String)request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY), additionalParamsMap); - + commandBean = getLoginService().findUser(commandBean, + (String) request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY), + additionalParamsMap); + stopWatch.stop(); MDC.put(EPSystemProperties.MDC_TIMER, stopWatch.getTotalTimeMillis() + "ms"); - logger.info(EELFLoggerDelegate.metricsLogger, "Operation findUser is completed."); logger.info(EELFLoggerDelegate.debugLogger, "Operation findUser is completed."); - } catch(Exception e) { + } catch (Exception e) { stopWatch.stop(); MDC.put(EPSystemProperties.MDC_TIMER, stopWatch.getTotalTimeMillis() + "ms"); - logger.info(EELFLoggerDelegate.errorLogger, "Exception occurred while performing findUser " + orgUserId + ". Details: " + EcompPortalUtils.getStackTrace(e)); - logger.info(EELFLoggerDelegate.debugLogger, "Exception occurred while performing findUser " + orgUserId + ". Details: " + EcompPortalUtils.getStackTrace(e)); - logger.info(EELFLoggerDelegate.metricsLogger, "Operation findUser is failed."); + logger.info(EELFLoggerDelegate.errorLogger, "processSingleSignOn failed on user " + orgUserId, e); } finally { MDC.remove(EPSystemProperties.MDC_TIMER); } - + sbAdditionalInfo.append("Login attempt is succeeded. "); String fullURL = getFullURL(request); if (commandBean.getUser() == null) { - logger.info(EELFLoggerDelegate.debugLogger, "loginId = " + orgUserId + " does not exist in the the DB."); - logger.info(EELFLoggerDelegate.errorLogger, "loginId = " + orgUserId + " does not exist in the the DB."); - logger.info(EELFLoggerDelegate.debugLogger, "loginId = " + orgUserId + " does not exist in the the DB."); + logger.info(EELFLoggerDelegate.debugLogger, + "processSingleSignOn: loginId {} does not exist in the the DB.", orgUserId); - sbAdditionalInfo.append(String.format("But the Login-Id: %s doesn't exist in the Database. Created a Guest Session. Request-URL: %s", + sbAdditionalInfo.append(String.format( + "But the Login-Id: %s doesn't exist in the Database. Created a Guest Session. Request-URL: %s", orgUserId, fullURL)); - if(request.getParameter("redirectUrl")!=null && request.getParameter("redirectUrl").length()!=0){ - return new ModelAndView("redirect:" + DEFAULT_FAILURE_VIEW + ".htm" + "?redirectUrl=" + request.getParameter("redirectUrl")); - }else{ - return new ModelAndView("redirect:" + DEFAULT_FAILURE_VIEW + ".htm"); + if (request.getParameter(REDIRECT_URL) != null && request.getParameter(REDIRECT_URL).length() != 0) { + return new ModelAndView(REDIRECT_COLON + DEFAULT_FAILURE_VIEW + ".htm" + "?redirectUrl=" + + request.getParameter(REDIRECT_URL)); + } else { + return new ModelAndView(REDIRECT_COLON + DEFAULT_FAILURE_VIEW + ".htm"); + } + } else { + + sbAdditionalInfo.append( + String.format("Login-Id: %s, Login-Method: %s, Request-URL: %s", orgUserId, "", fullURL)); + logger.info(EELFLoggerDelegate.debugLogger, "processSingleSignOn: now set up user session for {}", + orgUserId); + + EPUserUtils.setUserSession(request, commandBean.getUser(), commandBean.getMenu(), + commandBean.getBusinessDirectMenu(), + SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM), ePRoleFunctionService); + logger.info(EELFLoggerDelegate.debugLogger, + "processSingleSignOn: now set up user session for {} finished", orgUserId); + + // Store user's information into share context + try { + logger.info(EELFLoggerDelegate.debugLogger, + "processSingleSignOn: store user info into share context begins"); + String sessionId = request.getSession().getId(); + List<SharedContext> existingSC = getSharedContextService().getSharedContexts(sessionId); + if (existingSC == null || existingSC.isEmpty()) { + getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_FIRST_NAME, + commandBean.getUser().getFirstName()); + getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_LAST_NAME, + commandBean.getUser().getLastName()); + getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_EMAIL, + commandBean.getUser().getEmail()); + getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_ORG_USERID, + commandBean.getLoginId()); + } + } catch (Exception e) { + logger.info(EELFLoggerDelegate.errorLogger, + "processSingleSignOn: failed the shared context adding process", e); + } + + logger.info(EELFLoggerDelegate.debugLogger, + "processSingleSignOn: PresetUp the EP service cookie and intial sessionManagement"); + SessionCookieUtil.preSetUp(request, response); + SessionCookieUtil.setUpUserIdCookie(request, response, orgUserId); + logger.info(EELFLoggerDelegate.debugLogger, + "processSingleSignOn: PresetUp the EP service cookie and intial sessionManagement completed"); + logger.info(EELFLoggerDelegate.debugLogger, + commandBean.getUser().getOrgUserId() + " exists in the the system."); + + // get redirectUrl from URL parameter + if (request.getParameter(REDIRECT_URL) != null && request.getParameter(REDIRECT_URL).length() != 0) { + String forwardUrl = URLDecoder.decode(request.getParameter(REDIRECT_URL), "UTF-8"); + // clean cookie + Cookie cookie2 = new Cookie(REDIRECT_URL, ""); + // ONAP does not use https + cookie2.setSecure(false); + cookie2.setMaxAge(0); + cookie2.setDomain(EPSystemProperties.getProperty(EPSystemProperties.COOKIE_DOMAIN)); + cookie2.setPath("/"); + response.addCookie(cookie2); + return new ModelAndView(REDIRECT_COLON + forwardUrl); + } + + // first check if redirectUrl exists or not + if (WebUtils.getCookie(request, REDIRECT_URL) != null) { + String forwardUrl = WebUtils.getCookie(request, REDIRECT_URL).getValue(); + // clean cookie + Cookie cookie2 = new Cookie(REDIRECT_URL, ""); + // ONAP does not use https + cookie2.setSecure(false); + cookie2.setMaxAge(0); + cookie2.setDomain(EPSystemProperties.getProperty(EPSystemProperties.COOKIE_DOMAIN)); + cookie2.setPath("/"); + response.addCookie(cookie2); + + return new ModelAndView(REDIRECT_COLON + forwardUrl); } - } - else { - - sbAdditionalInfo.append(String.format("Login-Id: %s, Login-Method: %s, Request-URL: %s", orgUserId, "", fullURL)); - logger.info(EELFLoggerDelegate.debugLogger, "*********************** now set up user session for " + orgUserId); - - EPUserUtils.setUserSession(request, commandBean.getUser(), commandBean.getMenu(), commandBean.getBusinessDirectMenu(), SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM),ePRoleFunctionService); - logger.info(EELFLoggerDelegate.debugLogger, "*********************** now set up user session for " + orgUserId + " finished"); - - //Store user's information into share context - try{ - logger.info(EELFLoggerDelegate.debugLogger, "******************* store user info into share context begins"); - - String sessionId = request.getSession().getId(); - List<SharedContext> existingSC = getSharedContextService().getSharedContexts(sessionId); - if(existingSC==null || existingSC.size()==0){ - getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_FIRST_NAME, commandBean.getUser().getFirstName()); - getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_LAST_NAME, commandBean.getUser().getLastName()); - getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_EMAIL, commandBean.getUser().getEmail()); - getSharedContextService().addSharedContext(sessionId, EPSystemProperties.USER_ORG_USERID, commandBean.getLoginId()); - } - - }catch(Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); - logger.info(EELFLoggerDelegate.errorLogger, "failed the shared context adding process " + e.getMessage()); - logger.info(EELFLoggerDelegate.debugLogger, "********************** failed the shared context adding process " + e.getMessage()); - - } - - logger.info(EELFLoggerDelegate.debugLogger, "********************* PresetUp the EP service cookie and intial sessionManagement"); - - SessionCookieUtil.preSetUp(request, response); - SessionCookieUtil.setUpUserIdCookie(request, response, orgUserId); - logger.info(EELFLoggerDelegate.debugLogger, "********************* PresetUp the EP service cookie and intial sessionManagement completed"); - logger.info(EELFLoggerDelegate.errorLogger, commandBean.getUser().getOrgUserId() + " exists in the the system."); - logger.info(EELFLoggerDelegate.debugLogger, commandBean.getUser().getOrgUserId() + " exists in the the system."); - - String redirect = "redirectUrl"; - - //get redirectUrl from URL parameter - if(request.getParameter(redirect)!=null && request.getParameter(redirect).length()!=0){ - String forwardUrl = URLDecoder.decode(request.getParameter(redirect),"UTF-8"); - //clean cookie - Cookie cookie2 = new Cookie(redirect, ""); - cookie2.setMaxAge(0); - cookie2.setDomain(EPSystemProperties.getProperty(EPSystemProperties.COOKIE_DOMAIN)); - cookie2.setPath("/"); - response.addCookie(cookie2); - return new ModelAndView("redirect:" + forwardUrl); - } - - //first check if redirectUrl exists or not - if(WebUtils.getCookie(request, redirect)!=null){ - String forwardUrl = WebUtils.getCookie(request, redirect).getValue(); - //clean cookie - Cookie cookie2 = new Cookie(redirect, ""); - cookie2.setMaxAge(0); - cookie2.setDomain(EPSystemProperties.getProperty(EPSystemProperties.COOKIE_DOMAIN)); - cookie2.setPath("/"); - response.addCookie(cookie2); - - return new ModelAndView("redirect:" + forwardUrl); - } } } - + // if user has been authenticated, now take them to the welcome page. - //return new ModelAndView("redirect:" + DEFAULT_SUCCESS_VIEW + ".htm"); - logger.info(EELFLoggerDelegate.debugLogger, "********************** Now return to application home page"); - - return new ModelAndView("redirect:" + SystemProperties.getProperty(EPSystemProperties.FE_URL)); - - // - // Re-enable for BE/FE separation. For 1607, at last minute we decided to go out - // without BE/FE separation. - // - //return new ModelAndView("redirect:" + SystemProperties.getProperty(EPSystemProperties.FE_URL)); - + logger.info(EELFLoggerDelegate.debugLogger, "processSingleSignOn: Now return to application home page"); + return new ModelAndView(REDIRECT_COLON + SystemProperties.getProperty(EPSystemProperties.FE_URL)); } - - public String getFullURL(HttpServletRequest request) { + + private String getFullURL(HttpServletRequest request) { if (request != null) { - StringBuffer requestURL = request.getRequestURL(); + String requestURL = request.getRequestURL().toString(); String queryString = request.getQueryString(); - if (queryString == null) { - return requestURL.toString(); + return requestURL; } else { - return requestURL.append('?').append(queryString).toString(); + return requestURL + "?" + queryString; } } return ""; } - - public String getRequestId(HttpServletRequest request) { - Enumeration<String> headerNames = request.getHeaderNames(); + private String getRequestId(HttpServletRequest request) { + Enumeration<String> headerNames = request.getHeaderNames(); String requestId = ""; - try { - while (headerNames.hasMoreElements()) { - String headerName = (String) headerNames.nextElement(); - logger.debug(EELFLoggerDelegate.debugLogger, - "One header is " + headerName + " : " + request.getHeader(headerName)); - if (headerName.equalsIgnoreCase(SystemProperties.ECOMP_REQUEST_ID)) { - requestId = request.getHeader(headerName); - break; - } + while (headerNames.hasMoreElements()) { + String headerName = headerNames.nextElement(); + logger.debug(EELFLoggerDelegate.debugLogger, "getRequestId: header {} has value {}", headerName, + request.getHeader(headerName)); + if (headerName.equalsIgnoreCase(SystemProperties.ECOMP_REQUEST_ID)) { + requestId = request.getHeader(headerName); + break; } - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "HEADER!!!! Exception : " + EcompPortalUtils.getStackTrace(e)); } - - return (requestId.isEmpty() ? UUID.randomUUID().toString() : requestId); + return requestId.isEmpty() ? UUID.randomUUID().toString() : requestId; } - - public String getJessionId(HttpServletRequest request){ - - return request.getSession().getId(); - /* - Cookie ep = WebUtils.getCookie(request, JSESSIONID); - if(ep==null){ - return request.getSession().getId(); - } - return ep.getValue(); - */ + + public String getWelcomeView() { + return welcomeView; } - - - protected void initateSessionMgtHandler(HttpServletRequest request) { - String jSessionId = getJessionId(request); - PortalTimeoutHandler.sessionCreated(jSessionId, jSessionId, AppUtils.getSession(request)); + + public void setWelcomeView(String welcomeView) { + this.welcomeView = welcomeView; } - + @Override public String getViewName() { return viewName; } + + @Override public void setViewName(String viewName) { this.viewName = viewName; } + public EPLoginService getLoginService() { - return loginService; - } + return loginService; + } - public void setLoginService(EPLoginService loginService) { - this.loginService = loginService; - } + public void setLoginService(EPLoginService loginService) { + this.loginService = loginService; + } public SharedContextService getSharedContextService() { return sharedContextService; @@ -401,7 +388,5 @@ public class LoginController extends EPUnRestrictedBaseController implements Log public void setSharedContextService(SharedContextService sharedContextService) { this.sharedContextService = sharedContextService; } - - } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/LoginService.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/LoginService.java index d2c53028..4b5a8d96 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/LoginService.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/LoginService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ONAPLoginController.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ONAPLoginController.java index 67f79b8b..64f38c18 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ONAPLoginController.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ONAPLoginController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ONAPWelcomeController.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ONAPWelcomeController.java index 9d8a7893..917d7713 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ONAPWelcomeController.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/ONAPWelcomeController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/OpenCollaborationController.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/OpenCollaborationController.java index 18c89a66..9e87ae2e 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/OpenCollaborationController.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/OpenCollaborationController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/PeerBroadcastSocket.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/PeerBroadcastSocket.java index 086b69a9..9366b1e7 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/PeerBroadcastSocket.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/controller/PeerBroadcastSocket.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.controller; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/AppsOSController.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/AppsOSController.java index 89f9fe58..5cffe8cd 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/AppsOSController.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/AppsOSController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java index fe31066d..313ae683 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java index 1d6b59ef..95623661 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java index 28f1e67f..d2585ab4 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/interceptor/SessionTimeoutInterceptor.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/interceptor/SessionTimeoutInterceptor.java index dc18f1ff..61b98e4f 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/interceptor/SessionTimeoutInterceptor.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/interceptor/SessionTimeoutInterceptor.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.interceptor; @@ -69,9 +87,8 @@ public class SessionTimeoutInterceptor extends HandlerInterceptorAdapter { resetSessionMaxIdleTimeOut(request); CollaborateList.addUserName(user.getOrgUserId()); } - } catch (Exception see) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(see)); - // return loginStrategy.login(request, response); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "preHandle failed", e); return false; } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAspect.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAspect.java index 974272d0..0970ec45 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAspect.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/logging/aop/EPEELFLoggerAspect.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.logging.aop; @@ -159,7 +177,7 @@ public class EPEELFLoggerAspect { try { result = joinPoint.proceed(); } catch(Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "logAroundMethod failed", e); statusCode = "ERROR"; responseCode = "500"; //Internal server error } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java index 71542268..fd0974b0 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java index f3fda34e..55479a20 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/ApplicationsRestClientServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -60,38 +78,39 @@ import com.google.gson.JsonParseException; @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy @EPAuditLog -public class ApplicationsRestClientServiceImpl implements ApplicationsRestClientService{ - +public class ApplicationsRestClientServiceImpl implements ApplicationsRestClientService { + private static final String PASSWORD_HEADER = "password"; private static final String APP_USERNAME_HEADER = "username"; private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ApplicationsRestClientServiceImpl.class); - + @Autowired private AppsCacheService appsCacheService; Gson gson = null; - + private final ObjectMapper mapper = new ObjectMapper(); - + @PostConstruct - private void init(){ + private void init() { logger.debug(EELFLoggerDelegate.debugLogger, "initializing"); - GsonBuilder builder = new GsonBuilder(); + GsonBuilder builder = new GsonBuilder(); - // Register an adapter to manage the date types as long values - builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() { - public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - return new Date(json.getAsJsonPrimitive().getAsLong()); - } + // Register an adapter to manage the date types as long values + builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() { + public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) + throws JsonParseException { + return new Date(json.getAsJsonPrimitive().getAsLong()); + } }); - gson = builder.create(); + gson = builder.create(); } - + // TODO: do we need to do additional logging for remote API calls? private static WebClient createClientForPath(String baseUri, String path) { - logger.info(EELFLoggerDelegate.debugLogger, "Creating web client for " + baseUri + " + " + path); + logger.info(EELFLoggerDelegate.debugLogger, "Creating web client for " + baseUri + " + " + path); WebClient client = WebClient.create(baseUri); client.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON); client.path(path); @@ -104,7 +123,8 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient logger.debug(EELFLoggerDelegate.debugLogger, "http response status=" + status); MDC.put(EPSystemProperties.EXTERNAL_API_RESPONSE_CODE, Integer.toString(status)); if (!isHttpSuccess(status)) { - String errMsg = "Failed. Status=" + status + "; [" + response.getStatusInfo().getReasonPhrase().toString() + "]"; + String errMsg = "Failed. Status=" + status + "; [" + response.getStatusInfo().getReasonPhrase().toString() + + "]"; URL url = null; try { // must not be null to avoid NPE in HTTPException constructor @@ -120,82 +140,86 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient throw new HTTPException(status, errMsg, url); } } - - private static boolean isHttpSuccess(int status){ + + private static boolean isHttpSuccess(int status) { return status / 100 == 2; } @EPMetricsLog private WebClient createClientForApp(long appId, String restPath) { - logger.debug(EELFLoggerDelegate.debugLogger, "creating client for appId=" + appId + "; restPath=" + restPath); + logger.debug(EELFLoggerDelegate.debugLogger, "creating client for appId=" + appId + "; restPath=" + restPath); EPApp externalApp = appsCacheService.getApp(appId); - if(externalApp != null){ + if (externalApp != null) { String appBaseUri = externalApp.getAppRestEndpoint(); - String username = externalApp.getUsername(); + String username = externalApp.getUsername(); String encriptedPwd = externalApp.getAppPassword(); String decreptedAppPwd = ""; - - //Set local context + + // Set local context MDC.put(EPSystemProperties.PROTOCOL, EPSystemProperties.HTTP); - if (appBaseUri!=null && appBaseUri.contains("https")) { + if (appBaseUri != null && appBaseUri.contains("https")) { MDC.put(EPSystemProperties.PROTOCOL, EPSystemProperties.HTTPS); } MDC.put(EPSystemProperties.FULL_URL, appBaseUri + restPath); MDC.put(EPSystemProperties.TARGET_ENTITY, externalApp.getName()); MDC.put(EPSystemProperties.TARGET_SERVICE_NAME, restPath); - + try { - decreptedAppPwd = CipherUtil.decrypt(encriptedPwd, SystemProperties.getProperty(SystemProperties.Decryption_Key)); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Unable to decrypt App name = " + externalApp, EcompPortalUtils.getStackTrace(e)); - logger.error(EELFLoggerDelegate.errorLogger, "Unable to decrypt App name = " + externalApp, EcompPortalUtils.getStackTrace(e)); + decreptedAppPwd = CipherUtil.decrypt(encriptedPwd, + SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "createClientForApp failed to decrypt", e); } - logger.debug(EELFLoggerDelegate.debugLogger, String.format("App %d found, baseUri=[%s], Headers: [%s=%s, %s=%s]", appId, appBaseUri, APP_USERNAME_HEADER, username, PASSWORD_HEADER, encriptedPwd)); + logger.debug(EELFLoggerDelegate.debugLogger, + String.format("App %d found, baseUri=[%s], Headers: [%s=%s, %s=%s]", appId, appBaseUri, + APP_USERNAME_HEADER, username, PASSWORD_HEADER, encriptedPwd)); WebClient client = createClientForPath(appBaseUri, restPath); client.header(APP_USERNAME_HEADER, username); client.header(PASSWORD_HEADER, decreptedAppPwd); client.header(SystemProperties.ECOMP_REQUEST_ID, MDC.get(MDC_KEY_REQUEST_ID)); client.header(SystemProperties.USERAGENT_NAME, EPSystemProperties.ECOMP_PORTAL_BE); - + return client; } return null; } - + @Override public <T> T get(Class<T> clazz, long appId, String restPath) throws HTTPException { - + WebClient webClient = null; Response response = null; T t = null; - + webClient = createClientForApp(appId, restPath); EcompPortalUtils.logAndSerializeObject(restPath, "GET request =", "no-payload"); - + try { - if (webClient!=null) { + if (webClient != null) { response = webClient.get(); } else { - logger.error(EELFLoggerDelegate.errorLogger, "Unable to create the Webclient to make the '" + restPath + "' API call."); + logger.error(EELFLoggerDelegate.errorLogger, + "Unable to create the Webclient to make the '" + restPath + "' API call."); } } catch (Exception e) { - MDC.put(EPSystemProperties.EXTERNAL_API_RESPONSE_CODE, Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); + MDC.put(EPSystemProperties.EXTERNAL_API_RESPONSE_CODE, + Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); EPLogUtil.logEcompError(EPAppMessagesEnum.BeRestApiGeneralError); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while making the GET REST API call, Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "get 1 failed", e); } - - if (response!=null) { + + if (response != null) { verifyResponse(response); String str = response.readEntity(String.class); EcompPortalUtils.logAndSerializeObject(restPath, "GET result =", str); - try { - t = mapper.readValue(str, clazz); - } catch(Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); - EPLogUtil.logEcompError(EPAppMessagesEnum.BeInvalidJsonInput); - } + try { + t = mapper.readValue(str, clazz); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "get 2 failed", e); + EPLogUtil.logEcompError(EPAppMessagesEnum.BeInvalidJsonInput); + } } - + return t; } @@ -204,68 +228,75 @@ public class ApplicationsRestClientServiceImpl implements ApplicationsRestClient WebClient client = null; Response response = null; T t = null; - + client = createClientForApp(appId, restPath); EcompPortalUtils.logAndSerializeObject(restPath, "POST request =", payload); - - + try { - if (client!=null) { + if (client != null) { response = client.post(payload); } else { - logger.error(EELFLoggerDelegate.errorLogger, "Unable to create the Webclient to make the '" + restPath + "' API call."); + logger.error(EELFLoggerDelegate.errorLogger, + "Unable to create the Webclient to make the {} API call", restPath); } } catch (Exception e) { - MDC.put(EPSystemProperties.EXTERNAL_API_RESPONSE_CODE, Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); + MDC.put(EPSystemProperties.EXTERNAL_API_RESPONSE_CODE, + Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); EPLogUtil.logEcompError(EPAppMessagesEnum.BeRestApiGeneralError); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while making the POST REST API call, Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "post 1 failed", e); } - - if (response!=null) { + + if (response != null) { verifyResponse(response); - - //String contentType = response.getHeaderString("Content-Type"); - if(clazz != null) { + + // String contentType = response.getHeaderString("Content-Type"); + if (clazz != null) { String str = response.readEntity(String.class); EcompPortalUtils.logAndSerializeObject(restPath, "POST result =", str); - try { t = gson.fromJson(str, clazz); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + try { + t = gson.fromJson(str, clazz); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "post 2 failed", e); EPLogUtil.logEcompError(EPAppMessagesEnum.BeInvalidJsonInput); - } + } } } return t; } @Override - public <T> T put(Class<T> clazz, long appId, Object payload, String restPath) throws HTTPException { + public <T> T put(Class<T> clazz, long appId, Object payload, String restPath) throws HTTPException { WebClient client = null; Response response = null; T t = null; - + client = createClientForApp(appId, restPath); EcompPortalUtils.logAndSerializeObject(restPath, "PUT request =", payload); - + try { - if (client!=null) { + if (client != null) { response = client.put(payload); } else { - logger.error(EELFLoggerDelegate.errorLogger, "Unable to create the Webclient to make the '" + restPath + "' API call."); + logger.error(EELFLoggerDelegate.errorLogger, + "Unable to create the Webclient to make the '" + restPath + "' API call."); } - } catch(Exception e) { - MDC.put(EPSystemProperties.EXTERNAL_API_RESPONSE_CODE, Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); + } catch (Exception e) { + MDC.put(EPSystemProperties.EXTERNAL_API_RESPONSE_CODE, + Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); EPLogUtil.logEcompError(EPAppMessagesEnum.BeRestApiGeneralError); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while making the PUT REST API call, Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "put 1 failed", e); } - - if (response!=null) { + + if (response != null) { verifyResponse(response); String str = response.readEntity(String.class); EcompPortalUtils.logAndSerializeObject(restPath, "PUT result =", str); - try { t = gson.fromJson(str, clazz); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + try { + t = gson.fromJson(str, clazz); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "put 2 failed", e); EPLogUtil.logEcompError(EPAppMessagesEnum.BeInvalidJsonInput); - } + } } return t; } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java index 20939a9a..20f4d59f 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java index 683017b1..09a78e85 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/AppsCacheServiceImple.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java index 41e51be6..ea92ca51 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java @@ -1,25 +1,43 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; - +import java.net.MalformedURLException; import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.LinkedList; @@ -59,34 +77,28 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPAppServiceImpl.class); private static Object syncRests = new Object(); - + @Autowired private DataAccessService dataAccessService; - + @Override public List<EPApp> getUserRemoteApps(String id) { - - StringBuilder query = new StringBuilder(); - - query.append("SELECT * FROM FN_APP join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = FN_APP.APP_ID where "); - query.append( - "FN_USER_ROLE.USER_ID = " + id + " AND FN_USER_ROLE.ROLE_ID != " + SUPER_ADMIN_ROLE_ID); - query.append(" AND FN_APP.ENABLED = 'Y'"); - - TreeSet<EPApp> distinctApps = new TreeSet<EPApp>(); - - @SuppressWarnings("unchecked") - List<EPApp> adminApps = dataAccessService.executeSQLQuery(query.toString(), EPApp.class, null); - for (EPApp app : adminApps) { - distinctApps.add(app); - } - - List<EPApp> userApps = new ArrayList<EPApp>(); - userApps.addAll(distinctApps); - return userApps; - + StringBuilder query = new StringBuilder(); + query.append("SELECT * FROM FN_APP join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = FN_APP.APP_ID where "); + query.append("FN_USER_ROLE.USER_ID = " + id + " AND FN_USER_ROLE.ROLE_ID != " + SUPER_ADMIN_ROLE_ID); + query.append(" AND FN_APP.ENABLED = 'Y'"); + TreeSet<EPApp> distinctApps = new TreeSet<EPApp>(); + @SuppressWarnings("unchecked") + List<EPApp> adminApps = dataAccessService.executeSQLQuery(query.toString(), EPApp.class, null); + for (EPApp app : adminApps) { + distinctApps.add(app); + } + List<EPApp> userApps = new ArrayList<EPApp>(); + userApps.addAll(distinctApps); + return userApps; } - + + @Override protected void updateRestrictedApp(Long appId, OnboardingApp onboardingApp, FieldsValidator fieldsValidator, EPUser user) { synchronized (syncRests) { @@ -99,11 +111,13 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer EPApp app; if (appId == null) { app = new EPApp(); - - // In the parent class, the UEB code is responsible for generating the keys/secret/mailbox but UEB Messaging - // is not actually being used currently; may be used in future at which point we can just remove this method and - // depend on parent class's method - // So, using UUID generator to generate the unique key instead. + /* + * In the parent class, the UEB code is responsible for generating the + * keys/secret/mailbox but UEB Messaging is not actually being used currently; + * may be used in future at which point we can just remove this method and + * depend on parent class's method So, using UUID generator to generate the + * unique key instead. + */ String uuidStr = UUID.randomUUID().toString(); String appKey = uuidStr; String appSecret = uuidStr; @@ -111,8 +125,7 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer onboardingApp.setUebTopicName(appMailboxName); onboardingApp.setUebKey(appKey); onboardingApp.setUebSecret(appSecret); - - }else { + } else { app = (EPApp) localSession.get(EPApp.class, appId); if (app == null || app.getId() == null) { // App is already deleted! @@ -122,28 +135,30 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer return; } } - logger.debug(EELFLoggerDelegate.debugLogger, "LR: about to call createAppFromOnboarding"); + logger.debug(EELFLoggerDelegate.debugLogger, + "updateRestrictedApp: about to call createAppFromOnboarding"); createAppFromOnboarding(app, onboardingApp, localSession); logger.debug(EELFLoggerDelegate.debugLogger, - "LR: updateApp: finished calling createAppFromOnboarding"); + "updateRestrictedApp: finished calling createAppFromOnboarding"); localSession.saveOrUpdate(app); logger.debug(EELFLoggerDelegate.debugLogger, - "LR: updateApp: finished calling localSession.saveOrUpdate"); + "updateRestrictedApp: finished calling localSession.saveOrUpdate"); // Enable or disable all menu items associated with this app setFunctionalMenuItemsEnabled(localSession, onboardingApp.isEnabled, appId); logger.debug(EELFLoggerDelegate.debugLogger, - "LR: updateApp: finished calling setFunctionalMenuItemsEnabled"); + "updateRestrictedApp: finished calling setFunctionalMenuItemsEnabled"); transaction.commit(); - logger.debug(EELFLoggerDelegate.debugLogger, "LR: updateApp: finished calling transaction.commit"); + logger.debug(EELFLoggerDelegate.debugLogger, + "updateRestrictedApp: finished calling transaction.commit"); result = true; } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "updateApp failed", e); + logger.error(EELFLoggerDelegate.errorLogger, "updateRestrictedApp failed", e); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebRegisterOnboardingAppError, e); EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e); EcompPortalUtils.rollbackTransaction(transaction, - "updateApp rollback, exception = " + EcompPortalUtils.getStackTrace(e)); + "updateRestrictedApp rollback, exception = " + e.toString()); } finally { - EcompPortalUtils.closeLocalSession(localSession, "updateApp"); + EcompPortalUtils.closeLocalSession(localSession, "updateRestrictedApp"); } if (!result) { fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); @@ -151,9 +166,11 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer } } - - public CambriaTopicManager getTopicManager(LinkedList<String> urlList, String key, String secret) throws GeneralSecurityException, Exception{ - return CambriaClientFactory.createTopicManager( null, urlList, key, secret); + + @Override + public CambriaTopicManager getTopicManager(List<String> urlList, String key, String secret) + throws MalformedURLException, GeneralSecurityException { + return CambriaClientFactory.createTopicManager(null, urlList, key, secret); } }
\ No newline at end of file diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java index 94937dc4..07dc8cca 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/SearchService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java index 2be95244..0929c480 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/SearchServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -105,7 +123,7 @@ public class SearchServiceImpl implements SearchService { try { result = mapper.writeValueAsString(resultOfSearch); } catch (JsonProcessingException e) { - logger.error(EELFLoggerDelegate.errorLogger, "searchUsersInPhoneBook Exception = " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "searchUsersInFnTable failed", e); } return result; } @@ -122,7 +140,7 @@ public class SearchServiceImpl implements SearchService { foundUsers.add(foundUser); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "searchInPhoneBookWithToken Exception = " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "searchUsersByUserId failed", e); } return foundUsers; } @@ -138,7 +156,7 @@ public class SearchServiceImpl implements SearchService { foundUsers.add(foundUser); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "searchInPhoneBookWithToken Exception = " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "searchUsersByName failed", e); } return foundUsers; } @@ -184,7 +202,7 @@ public class SearchServiceImpl implements SearchService { foundUsers.add(user); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "searchInPhoneBookWithToken Exception = " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "searchUserByUserId failed", e); return null; } return foundUsers.get(0); diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/TicketEventServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/TicketEventServiceImpl.java index 37acfe53..446bb60e 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/TicketEventServiceImpl.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/TicketEventServiceImpl.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserRolesServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserRolesServiceImpl.java index 1f98e752..c38fc6ae 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserRolesServiceImpl.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserRolesServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserService.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserService.java index bd8949f3..69ea652c 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserService.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserService.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java index 225f3a7a..9cc97460 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/UserServiceImpl.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.service; @@ -31,11 +49,10 @@ import org.json.JSONArray; import org.json.JSONObject; import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalapp.portal.utils.EPSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.FusionObject.Utilities; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.service.DataAccessService; import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; +import org.openecomp.portalsdk.core.service.DataAccessService; import org.openecomp.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -44,12 +61,12 @@ import org.springframework.transaction.annotation.Transactional; @Service("userService") @Transactional public class UserServiceImpl implements UserService { - + EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserServiceImpl.class); @Autowired - private DataAccessService dataAccessService; - + private DataAccessService dataAccessService; + public DataAccessService getDataAccessService() { return dataAccessService; } @@ -57,19 +74,18 @@ public class UserServiceImpl implements UserService { public void setDataAccessService(DataAccessService dataAccessService) { this.dataAccessService = dataAccessService; } - + @SuppressWarnings("rawtypes") @Override public List getUserByUserId(String userId) { - - - if(SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM).trim().equalsIgnoreCase("OIDC")){ - List<EPUser> users=new ArrayList<EPUser>(); - List<EPUser> filterdUsers=new ArrayList<EPUser>(); - BufferedReader in = null; - HttpURLConnection con = null; - try{ - String url = EPSystemProperties.getProperty(EPSystemProperties.AUTH_USER_SERVER); + + if (SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM).trim().equalsIgnoreCase("OIDC")) { + List<EPUser> users = new ArrayList<EPUser>(); + List<EPUser> filterdUsers = new ArrayList<EPUser>(); + BufferedReader in = null; + HttpURLConnection con = null; + try { + String url = EPSystemProperties.getProperty(EPSystemProperties.AUTH_USER_SERVER); URL obj = new URL(url); con = (HttpURLConnection) obj.openConnection(); @@ -84,78 +100,78 @@ public class UserServiceImpl implements UserService { in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); String inputLine; while ((inputLine = in.readLine()) != null) - response.append(inputLine); - JSONObject jObject = new JSONObject(response.toString()); // json - JSONArray jsonUsers = jObject.getJSONArray("response"); // get data object - for (int i = 0; i < jsonUsers.length(); i++) { - JSONObject eachObject = jsonUsers.getJSONObject(i); - EPUser eachUser = new EPUser(); - eachUser.setOrgUserId(eachObject.get("id").toString());// getString("id")); - eachUser.setFirstName(eachObject.get("givenName").toString()); - eachUser.setLastName(eachObject.get("familyName").toString()); - eachUser.setEmail(eachObject.get("email").toString()); - users.add(eachUser); - } - - for(int i = 0 ; i < users.size(); i ++){ - - if(Utilities.nvl(userId).length() > 0){ - if(!userId.equalsIgnoreCase(users.get(i).getOrgUserId())){ - continue; - } - } - filterdUsers.add(users.get(i)); - - } - - }catch (Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); - }finally{ - try { + response.append(inputLine); + JSONObject jObject = new JSONObject(response.toString()); // json + JSONArray jsonUsers = jObject.getJSONArray("response"); // get data object + for (int i = 0; i < jsonUsers.length(); i++) { + JSONObject eachObject = jsonUsers.getJSONObject(i); + EPUser eachUser = new EPUser(); + eachUser.setOrgUserId(eachObject.get("id").toString());// getString("id")); + eachUser.setFirstName(eachObject.get("givenName").toString()); + eachUser.setLastName(eachObject.get("familyName").toString()); + eachUser.setEmail(eachObject.get("email").toString()); + users.add(eachUser); + } + + for (int i = 0; i < users.size(); i++) { + + if (Utilities.nvl(userId).length() > 0) { + if (!userId.equalsIgnoreCase(users.get(i).getOrgUserId())) { + continue; + } + } + filterdUsers.add(users.get(i)); + + } + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getUserByUserId failed", e); + } finally { + try { in.close(); con.disconnect(); } catch (IOException e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getUserByUserId 2 failed", e); } - } - + } + return filterdUsers; - - }else{ - - List list = null; - StringBuffer criteria = new StringBuffer(); - criteria.append(" where org_user_id = '").append(userId).append("'"); - list = getDataAccessService().getList(EPUser.class, criteria.toString(), null, null); - return (list == null || list.size() == 0) ? null : list; - + + } else { + + List list = null; + StringBuffer criteria = new StringBuffer(); + criteria.append(" where org_user_id = '").append(userId).append("'"); + list = getDataAccessService().getList(EPUser.class, criteria.toString(), null, null); + return (list == null || list.size() == 0) ? null : list; + } - + } @SuppressWarnings("rawtypes") @Override public List getUserByFirstLastName(String firstName, String lastName) { - - if(!SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM).trim().equalsIgnoreCase("OIDC")){ - - List list = null; - StringBuffer criteria = new StringBuffer(); - if(firstName!=null) - criteria.append(" where first_name = '").append(firstName).append("'"); - if(lastName!=null) - criteria.append(" where last_name = '").append(lastName).append("'"); - list = getDataAccessService().getList(EPUser.class, criteria.toString(), null, null); - return (list == null || list.size() == 0) ? null : list; - - }else{ - - List<EPUser> users=new ArrayList<EPUser>(); - List<EPUser> filterdUsers=new ArrayList<EPUser>(); - BufferedReader in = null; - HttpURLConnection con = null; - try{ - String url = EPSystemProperties.getProperty(EPSystemProperties.AUTH_USER_SERVER); + + if (!SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM).trim().equalsIgnoreCase("OIDC")) { + + List list = null; + StringBuffer criteria = new StringBuffer(); + if (firstName != null) + criteria.append(" where first_name = '").append(firstName).append("'"); + if (lastName != null) + criteria.append(" where last_name = '").append(lastName).append("'"); + list = getDataAccessService().getList(EPUser.class, criteria.toString(), null, null); + return (list == null || list.size() == 0) ? null : list; + + } else { + + List<EPUser> users = new ArrayList<EPUser>(); + List<EPUser> filterdUsers = new ArrayList<EPUser>(); + BufferedReader in = null; + HttpURLConnection con = null; + try { + String url = EPSystemProperties.getProperty(EPSystemProperties.AUTH_USER_SERVER); URL obj = new URL(url); con = (HttpURLConnection) obj.openConnection(); @@ -166,92 +182,89 @@ public class UserServiceImpl implements UserService { con.setReadTimeout(8000); StringBuffer response = new StringBuffer(); - + in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); String inputLine; while ((inputLine = in.readLine()) != null) - response.append(inputLine); - JSONObject jObject = new JSONObject(response.toString()); // json - JSONArray jsonUsers = jObject.getJSONArray("response"); // get data object - for (int i = 0; i < jsonUsers.length(); i++) { - JSONObject eachObject = jsonUsers.getJSONObject(i); - EPUser eachUser = new EPUser(); - eachUser.setOrgUserId(eachObject.get("id").toString());// getString("id")); - eachUser.setFirstName(eachObject.get("givenName").toString()); - eachUser.setLastName(eachObject.get("familyName").toString()); - eachUser.setEmail(eachObject.get("email").toString()); - users.add(eachUser); - } - - for(int i = 0 ; i < users.size(); i ++){ - - if(Utilities.nvl(firstName).length() > 0){ - if(!firstName.equalsIgnoreCase(users.get(i).getFirstName())){ - continue; - } - } - if(Utilities.nvl(lastName).length() > 0){ - if(!lastName.equalsIgnoreCase(users.get(i).getLastName())){ - continue; - } - } - - - filterdUsers.add(users.get(i)); - - } - - }catch (Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); - }finally{ - try { + response.append(inputLine); + JSONObject jObject = new JSONObject(response.toString()); // json + JSONArray jsonUsers = jObject.getJSONArray("response"); // get data object + for (int i = 0; i < jsonUsers.length(); i++) { + JSONObject eachObject = jsonUsers.getJSONObject(i); + EPUser eachUser = new EPUser(); + eachUser.setOrgUserId(eachObject.get("id").toString());// getString("id")); + eachUser.setFirstName(eachObject.get("givenName").toString()); + eachUser.setLastName(eachObject.get("familyName").toString()); + eachUser.setEmail(eachObject.get("email").toString()); + users.add(eachUser); + } + + for (int i = 0; i < users.size(); i++) { + + if (Utilities.nvl(firstName).length() > 0) { + if (!firstName.equalsIgnoreCase(users.get(i).getFirstName())) { + continue; + } + } + if (Utilities.nvl(lastName).length() > 0) { + if (!lastName.equalsIgnoreCase(users.get(i).getLastName())) { + continue; + } + } + + filterdUsers.add(users.get(i)); + + } + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "getUserByFirstLastName failed", e); + } finally { + try { in.close(); con.disconnect(); } catch (IOException e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "getUserByFirstLastName 2 failed", e); } - } - + } + return filterdUsers; } - + } - - public String saveNewUser(EPUser newUser, String checkDuplicate) throws Exception{ - - try{ - - List list = null; - StringBuffer criteria = new StringBuffer(); - criteria.append(" where org_user_id = '").append(newUser.getLoginId()).append("'"); - list = getDataAccessService().getList(EPUser.class, criteria.toString(), null, null); - if(list == null || list.size()==0){ - newUser.setActive(true); - newUser.setOrgUserId(newUser.getLoginId()); - newUser.setLoginPwd(CipherUtil.encrypt(newUser.getLoginPwd())); - getDataAccessService().saveDomainObject(newUser, null); - }else{ - if(checkDuplicate.equals("Yes")){ - // userId already exist in database - return "Record already exist"; - }else{ - - EPUser oldUser = (EPUser) list.get(0); - oldUser.setFirstName(newUser.getFirstName()); - oldUser.setLastName(newUser.getLastName()); - oldUser.setMiddleInitial(newUser.getMiddleInitial()); - if(!oldUser.getLoginPwd().equals(newUser.getLoginPwd())) - oldUser.setLoginPwd(CipherUtil.encrypt(newUser.getLoginPwd())); - else - oldUser.setLoginPwd(newUser.getLoginPwd()); - getDataAccessService().saveDomainObject(oldUser, null); - - } - - } - - }catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "", e); + + public String saveNewUser(EPUser newUser, String checkDuplicate) throws Exception { + try { + List list = null; + StringBuffer criteria = new StringBuffer(); + criteria.append(" where org_user_id = '").append(newUser.getLoginId()).append("'"); + list = getDataAccessService().getList(EPUser.class, criteria.toString(), null, null); + if (list == null || list.size() == 0) { + newUser.setActive(true); + newUser.setOrgUserId(newUser.getLoginId()); + newUser.setLoginPwd(CipherUtil.encrypt(newUser.getLoginPwd())); + getDataAccessService().saveDomainObject(newUser, null); + } else { + if (checkDuplicate.equals("Yes")) { + // userId already exist in database + return "Record already exist"; + } else { + + EPUser oldUser = (EPUser) list.get(0); + oldUser.setFirstName(newUser.getFirstName()); + oldUser.setLastName(newUser.getLastName()); + oldUser.setMiddleInitial(newUser.getMiddleInitial()); + if (!oldUser.getLoginPwd().equals(newUser.getLoginPwd())) + oldUser.setLoginPwd(CipherUtil.encrypt(newUser.getLoginPwd())); + else + oldUser.setLoginPwd(newUser.getLoginPwd()); + getDataAccessService().saveDomainObject(oldUser, null); + + } + + } + + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "saveNewUser failed", e); throw new Exception(e); } return "success"; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java index eee12234..4a156a1a 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/transport/OnboardingApp.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.transport; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java index 1162cf20..81b1c495 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebHelper.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ueb; @@ -24,8 +42,6 @@ import java.net.URL; import java.util.LinkedList; import java.util.List; -import javax.annotation.PostConstruct; - import org.hibernate.Session; import org.hibernate.SessionFactory; import org.openecomp.portalapp.portal.domain.EPApp; @@ -36,13 +52,13 @@ import org.openecomp.portalapp.portal.logging.logic.EPLogUtil; import org.openecomp.portalapp.portal.service.EPAppService; import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties; import org.openecomp.portalsdk.core.onboarding.ueb.Helper; import org.openecomp.portalsdk.core.onboarding.ueb.Publisher; import org.openecomp.portalsdk.core.onboarding.ueb.UebException; import org.openecomp.portalsdk.core.onboarding.ueb.UebManager; import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg; +import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; +import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Component; @@ -54,88 +70,80 @@ import org.springframework.transaction.annotation.Transactional; @EnableAspectJAutoProxy public class EPUebHelper { EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPUebHelper.class); - + @Autowired EPAppService appsService; - - + @Autowired private SessionFactory sessionFactory; - + @SuppressWarnings("unused") private Publisher epPublisher; - + public EPUebHelper() { - + } + // - // This should only be called by the ECOMP Portal App, other Apps have just one publisher and use appPublisher + // This should only be called by the ECOMP Portal App, other Apps have just one + // publisher and use appPublisher // @SuppressWarnings("unused") @EPMetricsLog - public void refreshPublisherList() - { + public void refreshPublisherList() { Session localSession = null; - boolean addedPublisher = false; - + boolean addedPublisher = false; + try { localSession = sessionFactory.openSession(); - + List<EcompApp> apps = appsService.getEcompAppAppsFullList(); - for (int i = 0; i < apps.size(); i++) - { - if ((apps.get(i).isEnabled()) && - (apps.get(i).getUebTopicName() != null) && - !(apps.get(i).getUebTopicName().toUpperCase().contains("ECOMP-PORTAL-INBOX"))) - { - logger.debug(EELFLoggerDelegate.debugLogger, "UEBManager adding publisher for " + apps.get(i).getUebTopicName()); + for (int i = 0; i < apps.size(); i++) { + if ((apps.get(i).isEnabled()) && (apps.get(i).getUebTopicName() != null) + && !(apps.get(i).getUebTopicName().toUpperCase().contains("ECOMP-PORTAL-INBOX"))) { + logger.debug(EELFLoggerDelegate.debugLogger, + "UEBManager adding publisher for " + apps.get(i).getUebTopicName()); UebManager.getInstance().addPublisher(apps.get(i).getUebTopicName()); - addedPublisher = true; - } - else if ((apps.get(i).getId() != 1) && // App may have been disabled, remove the publisher - !(apps.get(i).isEnabled())) - { - if(apps.get(i).getUebTopicName()!=null){ + addedPublisher = true; + } else if ((apps.get(i).getId() != 1) && // App may have been disabled, remove the publisher + !(apps.get(i).isEnabled())) { + if (apps.get(i).getUebTopicName() != null) { UebManager.getInstance().removePublisher(apps.get(i).getUebTopicName()); } } } - } - catch (Exception e) - { + } catch (Exception e) { EPLogUtil.logEcompError(EPAppMessagesEnum.BeUebSystemError, "add/remove Publisher"); - String stackTrace = EcompPortalUtils.getStackTrace(e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while refreshing the publisher list. Details: " + stackTrace); + logger.error(EELFLoggerDelegate.errorLogger, "refreshPublisherList failed", e); } - - //publisherList.print(); - + + // publisherList.print(); + if (addedPublisher == true) // Give publishers time to initialize { Helper.sleep(400); } } - - //@PostConstruct - //@EPMetricsLog + + // @PostConstruct + // @EPMetricsLog public void initUeb() { try { - epPublisher = new Publisher(PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY), - PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET), - PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME)); + epPublisher = new Publisher(PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY), + PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET), + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME)); } catch (Exception e) { EPLogUtil.logEcompError(EPAppMessagesEnum.BeUebConnectionError, e.getMessage()); - String stackTrace = EcompPortalUtils.getStackTrace(e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while initializing the publisher. Details: " + stackTrace); + logger.error(EELFLoggerDelegate.errorLogger, "initUeb failed", e); } - + Thread thread = new Thread("EPUebManager: postConstructMethod - refreshPublisherList") { - public void run(){ - refreshPublisherList(); - } + public void run() { + refreshPublisherList(); + } }; if (thread != null) { - thread.start(); + thread.start(); } } @@ -145,74 +153,69 @@ public class EPUebHelper { try { UebManager.getInstance().addPublisher(app.getUebTopicName()); } catch (UebException e) { - String stackTrace = EcompPortalUtils.getStackTrace(e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception while adding a publisher. Details: " + stackTrace); + logger.error(EELFLoggerDelegate.errorLogger, "addPublisher failed", e); } } - + public boolean checkAvailability() { - + + // + // Test existence of topic at UEB url // - // Test existence of topic at UEB url // - // // boolean available = true; LinkedList<String> urlList = Helper.uebUrlList(); if (!urlList.isEmpty()) { - String url = "http://" + urlList.getFirst() + ":3904/topics/" + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME); - if (!url.isEmpty()) { - try { - URL siteURL = new URL(url); - HttpURLConnection connection = (HttpURLConnection) siteURL.openConnection(); - connection.setRequestMethod("GET"); - connection.connect(); - - int code = connection.getResponseCode(); - if (code == 200) { - available = true; - } - else { - EPLogUtil.logEcompError(EPAppMessagesEnum.BeUebConnectionError, url); - available = false; - logger.warn(EELFLoggerDelegate.errorLogger, "Warning! UEB topic existence check failed, topic = " + url ); - logger.debug(EELFLoggerDelegate.debugLogger, "Warning! UEB topic existence check failed, topic = " + url ); - } - } - catch (Exception e) { - available = false; - String stackTrace = EcompPortalUtils.getStackTrace(e); - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while performing the UEB Healthcheck. Details: " + stackTrace); - } - } + String url = "http://" + urlList.getFirst() + ":3904/topics/" + + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME); + if (!url.isEmpty()) { + try { + URL siteURL = new URL(url); + HttpURLConnection connection = (HttpURLConnection) siteURL.openConnection(); + connection.setRequestMethod("GET"); + connection.connect(); + + int code = connection.getResponseCode(); + if (code == 200) { + available = true; + } else { + EPLogUtil.logEcompError(EPAppMessagesEnum.BeUebConnectionError, url); + available = false; + logger.warn(EELFLoggerDelegate.errorLogger, + "Warning! UEB topic existence check failed, topic = " + url); + logger.debug(EELFLoggerDelegate.debugLogger, + "Warning! UEB topic existence check failed, topic = " + url); + } + } catch (Exception e) { + available = false; + logger.error(EELFLoggerDelegate.errorLogger, "checkAvailability failed", e); + } + } } return available; } - - public boolean MessageCanBeSentToTopic() { - - boolean sentMsgSuccessfully = false; - - UebMsg msg = new UebMsg(); - msg.putSourceTopicName(PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME)); - msg.putPayload("Pinging topic for health check"); - msg.putMsgType(EPUebMsgTypes.UEB_MSG_TYPE_HEALTH_CHECK); - - try { - // epPublisher.send(msg); - sentMsgSuccessfully = true; - } - catch (Exception e) { - EPLogUtil.logEcompError(EPAppMessagesEnum.BeHealthCheckUebClusterError); - String stackTrace = EcompPortalUtils.getStackTrace(e); - sentMsgSuccessfully = false; - logger.warn(EELFLoggerDelegate.errorLogger, "Warning! could not successfully publish a UEB msg to " - + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME) + " exception : " + stackTrace); - } - - return sentMsgSuccessfully; - } - -} + public boolean MessageCanBeSentToTopic() { + + boolean sentMsgSuccessfully = false; + + UebMsg msg = new UebMsg(); + msg.putSourceTopicName(PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME)); + msg.putPayload("Pinging topic for health check"); + msg.putMsgType(EPUebMsgTypes.UEB_MSG_TYPE_HEALTH_CHECK); + + try { + // epPublisher.send(msg); + sentMsgSuccessfully = true; + } catch (Exception e) { + EPLogUtil.logEcompError(EPAppMessagesEnum.BeHealthCheckUebClusterError); + sentMsgSuccessfully = false; + logger.warn(EELFLoggerDelegate.errorLogger, "Warning! could not successfully publish a UEB msg to " + + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME), e); + } + + return sentMsgSuccessfully; + } +} diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java index d6eb9eb9..720e0615 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/ueb/EPUebMsgTypes.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.ueb; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/utils/EPSystemProperties.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/utils/EPSystemProperties.java index b187c010..e8772677 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/utils/EPSystemProperties.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/utils/EPSystemProperties.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.utils; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java index 5b1aa159..63b44027 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.scheduler; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java index 8d717110..f502a564 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.scheduler; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/Register.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/Register.java index 43e0d818..00eb7b69 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/Register.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/Register.java @@ -1,28 +1,45 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.scheduler; import java.util.ArrayList; import java.util.List; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.scheduler.Registerable; import org.openecomp.portalsdk.core.util.SystemProperties; @@ -60,7 +77,7 @@ public class Register implements Registerable { getScheduleTriggers().add(logRegistry.getTrigger()); } catch (IllegalStateException ies) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(ies)); + logger.error(EELFLoggerDelegate.errorLogger, "registerTriggers log cron failed", ies); logger.info(EELFLoggerDelegate.debugLogger, ("Log Cron not available")); } @@ -69,7 +86,7 @@ public class Register implements Registerable { getScheduleTriggers().add(sessionMgtRegistry.getTrigger()); } catch(IllegalStateException ies) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(ies)); + logger.error(EELFLoggerDelegate.errorLogger, "registerTriggers session timeout failed", ies); logger.info(EELFLoggerDelegate.debugLogger, ("Session Cron not available")); } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java index 1d2d8071..542b0d88 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.scheduler; diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/SessionMgtRegistry.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/SessionMgtRegistry.java index 315618e9..c18b4b35 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/SessionMgtRegistry.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/scheduler/SessionMgtRegistry.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.scheduler; @@ -46,7 +64,7 @@ import org.springframework.stereotype.Component; @DependsOn({ "systemProperties" }) public class SessionMgtRegistry extends CronRegistry implements ApplicationContextAware { - EELFLoggerDelegate logger = null; + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SessionMgtRegistry.class); private static final String groupName = "AppGroup"; private static final String jobName = "PortalSessionTimeoutFeedJob"; @@ -60,14 +78,12 @@ public class SessionMgtRegistry extends CronRegistry implements ApplicationConte private ApplicationContext applicationContext; public JobDetailFactoryBean jobDetailFactoryBean() { - logger = EELFLoggerDelegate.getLogger(SessionMgtRegistry.class); Map<String, Object> map = new HashMap<String, Object>(); return jobDetailFactoryBean(groupName, jobName, TimeoutHandler.class, map); } @SuppressWarnings("static-access") public CronTriggerFactoryBean cronTriggerFactoryBean() throws ParseException { - logger = EELFLoggerDelegate.getLogger(SessionMgtRegistry.class); String property = "* * * * * ? 2099"; try { property = systemProperties.getProperty(SystemProperties.SESSIONTIMEOUT_FEED_CRON); diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallServiceImpl.java index c07d1093..0b10caf6 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallServiceImpl.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/service/RemoteWebServiceCallServiceImpl.java @@ -1,33 +1,49 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.service; import java.util.List; import org.openecomp.portalapp.portal.domain.EPApp; -import org.openecomp.portalapp.portal.service.AppsCacheService; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; import org.openecomp.portalsdk.core.service.WebServiceCallServiceImpl; import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -38,9 +54,7 @@ import org.springframework.transaction.annotation.Transactional; @EnableAspectJAutoProxy public class RemoteWebServiceCallServiceImpl extends WebServiceCallServiceImpl implements RemoteWebServiceCallService { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RemoteWebServiceCallServiceImpl.class); - @Autowired - AppsCacheService appCacheService; + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RemoteWebServiceCallServiceImpl.class); /* * (non-Javadoc) diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/FunctionalMenuHandler.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/FunctionalMenuHandler.java index 0a360500..8fd70a2b 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/FunctionalMenuHandler.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/FunctionalMenuHandler.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.uebhandler; @@ -27,7 +45,6 @@ import org.openecomp.portalapp.portal.service.AdminRolesService; import org.openecomp.portalapp.portal.service.FunctionalMenuService; import org.openecomp.portalapp.portal.service.SearchService; import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.onboarding.ueb.UebException; import org.openecomp.portalsdk.core.onboarding.ueb.UebManager; @@ -44,83 +61,76 @@ import com.google.gson.Gson; @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy @EPAuditLog -public class FunctionalMenuHandler { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FunctionalMenuHandler.class); - +public class FunctionalMenuHandler { + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FunctionalMenuHandler.class); + @Autowired - AdminRolesService adminRolesService; - + private AdminRolesService adminRolesService; + @Autowired - FunctionalMenuService functionalMenuService; - + private FunctionalMenuService functionalMenuService; + @Autowired - SearchService searchSvc; - - @Autowired - DataAccessService dataAccessService; + private SearchService searchSvc; @Async - public Boolean getFunctionalMenu(UebMsg requestMsg) - { + public Boolean getFunctionalMenu(UebMsg requestMsg) { UebMsg returnMsg = new UebMsg(); - - if (requestMsg == null) - { + + if (requestMsg == null) { logger.error(EELFLoggerDelegate.errorLogger, "handleMenuRequest received null message"); return false; - } - else if (requestMsg.getSourceTopicName() == null) - { - logger.error(EELFLoggerDelegate.errorLogger, "A source topic name is required and not found in this msg:" + requestMsg.toString()); + } else if (requestMsg.getSourceTopicName() == null) { + logger.error(EELFLoggerDelegate.errorLogger, + "A source topic name is required and not found in this msg:" + requestMsg.toString()); return false; - } - else if (requestMsg.getUserId() == null) - { - logger.debug(EELFLoggerDelegate.debugLogger, "Error getting functional menu. A userId is required and not found in this msg: " + requestMsg.toString()); - returnMsg.putMsgId(requestMsg.getMsgId()); // echo tells requester this is a response + } else if (requestMsg.getUserId() == null) { + logger.debug(EELFLoggerDelegate.debugLogger, + "Error getting functional menu. A userId is required and not found in this msg: " + + requestMsg.toString()); + returnMsg.putMsgId(requestMsg.getMsgId()); // echo tells requester this is a response returnMsg.putPayload("Error: A userId is required. Call msg.putUserId() with an userId"); - } - else - { - logger.debug(EELFLoggerDelegate.debugLogger, "Getting functional menu for user = " + requestMsg.getUserId()); + } else { + logger.debug(EELFLoggerDelegate.debugLogger, + "Getting functional menu for user = " + requestMsg.getUserId()); EPUser user = searchSvc.searchUserByUserId(requestMsg.getUserId()); - + List<FunctionalMenuItem> menuItems = null; - if (user == null) - { - logger.debug(EELFLoggerDelegate.debugLogger, "Error getting functional menu. userId not found in directory or is guest: " + requestMsg.toString()); - } - else if (adminRolesService.isSuperAdmin(user)) - { - logger.debug(EELFLoggerDelegate.debugLogger, "FunctionalMenuHandler: SuperUser, about to call getFunctionalMenuItems()"); + if (user == null) { + logger.debug(EELFLoggerDelegate.debugLogger, + "Error getting functional menu. userId not found in directory or is guest: " + + requestMsg.toString()); + } else if (adminRolesService.isSuperAdmin(user)) { + logger.debug(EELFLoggerDelegate.debugLogger, + "FunctionalMenuHandler: SuperUser, about to call getFunctionalMenuItems()"); menuItems = functionalMenuService.getFunctionalMenuItems(); - } - else - { - logger.debug(EELFLoggerDelegate.debugLogger, "getMenuItemsForAuthUser: about to call getFunctionalMenuItemsForUser()"); + } else { + logger.debug(EELFLoggerDelegate.debugLogger, + "getMenuItemsForAuthUser: about to call getFunctionalMenuItemsForUser()"); menuItems = functionalMenuService.getFunctionalMenuItemsForUser(requestMsg.getUserId()); } - - if ( menuItems != null ) - { - String functionalMenuJsonString = new Gson().toJson(menuItems); + + if (menuItems != null) { + String functionalMenuJsonString = new Gson().toJson(menuItems); logger.debug(EELFLoggerDelegate.debugLogger, "returning functional menu : " + functionalMenuJsonString); - returnMsg.putMsgId(requestMsg.getMsgId()); // echo tells requester this is a response - returnMsg.putPayload(functionalMenuJsonString); + returnMsg.putMsgId(requestMsg.getMsgId()); // echo tells requester this is a response + returnMsg.putPayload(functionalMenuJsonString); } else { - returnMsg.putMsgId(requestMsg.getMsgId()); // echo tells requester this is a response + returnMsg.putMsgId(requestMsg.getMsgId()); // echo tells requester this is a response returnMsg.putPayload("Error: Not found for userId = " + requestMsg.getUserId()); } } - + try { - UebManager.getInstance().publishReplyEP(returnMsg, requestMsg.getSourceTopicName()); - } catch (UebException e) { - logger.error(EELFLoggerDelegate.errorLogger, "UebException occurred while responding to the Ueb message, Details:" + EcompPortalUtils.getStackTrace(e)); - } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred while responding to the Ueb message, Details:" + EcompPortalUtils.getStackTrace(e)); - } - - return true; + UebManager.getInstance().publishReplyEP(returnMsg, requestMsg.getSourceTopicName()); + } catch (UebException e) { + logger.error(EELFLoggerDelegate.errorLogger, + "getFunctionalMenu failed to publish reply", e); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "getFunctionalMenu failed", e); + } + + return true; } } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java index 2ba27549..db60c89f 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java @@ -1,38 +1,49 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.uebhandler; import java.util.concurrent.ConcurrentLinkedQueue; -import javax.annotation.PostConstruct; - -import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties; import org.openecomp.portalsdk.core.onboarding.ueb.UebManager; import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.EnableAspectJAutoProxy; +import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; +import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties; // // Adding this class for the sole purpose of insuring that the MainUebHandler really @@ -43,33 +54,33 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy; //@EnableAspectJAutoProxy //@EPMetricsLog public class InitUebHandler { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(InitUebHandler.class); - - //@Autowired - MainUebHandler mainUebHandler; - - public InitUebHandler() { - + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(InitUebHandler.class); + + // @Autowired + private MainUebHandler mainUebHandler; + + public InitUebHandler() { + } - - //@PostConstruct - public void initUeb() { - + + // @PostConstruct + public void initUeb() { try { String enableListenerThread = PortalApiProperties.getProperty(PortalApiConstants.UEB_LISTENERS_ENABLE); if (enableListenerThread.equalsIgnoreCase("true")) { - ConcurrentLinkedQueue<UebMsg> inboxQueue = new ConcurrentLinkedQueue<UebMsg>(); - UebManager.getInstance().initListener(inboxQueue); - mainUebHandler.runHandler(inboxQueue); - logger.info(EELFLoggerDelegate.errorLogger, "Returned from initiating mainUebHandler..."); - } - else { - logger.info(EELFLoggerDelegate.errorLogger, "Not starting UEB listening thread because ueb_listeners_enable is not set to true in the properties file."); - } - } - catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, EcompPortalUtils.getStackTrace(e)); - logger.info(EELFLoggerDelegate.errorLogger, "Not starting UEB listening thread because property could not be read " + PortalApiConstants.UEB_LISTENERS_ENABLE + e.getMessage()); + ConcurrentLinkedQueue<UebMsg> inboxQueue = new ConcurrentLinkedQueue<UebMsg>(); + UebManager.getInstance().initListener(inboxQueue); + mainUebHandler.runHandler(inboxQueue); + logger.info(EELFLoggerDelegate.errorLogger, "Returned from initiating mainUebHandler..."); + } else { + logger.info(EELFLoggerDelegate.errorLogger, + "Not starting UEB listening thread because ueb_listeners_enable is not set to true in the properties file."); + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "initUeb failed", e); + logger.info(EELFLoggerDelegate.errorLogger, + "Not starting UEB listening thread because property could not be read " + + PortalApiConstants.UEB_LISTENERS_ENABLE + e.getMessage()); } } } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java index 5edf04b4..9e2bfff7 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.uebhandler; @@ -26,7 +44,6 @@ import java.util.concurrent.ConcurrentLinkedQueue; import org.openecomp.portalapp.portal.ueb.EPUebMsgTypes; import org.openecomp.portalapp.portal.utils.EPSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg; import org.openecomp.portalsdk.core.onboarding.ueb.UebMsgTypes; @@ -37,7 +54,6 @@ import org.springframework.stereotype.Component; import com.att.eelf.configuration.Configuration; - //------------------------------------------------------------------------- // Listens for received UEB messages and handles the messages // @@ -46,69 +62,63 @@ import com.att.eelf.configuration.Configuration; // //------------------------------------------------------------------------- @Component("MainUebHandler") -public class MainUebHandler -{ +public class MainUebHandler { final DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MainUebHandler.class); - - ConcurrentLinkedQueue<UebMsg> inboxQueue = null; - - @Autowired - FunctionalMenuHandler funcMenuHandler; - + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MainUebHandler.class); + + private ConcurrentLinkedQueue<UebMsg> inboxQueue = null; + + @Autowired + private FunctionalMenuHandler funcMenuHandler; + @Autowired - WidgetNotificationHandler widgetNotificationHandler; + private WidgetNotificationHandler widgetNotificationHandler; @Async - public void runHandler(ConcurrentLinkedQueue<UebMsg> queue) - { + public void runHandler(ConcurrentLinkedQueue<UebMsg> queue) { inboxQueue = queue; - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "==> MainUebHandler started"); - while (true) - { + logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "==> MainUebHandler started"); + while (true) { UebMsg msg = null; - while ((msg = inboxQueue.poll()) != null) - { - if ((msg.getMsgType() != null) && (!msg.getMsgType().equalsIgnoreCase(EPUebMsgTypes.UEB_MSG_TYPE_HEALTH_CHECK))) - { - // TODO: switch this back to debug - logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== Received UEB message : " + msg.toString()); - logger.info(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== Received UEB message : " + msg.toString()); - MDC.put(EPSystemProperties.PARTNER_NAME, msg.getSourceTopicName()); - MDC.put(Configuration.MDC_SERVICE_NAME, msg.getMsgType().toString()); - switch(msg.getMsgType()) - { - case UebMsgTypes.UEB_MSG_TYPE_GET_FUNC_MENU: - { - funcMenuHandler.getFunctionalMenu(msg); - break; - } - case UebMsgTypes.UEB_MSG_TYPE_WIDGET_NOTIFICATION: - { - widgetNotificationHandler.handleWidgetNotification(msg); - break; - } - default: - { - logger.info(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "Unknown UEB message type " + msg.toString()); - break; - } - } - } - } - - if (Thread.interrupted()) - { - logger.info(EELFLoggerDelegate.errorLogger, "==> UebMainHandler exiting"); - break; - } - - try { - Thread.sleep(10); + while ((msg = inboxQueue.poll()) != null) { + if ((msg.getMsgType() != null) + && (!msg.getMsgType().equalsIgnoreCase(EPUebMsgTypes.UEB_MSG_TYPE_HEALTH_CHECK))) { + // TODO: switch this back to debug + logger.info(EELFLoggerDelegate.errorLogger, + dateFormat.format(new Date()) + "<== Received UEB message : " + msg.toString()); + logger.info(EELFLoggerDelegate.debugLogger, + dateFormat.format(new Date()) + "<== Received UEB message : " + msg.toString()); + MDC.put(EPSystemProperties.PARTNER_NAME, msg.getSourceTopicName()); + MDC.put(Configuration.MDC_SERVICE_NAME, msg.getMsgType().toString()); + switch (msg.getMsgType()) { + case UebMsgTypes.UEB_MSG_TYPE_GET_FUNC_MENU: { + funcMenuHandler.getFunctionalMenu(msg); + break; + } + case UebMsgTypes.UEB_MSG_TYPE_WIDGET_NOTIFICATION: { + widgetNotificationHandler.handleWidgetNotification(msg); + break; + } + default: { + logger.info(EELFLoggerDelegate.debugLogger, + dateFormat.format(new Date()) + "Unknown UEB message type " + msg.toString()); + break; + } + } + } + } + + if (Thread.interrupted()) { + logger.info(EELFLoggerDelegate.errorLogger, "==> UebMainHandler exiting"); + break; + } + + try { + Thread.sleep(10); } catch (InterruptedException e) { - logger.error(EELFLoggerDelegate.errorLogger, "UebMainHandler interrupted during sleep" + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "runHandler interrupted during sleep", e); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred during sleep" + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "runHandler failed", e); } } } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java index e6f3089c..1f964437 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.uebhandler; @@ -29,7 +47,6 @@ import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalapp.portal.logging.aop.EPMetricsLog; import org.openecomp.portalapp.portal.service.EPAppService; import org.openecomp.portalapp.portal.service.SearchService; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.onboarding.ueb.UebException; import org.openecomp.portalsdk.core.onboarding.ueb.UebManager; @@ -44,48 +61,48 @@ import org.springframework.stereotype.Component; @EnableAspectJAutoProxy @EPMetricsLog public class WidgetNotificationHandler { - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetNotificationHandler.class); - + private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetNotificationHandler.class); + final DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - + @Autowired EPAppService appSvc; - + @Autowired SearchService searchSvc; - - public WidgetNotificationHandler() - { + public WidgetNotificationHandler() { } - + @Async - public void handleWidgetNotification(UebMsg requestMsg) - { + public void handleWidgetNotification(UebMsg requestMsg) { if (requestMsg.getUserId() != null) { - logger.debug(EELFLoggerDelegate.debugLogger, "handleWidgetNotification: getting widgets/apps for user = " + requestMsg.getUserId()); + logger.debug(EELFLoggerDelegate.debugLogger, + "handleWidgetNotification: getting widgets/apps for user = " + requestMsg.getUserId()); EPUser user = searchSvc.searchUserByUserId(requestMsg.getUserId()); if (user != null && (appSvc != null)) { logger.debug(EELFLoggerDelegate.debugLogger, "Debug mytag: " + appSvc); - List<EPApp> apps = appSvc.getUserApps(user); - for (EPApp app : apps) { - if (app.getUebTopicName() != null) { - UebMsg widgetMsg = new UebMsg(); - widgetMsg.putSourceTopicName(app.getUebTopicName()); - logger.debug(EELFLoggerDelegate.debugLogger, "app.getUebTopicName was invoked"); - widgetMsg.putPayload(requestMsg.getPayload()); - try { - logger.debug(EELFLoggerDelegate.debugLogger, "Sending widget notification from " + requestMsg.getSourceTopicName() + " to " + app.getUebTopicName()); - UebManager.getInstance().publishEP(widgetMsg, app.getUebTopicName()); - } catch (UebException e) { - logger.error(EELFLoggerDelegate.errorLogger, "handleWidgetNotification publishEP exception" + EcompPortalUtils.getStackTrace(e)); - } - } - } + List<EPApp> apps = appSvc.getUserApps(user); + for (EPApp app : apps) { + if (app.getUebTopicName() != null) { + UebMsg widgetMsg = new UebMsg(); + widgetMsg.putSourceTopicName(app.getUebTopicName()); + logger.debug(EELFLoggerDelegate.debugLogger, "app.getUebTopicName was invoked"); + widgetMsg.putPayload(requestMsg.getPayload()); + try { + logger.debug(EELFLoggerDelegate.debugLogger, "Sending widget notification from " + + requestMsg.getSourceTopicName() + " to " + app.getUebTopicName()); + UebManager.getInstance().publishEP(widgetMsg, app.getUebTopicName()); + } catch (UebException e) { + logger.error(EELFLoggerDelegate.errorLogger, "handleWidgetNotification failed", e); + } + } + } } else { - logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "handleWidgetNotification: user " + - requestMsg.getUserId() + " not found" + " source = " + requestMsg.getSourceTopicName() + - ". This widget notification cannot be posted to other widgets"); + logger.error(EELFLoggerDelegate.errorLogger, + dateFormat.format(new Date()) + "handleWidgetNotification: user " + requestMsg.getUserId() + + " not found" + " source = " + requestMsg.getSourceTopicName() + + ". This widget notification cannot be posted to other widgets"); } } } diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/util/SessionCookieUtil.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/util/SessionCookieUtil.java index 1ef44a44..7ae34aed 100644 --- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/util/SessionCookieUtil.java +++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/util/SessionCookieUtil.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.util; @@ -25,11 +43,10 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; import org.openecomp.portalsdk.core.onboarding.listener.PortalTimeoutHandler; import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; +import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants; import org.openecomp.portalsdk.core.util.SystemProperties; import org.openecomp.portalsdk.core.web.support.AppUtils; @@ -121,7 +138,7 @@ public class SessionCookieUtil { session.setMaxInactiveInterval(Integer.parseInt(maxIdleAttribute.toString())); } } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Could not reset the session timeout. Details: " + EcompPortalUtils.getStackTrace(e)); + logger.error(EELFLoggerDelegate.errorLogger, "resetSessionMaxIdleTimeOut failed", e); } } diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/OpenIdConnectLoginStrategyTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/OpenIdConnectLoginStrategyTest.java index 4386ccd7..2d0f795a 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/OpenIdConnectLoginStrategyTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/OpenIdConnectLoginStrategyTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.authentication; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/SessionTimeoutInterceptorTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/SessionTimeoutInterceptorTest.java index fc827f78..c4946c68 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/SessionTimeoutInterceptorTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/SessionTimeoutInterceptorTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.authentication; import static org.junit.Assert.assertFalse; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/SimpleLoginStrategyTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/SimpleLoginStrategyTest.java index 5093fae0..588bd89c 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/SimpleLoginStrategyTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/authentication/SimpleLoginStrategyTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.authentication; import static org.junit.Assert.assertFalse; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequestOSTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequestOSTest.java deleted file mode 100644 index 049f7239..00000000 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequestOSTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/*package org.openecomp.portalapp.portal.controller; - -import static org.junit.Assert.assertEquals; - -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.openecomp.portalapp.portal.domain.EPUser; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; -import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; -import org.openecomp.portalapp.portal.service.AdminRolesService; -import org.openecomp.portalapp.portal.service.EPAppService; -import org.openecomp.portalapp.portal.service.PortalAdminService; -import org.openecomp.portalapp.portal.test.core.MockEPUser; -import org.openecomp.portalapp.portal.transport.FieldsValidator; -import org.openecomp.portalapp.portal.transport.OnboardingApp; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; -import org.openecomp.portalapp.util.EPUserUtils; - -public class AppsControllerExternalRequestOSTest { - - @Mock - AdminRolesService adminRolesService; - - @Mock - EPAppService appService; - - @Mock - PortalAdminService portalAdminService; - - - @InjectMocks - AppsControllerExternalRequest appsControllerExternalRequest = new AppsControllerExternalRequest(); - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - - MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); - - HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); - HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); - NullPointerException nullPointerException = new NullPointerException(); - - MockEPUser mockUser = new MockEPUser(); - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - - @Test - public void postOnboardAppExternalFieldValidatorTestTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage("FieldsValidator [httpStatusCode=500, errorCode=null, fields=null]"); - expectedportalRestResponse.setResponse(null); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.ERROR); - OnboardingApp expectedOnboardingApp = new OnboardingApp(); - expectedOnboardingApp.id = null; - expectedOnboardingApp.name = "Test"; - expectedOnboardingApp.url = "Test"; - expectedOnboardingApp.restUrl = "Test"; - expectedOnboardingApp.restrictedApp = false; - expectedOnboardingApp.isOpen = false; - expectedOnboardingApp.isEnabled = false; - List<EPUser> userList = new ArrayList<EPUser>(); - EPUser user = mockUser.mockEPUser(); - userList.add(user); - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 500); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.addOnboardingApp(expectedOnboardingApp, user)).thenReturn(expectedFieldValidator); - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .postOnboardAppExternal(mockedRequest, mockedResponse, expectedOnboardingApp); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - - } - - @Test - public void postOnboardAppExternalIfSuperAdminTest() { - PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<String>(); - expectedportalRestResponse.setMessage(null); - expectedportalRestResponse.setResponse(null); - PortalRestStatusEnum portalRestStatusEnum = null; - expectedportalRestResponse.setStatus(portalRestStatusEnum.OK); - OnboardingApp expectedOnboardingApp = new OnboardingApp(); - expectedOnboardingApp.id = null; - expectedOnboardingApp.name = "Test"; - expectedOnboardingApp.url = "Test"; - expectedOnboardingApp.restUrl = "Test"; - expectedOnboardingApp.restrictedApp = false; - expectedOnboardingApp.isOpen = false; - expectedOnboardingApp.isEnabled = false; - List<EPUser> userList = new ArrayList<EPUser>(); - EPUser user = mockUser.mockEPUser(); - userList.add(user); - FieldsValidator expectedFieldValidator = new FieldsValidator(); - expectedFieldValidator.setHttpStatusCode((long) 200); - expectedFieldValidator.setFields(null); - expectedFieldValidator.setErrorCode(null); - Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(appService.addOnboardingApp(expectedOnboardingApp, user)).thenReturn(expectedFieldValidator); - PortalRestResponse<String> actualPortalRestResponse = appsControllerExternalRequest - .postOnboardAppExternal(mockedRequest, mockedResponse, expectedOnboardingApp); - assertEquals(actualPortalRestResponse, expectedportalRestResponse); - - } -} -*/
\ No newline at end of file diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/AppsOSControllerTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/AppsOSControllerTest.java index 70e7a0ca..eb2ea32e 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/AppsOSControllerTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/AppsOSControllerTest.java @@ -1,6 +1,43 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.List; @@ -8,7 +45,6 @@ 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; @@ -18,12 +54,12 @@ import org.mockito.MockitoAnnotations; import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; +import org.openecomp.portalapp.portal.framework.MockEPUser; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.portal.service.AdminRolesService; import org.openecomp.portalapp.portal.service.EPAppService; import org.openecomp.portalapp.portal.service.PersUserAppService; import org.openecomp.portalapp.portal.service.UserService; -import org.openecomp.portalapp.portal.framework.MockEPUser; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.util.EPUserUtils; public class AppsOSControllerTest { diff --git a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardSearchResultControllerTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultControllerTest.java index 6da95415..b2a6c431 100644 --- a/ecomp-portal-BE-common-test/src/main/java/org/openecomp/portalapp/portal/test/controller/DashboardSearchResultControllerTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultControllerTest.java @@ -1,4 +1,41 @@ -package org.openecomp.portalapp.portal.test.controller; +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -16,55 +53,61 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.openecomp.portalapp.portal.controller.DashboardSearchResultController; import org.openecomp.portalapp.portal.domain.EPUser; import org.openecomp.portalapp.portal.ecomp.model.PortalRestResponse; import org.openecomp.portalapp.portal.ecomp.model.PortalRestStatusEnum; import org.openecomp.portalapp.portal.ecomp.model.SearchResultItem; +import org.openecomp.portalapp.portal.framework.MockEPUser; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.portal.service.DashboardSearchService; -import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; import org.openecomp.portalapp.portal.transport.CommonWidget; import org.openecomp.portalapp.portal.transport.CommonWidgetMeta; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; import org.openecomp.portalapp.util.EPUserUtils; public class DashboardSearchResultControllerTest { @Mock - DashboardSearchService searchService = new DashboardSearchServiceImpl(); - - @InjectMocks - DashboardSearchResultController dashboardSearchResultController = new DashboardSearchResultController(); + DashboardSearchService searchService; @Before public void setup() { MockitoAnnotations.initMocks(this); } + @InjectMocks + DashboardSearchResultController dashboardSearchResultController = new DashboardSearchResultController(); + MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); NullPointerException nullPointerException = new NullPointerException(); - - @Mock - EPUserUtils ePUserUtils = new EPUserUtils(); - MockEPUser mockUser = new MockEPUser(); @Test public void getWidgetDataTest() { - String resourceType = "test"; PortalRestResponse<CommonWidgetMeta> ecpectedPortalRestResponse = new PortalRestResponse<CommonWidgetMeta>(); ecpectedPortalRestResponse.setMessage("success"); - ecpectedPortalRestResponse.setResponse(null); + ecpectedPortalRestResponse.setResponse(new CommonWidgetMeta()); ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); - Mockito.when(searchService.getWidgetData(resourceType)).thenReturn(null); - PortalRestResponse<CommonWidgetMeta> acutualPoratlRestResponse = dashboardSearchResultController - .getWidgetData(mockedRequest, resourceType); - assertEquals(acutualPoratlRestResponse, ecpectedPortalRestResponse); + CommonWidgetMeta commonWidgetMeta = new CommonWidgetMeta(); + Mockito.when(searchService.getWidgetData("test")).thenReturn(commonWidgetMeta); + PortalRestResponse<CommonWidgetMeta> actualPortalRestResponse = dashboardSearchResultController + .getWidgetData(mockedRequest, "test"); + assertEquals(ecpectedPortalRestResponse.getStatus(), actualPortalRestResponse.getStatus()); + } + @Test + public void saveWidgetDataBulkIfCatrgoryNullTest() { + PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>(); + ecpectedPortalRestResponse.setMessage("ERROR"); + ecpectedPortalRestResponse.setResponse("Category cannot be null or empty"); + ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); + CommonWidgetMeta commonWidgetMeta = new CommonWidgetMeta(); + commonWidgetMeta.setCategory(null); + PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController + .saveWidgetDataBulk(commonWidgetMeta); + assertEquals(ecpectedPortalRestResponse, actualPortalRestResponse); } @Test @@ -73,230 +116,115 @@ public class DashboardSearchResultControllerTest { ecpectedPortalRestResponse.setMessage("success"); ecpectedPortalRestResponse.setResponse(null); ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); - CommonWidgetMeta commonWidgetMeta = new CommonWidgetMeta(); commonWidgetMeta.setCategory("test"); + List<CommonWidget> items = new ArrayList<>(); - List<CommonWidget> commonWidgetList = new ArrayList<CommonWidget>(); CommonWidget commonWidget = new CommonWidget(); commonWidget.setId((long) 1); - commonWidget.setCategory("test"); - commonWidget.setHref("test_href"); - commonWidget.setTitle("test_title"); - commonWidget.setContent("test_content"); - commonWidget.setEventDate(null); - commonWidget.setSortOrder(1); - - commonWidgetList.add(commonWidget); - - commonWidgetMeta.setItems(commonWidgetList); - - Mockito.when(searchService.saveWidgetDataBulk(commonWidgetMeta)).thenReturn(null); - + commonWidget.setEventDate("2017-06-06"); + items.add(commonWidget); + commonWidgetMeta.setItems(items); PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController .saveWidgetDataBulk(commonWidgetMeta); - assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse); + assertEquals(ecpectedPortalRestResponse, actualPortalRestResponse); } @Test - public void saveWidgetDataBulkIfCategoryNullTest() { + public void saveWidgetDataBulkExceptionTest() { PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>(); - ecpectedPortalRestResponse.setMessage("java.text.ParseException: Unparseable date: \"1\""); + ecpectedPortalRestResponse.setMessage("java.text.ParseException: Unparseable date: \"date\""); ecpectedPortalRestResponse.setResponse(null); ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); - CommonWidgetMeta commonWidgetMeta = new CommonWidgetMeta(); commonWidgetMeta.setCategory("test"); + List<CommonWidget> items = new ArrayList<>(); - List<CommonWidget> commonWidgetList = new ArrayList<CommonWidget>(); CommonWidget commonWidget = new CommonWidget(); - commonWidget.setId(null); - commonWidget.setCategory(null); - commonWidget.setHref(null); - commonWidget.setTitle(null); - commonWidget.setContent("test_content"); - commonWidget.setEventDate("1"); - commonWidget.setSortOrder(1); - commonWidgetList.add(commonWidget); - commonWidgetMeta.setItems(commonWidgetList); - - Mockito.when(searchService.saveWidgetDataBulk(commonWidgetMeta)).thenReturn(null); - + commonWidget.setId((long) 1); + commonWidget.setEventDate("date"); + items.add(commonWidget); + commonWidgetMeta.setItems(items); PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController .saveWidgetDataBulk(commonWidgetMeta); - assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse); + assertEquals(ecpectedPortalRestResponse, actualPortalRestResponse); } @Test - public void saveWidgetDataTest() { + public void saveWidgetDataIfCatagoryNullTest() { PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>(); - ecpectedPortalRestResponse.setMessage("success"); - ecpectedPortalRestResponse.setResponse(null); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); + ecpectedPortalRestResponse.setMessage("ERROR"); + ecpectedPortalRestResponse.setResponse("Cateogry cannot be null or empty"); + ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); CommonWidget commonWidget = new CommonWidget(); - commonWidget.setId((long) 1); - commonWidget.setCategory("test"); - commonWidget.setHref("test_href"); - commonWidget.setTitle("test_title"); - commonWidget.setContent("test_content"); - commonWidget.setEventDate(null); - commonWidget.setSortOrder(1); - - Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn(null); - + commonWidget.setCategory(null); PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController .saveWidgetData(commonWidget); - assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse); - + assertEquals(ecpectedPortalRestResponse, actualPortalRestResponse); } @Test - public void saveWidgetDataExceptionTest() { + public void saveWidgetDataTest() { PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>(); - ecpectedPortalRestResponse.setMessage("ERROR"); - ecpectedPortalRestResponse.setResponse("Cateogry cannot be null or empty"); - ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); + ecpectedPortalRestResponse.setMessage("success"); + ecpectedPortalRestResponse.setResponse(null); + ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); CommonWidget commonWidget = new CommonWidget(); + commonWidget.setCategory("test"); commonWidget.setId((long) 1); - commonWidget.setCategory(""); - commonWidget.setHref("test_href"); - commonWidget.setTitle("test_title"); - commonWidget.setContent("test_content"); - commonWidget.setEventDate(null); - commonWidget.setSortOrder(1); - - Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn(null); - + commonWidget.setEventDate("2017-06-06"); PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController .saveWidgetData(commonWidget); - assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse); - + assertEquals(ecpectedPortalRestResponse, actualPortalRestResponse); } @Test - public void saveWidgetDataDateErrorTest() { + public void saveWidgetDataExceptionTest() { PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>(); - ecpectedPortalRestResponse.setMessage("java.text.ParseException: Unparseable date: \"1\""); + ecpectedPortalRestResponse.setMessage("java.text.ParseException: Unparseable date: \"date\""); ecpectedPortalRestResponse.setResponse(null); ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.ERROR); CommonWidget commonWidget = new CommonWidget(); - commonWidget.setId((long) 1); commonWidget.setCategory("test"); - commonWidget.setHref("test_href"); - commonWidget.setTitle("test_title"); - commonWidget.setContent("test_content"); - commonWidget.setEventDate("1"); - commonWidget.setSortOrder(1); - - Mockito.when(searchService.saveWidgetData(commonWidget)).thenReturn(null); - + commonWidget.setId((long) 1); + commonWidget.setEventDate("date"); PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController .saveWidgetData(commonWidget); - assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse); - + assertEquals(ecpectedPortalRestResponse, actualPortalRestResponse); } - - public void deleteWidgetDataTest() { + + @Test + public void deleteWidgetDataTest() + { PortalRestResponse<String> ecpectedPortalRestResponse = new PortalRestResponse<String>(); ecpectedPortalRestResponse.setMessage("success"); ecpectedPortalRestResponse.setResponse(null); ecpectedPortalRestResponse.setStatus(PortalRestStatusEnum.OK); CommonWidget commonWidget = new CommonWidget(); - commonWidget.setId((long) 1); - commonWidget.setCategory("test"); - commonWidget.setHref("test_href"); - commonWidget.setTitle("test_title"); - commonWidget.setContent("test_content"); - commonWidget.setEventDate(null); - commonWidget.setSortOrder(1); - Mockito.when(searchService.deleteWidgetData(commonWidget)).thenReturn(null); - + Mockito.when(searchService.deleteWidgetData(commonWidget)).thenReturn("test"); PortalRestResponse<String> actualPortalRestResponse = dashboardSearchResultController .deleteWidgetData(commonWidget); - System.out.println(actualPortalRestResponse); - assertEquals(actualPortalRestResponse, ecpectedPortalRestResponse); + assertEquals(ecpectedPortalRestResponse.getStatus(), actualPortalRestResponse.getStatus()); } - + @Test - public void searchPortalIfUserIsNull() { + public void searchPortalIfUserIsTest() + { EPUser user = null; Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); String searchString = "test"; - PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>(); expectedResult.setMessage("searchPortal: User object is null? - check logs"); expectedResult.setResponse(new HashMap<String, List<SearchResultItem>>()); expectedResult.setStatus(PortalRestStatusEnum.ERROR); PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController .searchPortal(mockedRequest, searchString); - assertEquals(expectedResult, actualResult); - } + System.out.println(actualResult); - @Test - public void searchPortalIfSearchStringNullTest() { - EPUser user = mockUser.mockEPUser(); - ; - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - String searchString = null; - - PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>(); - expectedResult.setMessage("searchPortal: String string is null"); - expectedResult.setResponse(new HashMap<String, List<SearchResultItem>>()); - expectedResult.setStatus(PortalRestStatusEnum.ERROR); - - PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController - .searchPortal(mockedRequest, searchString); assertEquals(expectedResult, actualResult); } - - @Test - public void searchPortalIfSearchTest() { - EPUser user = mockUser.mockEPUser(); - ; - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - String searchString = "test"; - List<SearchResultItem> searchResultItemList = new ArrayList<SearchResultItem>(); - SearchResultItem searchResultItem = new SearchResultItem(); - - searchResultItem.setId((long) 1); - searchResultItem.setCategory("test"); - searchResultItem.setName("test_name"); - searchResultItem.setTarget("test_target"); - searchResultItem.setUuid("test_UUId"); - searchResultItemList.add(searchResultItem); - Map<String, List<SearchResultItem>> expectedResultMap = new HashMap<String, List<SearchResultItem>>(); - expectedResultMap.put(searchString, searchResultItemList); - - PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>(); - expectedResult.setMessage("success"); - expectedResult.setResponse(expectedResultMap); - expectedResult.setStatus(PortalRestStatusEnum.OK); - - Mockito.when(searchService.searchResults(user.getLoginId(), searchString)).thenReturn(expectedResultMap); - PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController - .searchPortal(mockedRequest, searchString); - assertEquals(expectedResult, actualResult); - - } - - @Test - public void searchPortalIfSearchExcptionTest() { - EPUser user = mockUser.mockEPUser(); - ; - Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); - String searchString = "test"; - - PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>(); - expectedResult.setMessage("null - check logs."); - expectedResult.setResponse(new HashMap<String, List<SearchResultItem>>()); - expectedResult.setStatus(PortalRestStatusEnum.ERROR); - - Mockito.when(searchService.searchResults(user.getLoginId(), searchString)).thenThrow(nullPointerException); - PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController - .searchPortal(mockedRequest, searchString); - assertEquals(expectedResult, actualResult); - } - + + @Test public void getActiveUsersTest() { List<String> expectedActiveUsers = new ArrayList<String>(); @@ -362,5 +290,70 @@ public class DashboardSearchResultControllerTest { assertEquals(actualResult, expectedResult); } + + @Test + public void searchPortalIfSearchStringNullTest() { + EPUser user = mockUser.mockEPUser(); + ; + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + String searchString = null; + + PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>(); + expectedResult.setMessage("searchPortal: String string is null"); + expectedResult.setResponse(new HashMap<String, List<SearchResultItem>>()); + expectedResult.setStatus(PortalRestStatusEnum.ERROR); + + PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController + .searchPortal(mockedRequest, searchString); + assertEquals(expectedResult, actualResult); + } + + @Test + public void searchPortalIfSearchTest() { + EPUser user = mockUser.mockEPUser(); + ; + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + String searchString = "test"; + List<SearchResultItem> searchResultItemList = new ArrayList<SearchResultItem>(); + SearchResultItem searchResultItem = new SearchResultItem(); + + searchResultItem.setId((long) 1); + searchResultItem.setCategory("test"); + searchResultItem.setName("test_name"); + searchResultItem.setTarget("test_target"); + searchResultItem.setUuid("test_UUId"); + searchResultItemList.add(searchResultItem); + Map<String, List<SearchResultItem>> expectedResultMap = new HashMap<String, List<SearchResultItem>>(); + expectedResultMap.put(searchString, searchResultItemList); + + PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>(); + expectedResult.setMessage("success"); + expectedResult.setResponse(expectedResultMap); + expectedResult.setStatus(PortalRestStatusEnum.OK); + + Mockito.when(searchService.searchResults(user.getLoginId(), searchString)).thenReturn(expectedResultMap); + PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController + .searchPortal(mockedRequest, searchString); + assertEquals(expectedResult, actualResult); + + } + + @Test + public void searchPortalIfSearchExcptionTest() { + EPUser user = mockUser.mockEPUser(); + ; + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + String searchString = "test"; + + PortalRestResponse<Map<String, List<SearchResultItem>>> expectedResult = new PortalRestResponse<Map<String, List<SearchResultItem>>>(); + expectedResult.setMessage("null - check logs."); + expectedResult.setResponse(new HashMap<String, List<SearchResultItem>>()); + expectedResult.setStatus(PortalRestStatusEnum.ERROR); + + Mockito.when(searchService.searchResults(user.getLoginId(), searchString)).thenThrow(nullPointerException); + PortalRestResponse<Map<String, List<SearchResultItem>>> actualResult = dashboardSearchResultController + .searchPortal(mockedRequest, searchString); + assertEquals(expectedResult, actualResult); + } } diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ECOMPLogoutControllerTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ECOMPLogoutControllerTest.java index 729debaa..954ff0c4 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ECOMPLogoutControllerTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ECOMPLogoutControllerTest.java @@ -1,8 +1,44 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; -import javax.servlet.ServletRequestWrapper; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -13,13 +49,12 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.mockito.stubbing.OngoingStubbing; import org.openecomp.portalapp.controller.ECOMPLogoutController; +import org.openecomp.portalapp.portal.framework.MockEPUser; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.portal.service.DashboardSearchService; import org.openecomp.portalapp.portal.service.DashboardSearchServiceImpl; -import org.openecomp.portalapp.portal.framework.MockEPUser; import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; -import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.util.EPUserUtils; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulControllerOSTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulControllerOSTest.java new file mode 100644 index 00000000..0f92bb3e --- /dev/null +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulControllerOSTest.java @@ -0,0 +1,198 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; + +import static org.junit.Assert.*; + +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.openecomp.portalapp.portal.domain.EPUser; +import org.openecomp.portalapp.portal.framework.MockEPUser; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; +import org.openecomp.portalapp.portal.service.AdminRolesService; +import org.openecomp.portalapp.portal.service.EPLoginService; +import org.openecomp.portalapp.portal.service.FunctionalMenuService; +import org.openecomp.portalapp.portal.transport.FavoritesFunctionalMenuItemJson; +import org.openecomp.portalapp.portal.transport.FunctionalMenuItem; +import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties; +import org.openecomp.portalapp.portal.utils.EPSystemProperties; +import org.openecomp.portalapp.portal.utils.EcompPortalUtils; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.slf4j.MDC; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({ MDC.class, EPSystemProperties.class , EcompPortalUtils.class}) +public class ExternalAppsRestfulControllerOSTest { + + + @InjectMocks + ExternalAppsRestfulController externalAppsRestfulController = new ExternalAppsRestfulController(); + @Mock + FunctionalMenuService functionalMenuService; + + @Mock + EPLoginService epLoginService; + + @Mock + AdminRolesService adminRolesService; + + + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); + + HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); + HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); + NullPointerException nullPointerException = new NullPointerException(); + + MockEPUser mockUser = new MockEPUser(); + + @Test + public void getFavoritesForUserTest() throws Exception + { + PowerMockito.mockStatic(EPSystemProperties.class); + PowerMockito.mockStatic(MDC.class); + PowerMockito.mockStatic(EcompPortalUtils.class); + EPUser epUser = mockUser.mockEPUser(); + epUser.setId((long) 1); + epUser.setLoginId("guestT"); + String loginId = "guestT"; + Mockito.when(MDC.get(EPSystemProperties.PARTNER_NAME)).thenReturn("Test"); + List<FavoritesFunctionalMenuItemJson> favorites = new ArrayList<FavoritesFunctionalMenuItemJson>(); + FavoritesFunctionalMenuItemJson favoritesFunctionalMenuItemJson = new FavoritesFunctionalMenuItemJson(); + favorites.add(favoritesFunctionalMenuItemJson); + Mockito.when(mockedRequest.getHeader(EPCommonSystemProperties.MDC_LOGIN_ID)).thenReturn("Login_URL"); + Mockito.when(MDC.get(EPSystemProperties.PARTNER_NAME)).thenReturn("Test"); + Mockito.when(epLoginService.findUserWithoutPwd("Login_URL")).thenReturn(epUser); + Mockito.when(functionalMenuService.getFavoriteItems(epUser.getId())).thenReturn(favorites); + List<FavoritesFunctionalMenuItemJson> actaulFavorites = externalAppsRestfulController + .getFavoritesForUser(mockedRequest, mockedResponse); + assertEquals(actaulFavorites.size(), 1); + } + + @Test + public void getFunctionalMenuItemsForUserIfSuperAdminTest() throws Exception { + PowerMockito.mockStatic(EPSystemProperties.class); + PowerMockito.mockStatic(MDC.class); + PowerMockito.mockStatic(EcompPortalUtils.class); + EPUser epUser = mockUser.mockEPUser(); + epUser.setId((long) 1); + epUser.setLoginId("guestT"); + String loginId = "guestT"; + Mockito.when(MDC.get(EPSystemProperties.PARTNER_NAME)).thenReturn("Test"); + Mockito.when(epLoginService.findUserWithoutPwd(loginId)).thenReturn(epUser); + List<FunctionalMenuItem> expectedList = new ArrayList<FunctionalMenuItem>(); + FunctionalMenuItem functionalMenuItem = new FunctionalMenuItem(); + expectedList.add(functionalMenuItem); + Mockito.when(mockedRequest.getHeader("LoginId")).thenReturn("guestT"); + Mockito.when(adminRolesService.isSuperAdmin(epUser)).thenReturn(true); + Mockito.when(functionalMenuService.getFunctionalMenuItems()).thenReturn(expectedList); + List<FunctionalMenuItem> actualList = externalAppsRestfulController.getFunctionalMenuItemsForUser(mockedRequest, + mockedResponse); + assertNull(actualList.get(0).menuId); + } + + @Test(expected = Exception.class) + public void getFunctionalMenuItemsForUserIfUSerNullTest() throws + Exception + { + PowerMockito.mockStatic(EPSystemProperties.class); + PowerMockito.mockStatic(EcompPortalUtils.class); + PowerMockito.mockStatic(MDC.class); + EPUser epUser = null; + String loginId = "guestT"; + Mockito.when(MDC.get(EPSystemProperties.PARTNER_NAME)).thenReturn("Test"); + Mockito.when(epLoginService.findUserWithoutPwd(loginId)).thenReturn(epUser); + externalAppsRestfulController.getFunctionalMenuItemsForUser(mockedRequest, + mockedResponse); + } + + @Test + public void getFunctionalMenuItemsForUserTest() throws Exception { + PowerMockito.mockStatic(EPSystemProperties.class); + PowerMockito.mockStatic(MDC.class); + EPUser epUser = mockUser.mockEPUser(); + epUser.setId((long) 1); + epUser.setLoginId("guestT"); + String loginId = "guestT"; + Mockito.when(MDC.get(EPSystemProperties.PARTNER_NAME)).thenReturn("Test"); + Mockito.when(epLoginService.findUserWithoutPwd(loginId)).thenReturn(epUser); + List<FunctionalMenuItem> expectedList = new ArrayList<FunctionalMenuItem>(); + FunctionalMenuItem functionalMenuItem = new FunctionalMenuItem(); + expectedList.add(functionalMenuItem); + Mockito.when(mockedRequest.getHeader("LoginId")).thenReturn("guestT"); + Mockito.when(adminRolesService.isSuperAdmin(epUser)).thenReturn(false); + Mockito.when(functionalMenuService.getFunctionalMenuItemsForUser(epUser.getOrgUserId())) + .thenReturn(expectedList); + List<FunctionalMenuItem> actualList = externalAppsRestfulController.getFunctionalMenuItemsForUser(mockedRequest, + mockedResponse); + assertNull(actualList.get(0).menuId); + } + + @Test(expected = Exception.class) + public void getFavoritesForUserIfUserNullTest() throws Exception { + List<FavoritesFunctionalMenuItemJson> favorites = new ArrayList<FavoritesFunctionalMenuItemJson>(); + FavoritesFunctionalMenuItemJson favoritesFunctionalMenuItemJson = new FavoritesFunctionalMenuItemJson(); + favorites.add(favoritesFunctionalMenuItemJson); + PowerMockito.mockStatic(EPSystemProperties.class); + PowerMockito.mockStatic(MDC.class); + Mockito.when(mockedRequest.getHeader(EPSystemProperties.MDC_LOGIN_ID)).thenReturn("Login_URL"); + Mockito.when(MDC.get(EPSystemProperties.PARTNER_NAME)).thenReturn("Test"); + EPUser epUser = null; + externalAppsRestfulController.getFavoritesForUser(mockedRequest, mockedResponse); + } + + +} diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/LoginControllerTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/LoginControllerTest.java index 968f5811..a02e1b2f 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/LoginControllerTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/LoginControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.*; @@ -70,7 +107,7 @@ public class LoginControllerTest { PowerMockito.mockStatic(SystemProperties.class); Mockito.when(SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM)).thenReturn("OIDC"); ModelAndView result = loginController.login(mockedRequest); - assertEquals(result.getViewName(),"openIdLogin") ; + assertEquals(result.getViewName(),"login") ; } @Test diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ONAPLoginControllerTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ONAPLoginControllerTest.java index 06dfc902..46218302 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ONAPLoginControllerTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ONAPLoginControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; @@ -57,6 +94,8 @@ public class ONAPLoginControllerTest { ModelAndView actualModelandView = null; Mockito.when(loginStrategy.doLogin(mockedRequest, mockedResponse)).thenReturn(expectedModelandView); actualModelandView= oNAPLoginController.doLogin(mockedRequest, mockedResponse); + oNAPLoginController.setViewName("test"); + assertEquals("test", oNAPLoginController.getViewName()); assertEquals(actualModelandView,expectedModelandView); } diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ONAPWelcomeControllerTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ONAPWelcomeControllerTest.java index c15f366a..b7399fbe 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ONAPWelcomeControllerTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/ONAPWelcomeControllerTest.java @@ -1,6 +1,45 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; + +import java.security.Principal; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -8,15 +47,19 @@ import javax.servlet.http.HttpServletResponse; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.openecomp.portalapp.controller.ONAPWelcomeController; import org.openecomp.portalapp.portal.framework.MockitoTestSuite; +import org.springframework.web.servlet.ModelAndView; public class ONAPWelcomeControllerTest { @InjectMocks ONAPWelcomeController oNAPWelcomeController = new ONAPWelcomeController(); + @Mock + Principal p; @Before public void setup() { MockitoAnnotations.initMocks(this); @@ -43,5 +86,14 @@ public class ONAPWelcomeControllerTest { { assertEquals(oNAPWelcomeController.user(null), "oid-user"); } - + + @Test + public void loginTest() + { + ModelAndView expectedView = new ModelAndView(); + expectedView.setViewName("openIdLogin"); + ModelAndView md = oNAPWelcomeController.login(p); + System.out.println(md.getViewName()); + assertEquals(md.getViewName(), expectedView.getViewName()); + } } diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerOSTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerOSTest.java index 65925977..aa7cb46a 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerOSTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/PortalAdminControllerOSTest.java @@ -1,4 +1,41 @@ -/*package org.openecomp.portalapp.portal.controller; +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -17,14 +54,15 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.openecomp.portalapp.portal.domain.EPRole; import org.openecomp.portalapp.portal.domain.EPUser; +import org.openecomp.portalapp.portal.framework.MockEPUser; +import org.openecomp.portalapp.portal.framework.MockitoTestSuite; import org.openecomp.portalapp.portal.service.AdminRolesService; import org.openecomp.portalapp.portal.service.AdminRolesServiceImpl; import org.openecomp.portalapp.portal.service.PortalAdminService; import org.openecomp.portalapp.portal.service.PortalAdminServiceImpl; -import org.openecomp.portalapp.portal.test.core.MockEPUser; import org.openecomp.portalapp.portal.transport.FieldsValidator; +import org.openecomp.portalapp.portal.transport.PortalAdmin; import org.openecomp.portalapp.portal.utils.EcompPortalUtils; -import org.openecomp.portalapp.test.framework.MockitoTestSuite; import org.openecomp.portalapp.util.EPUserUtils; import org.openecomp.portalsdk.core.service.AuditService; import org.openecomp.portalsdk.core.service.AuditServiceImpl; @@ -69,7 +107,7 @@ public class PortalAdminControllerOSTest { EPUser user = mockUser.mockEPUser(); Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - String userInfo = "1-test"; + Long userInfo = (long) 12; assertNull(portalAdminController.deletePortalAdmin(mockedRequest, userInfo, mockedResponse)); } @@ -85,11 +123,11 @@ public class PortalAdminControllerOSTest { expectedFieldValidator.setFields(null); expectedFieldValidator.setErrorCode(null); FieldsValidator actualFieldValidator = new FieldsValidator(); - String userInfo = "1-test"; + Long userInfo = (long) 12; Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); - Mockito.when(portalAdminService.deletePortalAdmin((long) 1)).thenReturn(expectedFieldValidator); + Mockito.when(portalAdminService.deletePortalAdmin((long) 12)).thenReturn(expectedFieldValidator); actualFieldValidator = portalAdminController.deletePortalAdmin(mockedRequest, userInfo, mockedResponse); - assertEquals(actualFieldValidator,expectedFieldValidator); + assertEquals(actualFieldValidator,expectedFieldValidator); } @@ -99,7 +137,7 @@ public class PortalAdminControllerOSTest { EPUser user = mockUser.mockEPUser(); Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); - String userInfo = ""; + Long userInfo = null; assertNull(portalAdminController.deletePortalAdmin(mockedRequest, userInfo, mockedResponse)); } @@ -138,5 +176,66 @@ public class PortalAdminControllerOSTest { List<EPRole> actualRoleList = portalAdminController.getRolesByApp(mockedRequest, appId, mockedResponse); assertEquals(actualRoleList,expectedRoleList); } + + @Test + public void createPortalAdminIfUserNullTest() + { + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(null); + assertNull(portalAdminController.createPortalAdmin(mockedRequest, "guestT", mockedResponse)); + } + + + @Test + public void createPortalAdminIfUserIsSuperAdminTest() + { + + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + FieldsValidator expectedFieldValidator = new FieldsValidator(); + expectedFieldValidator.setHttpStatusCode((long) 200); + expectedFieldValidator.setFields(null); + expectedFieldValidator.setErrorCode(null); + FieldsValidator actualFieldValidator = new FieldsValidator(); + Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); + Mockito.when(portalAdminService.createPortalAdmin("guestT")).thenReturn(expectedFieldValidator); + actualFieldValidator = portalAdminController.createPortalAdmin(mockedRequest, "guestT", mockedResponse); + assertEquals(actualFieldValidator,expectedFieldValidator); + } + + @Test + public void createPortalAdminIfUserIsNotSuperAdminTest() + { + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); + assertNull(portalAdminController.createPortalAdmin(mockedRequest, "guestT", mockedResponse)); + } + + @Test + public void getPortalAdminsIfUserNullTest() + { + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(null); + assertNull(portalAdminController.getPortalAdmins(mockedRequest, mockedResponse)); + } + + @Test + public void getPortalAdminsIfUserAdminTest() + { + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + List<PortalAdmin> portalAdmins = new ArrayList<>(); + Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(true); + Mockito.when(portalAdminService.getPortalAdmins()).thenReturn(portalAdmins); + List<PortalAdmin> actualortalAdmins = portalAdminController.getPortalAdmins(mockedRequest, mockedResponse); + assertEquals(actualortalAdmins,portalAdmins); + } + + @Test + public void getPortalAdminIfUserIsNotSuperAdminTest() + { + EPUser user = mockUser.mockEPUser(); + Mockito.when(EPUserUtils.getUserSession(mockedRequest)).thenReturn(user); + Mockito.when(adminRolesService.isSuperAdmin(user)).thenReturn(false); + assertNull(portalAdminController.getPortalAdmins(mockedRequest, mockedResponse)); + } } -*/
\ No newline at end of file diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java index c3ca2430..f4196db8 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestClient.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java index 5bb7a456..e4061785 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextRestControllerTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java index 9344150f..1c849420 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/controller/SharedContextTestProperties.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.controller; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/framework/MockEPUser.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/framework/MockEPUser.java index d132ccf3..d38b21a0 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/framework/MockEPUser.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/framework/MockEPUser.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.framework; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java index 3ff837dc..529dd5ae 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/framework/MockitoTestSuite.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.framework; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java index f87f5bd1..651f7f61 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/listener/HealthMonitorTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.listener; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/RemoteWebServiceCallServiceImplTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/RemoteWebServiceCallServiceImplTest.java index d38525b3..f3218a70 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/RemoteWebServiceCallServiceImplTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/RemoteWebServiceCallServiceImplTest.java @@ -1,6 +1,44 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; @@ -8,7 +46,6 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openecomp.portalsdk.core.util.SystemProperties; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -18,10 +55,10 @@ import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.openecomp.portalapp.portal.domain.EPApp; import org.openecomp.portalapp.portal.framework.MockitoTestSuite; -import org.openecomp.portalapp.portal.utils.EcompPortalUtils; import org.openecomp.portalapp.service.RemoteWebServiceCallServiceImpl; import org.openecomp.portalsdk.core.onboarding.util.CipherUtil; import org.openecomp.portalsdk.core.service.DataAccessService; +import org.openecomp.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/SearchServiceImplTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/SearchServiceImplTest.java index fd6578f8..71671da3 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/SearchServiceImplTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/SearchServiceImplTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.portal.service; import static org.junit.Assert.*; diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/UserServiceImplTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/UserServiceImplTest.java deleted file mode 100644 index 63a710eb..00000000 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/service/UserServiceImplTest.java +++ /dev/null @@ -1,63 +0,0 @@ -//package org.openecomp.portalapp.portal.service; -// -//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.openecomp.portalapp.portal.framework.MockitoTestSuite; -//import org.openecomp.portalapp.portal.utils.EPSystemProperties; -//import org.openecomp.portalsdk.core.service.DataAccessService; -//import org.openecomp.portalsdk.core.util.SystemProperties; -//import org.powermock.api.mockito.PowerMockito; -// -//import java.io.BufferedReader; -//import java.io.IOException; -//import java.io.InputStreamReader; -//import java.io.UnsupportedEncodingException; -//import java.net.HttpURLConnection; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -// -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ SystemProperties.class , EPSystemProperties.class , SystemProperties.class}) -//public class UserServiceImplTest { -// -// -// @InjectMocks -// UserServiceImpl userServiceImpl = new UserServiceImpl(); -// -// @Mock -// DataAccessService dataAccessService; -// -// @Mock -// HttpURLConnection con; -// -// @Before -// public void setup() { -// MockitoAnnotations.initMocks(this); -// } -// -// MockitoTestSuite mockitoTestSuite = new MockitoTestSuite(); -// -// HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest(); -// HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse(); -// -// @Test -// public void getUserByUserIdTest() throws UnsupportedEncodingException, IOException -// { -// BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); -// PowerMockito.mockStatic(SystemProperties.class); -// PowerMockito.mockStatic(EPSystemProperties.class); -// Mockito.when(SystemProperties.getProperty(SystemProperties.AUTHENTICATION_MECHANISM)).thenReturn("OIDC"); -// Mockito.when(EPSystemProperties.getProperty(EPSystemProperties.AUTH_USER_SERVER)).thenReturn("http://www.google.com"); -// Mockito.when(new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"))).thenReturn(reader).thenReturn(reader); -// userServiceImpl.getUserByUserId("guestT"); -// } -//} diff --git a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java index b1dd853f..d9a54360 100644 --- a/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java +++ b/ecomp-portal-BE-os/src/test/java/org/openecomp/portalapp/portal/utils/EcompPortalUtilsTest.java @@ -1,21 +1,39 @@ /*- - * ================================================================================ - * ECOMP Portal - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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 - * + * + * 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.openecomp.portalapp.portal.utils; diff --git a/ecomp-portal-FE-os/pom.xml b/ecomp-portal-FE-os/pom.xml index 894d39d1..6b91d371 100644 --- a/ecomp-portal-FE-os/pom.xml +++ b/ecomp-portal-FE-os/pom.xml @@ -1,9 +1,14 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.openecomp.portal</groupId> + + <parent> + <groupId>org.onap.portal</groupId> + <artifactId>onap-portal-parent</artifactId> + <version>1.3.0-SNAPSHOT</version> + </parent> + <artifactId>ecompportal-FE-os</artifactId> - <version>1.1.0</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> @@ -43,7 +48,7 @@ <configuration> <skip>true</skip> </configuration> - </plugin> + </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> diff --git a/ecomp-portal-widget-ms/common-widgets/pom.xml b/ecomp-portal-widget-ms/common-widgets/pom.xml index a5b51bf6..308ead1f 100644 --- a/ecomp-portal-widget-ms/common-widgets/pom.xml +++ b/ecomp-portal-widget-ms/common-widgets/pom.xml @@ -2,9 +2,14 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.openecomp.portal</groupId> + + <parent> + <groupId>org.onap.portal</groupId> + <artifactId>widget-ms-parent</artifactId> + <version>1.3.0-SNAPSHOT</version> + </parent> + <artifactId>common-widgets</artifactId> - <version>1.3.0-SNAPSHOT</version> <packaging>pom</packaging> <properties> diff --git a/ecomp-portal-widget-ms/pom.xml b/ecomp-portal-widget-ms/pom.xml index 52d73821..74d94e65 100644 --- a/ecomp-portal-widget-ms/pom.xml +++ b/ecomp-portal-widget-ms/pom.xml @@ -2,65 +2,68 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.openecomp.portal</groupId> + + <parent> + <groupId>org.onap.portal</groupId> + <artifactId>onap-portal-parent</artifactId> + <version>1.3.0-SNAPSHOT</version> + </parent> + <artifactId>widget-ms-parent</artifactId> - <version>1.3.0-SNAPSHOT</version> <packaging>pom</packaging> - <modules> - <!-- Child modules do NOT name this parent. --> - <!-- Defined for build convenience only! --> - <!-- This POM names only ONAP projects --> - <module>common-widgets</module> - <module>widget-ms</module> - </modules> + <modules> + <module>common-widgets</module> + <!-- The widget-ms module uses Spring; it cannot name this parent. --> + <module>widget-ms</module> + </modules> - <build> - <plugins> - <!-- No deployment step for this project --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-deploy-plugin</artifactId> - <version>2.8</version> - <configuration> - <skip>true</skip> - </configuration> - </plugin> + <build> + <plugins> + <!-- No deployment step for this project --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>0.7.6.201602180812</version> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.7.6.201602180812</version> + <configuration> + <skip>true</skip> + </configuration> + <inherited>True</inherited> + <executions> + <!-- Unit-Tests --> + <execution> + <id>prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + <phase>test</phase> + <configuration> + <destFile>${sonar.jacoco.reportPath}</destFile> + </configuration> + </execution> + <execution> + <id>report</id> + <goals> + <goal>report</goal> + </goals> + <phase>test</phase> <configuration> - <skip>true</skip> + <dataFile>${sonar.jacoco.reportPath}</dataFile> + <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory> </configuration> - <inherited>True</inherited> - <executions> - <!-- Unit-Tests --> - <execution> - <id>prepare-agent</id> - <goals> - <goal>prepare-agent</goal> - </goals> - <phase>test</phase> - <configuration> - <destFile>${sonar.jacoco.reportPath}</destFile> - </configuration> - </execution> - <execution> - <id>report</id> - <goals> - <goal>report</goal> - </goals> - <phase>test</phase> - <configuration> - <dataFile>${sonar.jacoco.reportPath}</dataFile> - <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/ecomp-portal-widget-ms/widget-ms/pom.xml b/ecomp-portal-widget-ms/widget-ms/pom.xml index 45da5d57..d755f5ab 100644 --- a/ecomp-portal-widget-ms/widget-ms/pom.xml +++ b/ecomp-portal-widget-ms/widget-ms/pom.xml @@ -2,12 +2,8 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.openecomp.portal</groupId> - <artifactId>widget-ms</artifactId> - <version>1.3.0-SNAPSHOT</version> - <packaging>jar</packaging> - <name>widget-microservice</name> + <!-- This project must name Spring as parent; cannot name Portal --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> @@ -15,6 +11,12 @@ <relativePath /> <!-- lookup parent from repository --> </parent> + <groupId>org.onap.portal</groupId> + <artifactId>widget-ms</artifactId> + <version>1.3.0-SNAPSHOT</version> + <packaging>jar</packaging> + <name>widget-microservice</name> + <properties> <docker.imagename>widget-ms</docker.imagename> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> @@ -27,7 +29,7 @@ <dependencies> <!-- This pom pulls in artifacts --> <dependency> - <groupId>org.openecomp.portal</groupId> + <groupId>org.onap.portal</groupId> <artifactId>common-widgets</artifactId> <version>${project.version}</version> <type>pom</type> diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/MicroserviceApplication.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/MicroserviceApplication.java index 6516c364..446f48f4 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/MicroserviceApplication.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/MicroserviceApplication.java @@ -1,4 +1,41 @@ - package org.openecomp.portalapp.widget; +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -10,9 +47,10 @@ import org.springframework.web.client.RestTemplate; @ComponentScan(basePackages = "org.openecomp.portalapp.widget") public class MicroserviceApplication { @Bean - public RestTemplate getRestTemplate(){ + public RestTemplate getRestTemplate() { return new RestTemplate(); } + public static void main(String[] args) { SpringApplication.run(MicroserviceApplication.class, args); } diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/constant/WidgetConstant.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/constant/WidgetConstant.java index b1a939b1..c54f100c 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/constant/WidgetConstant.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/constant/WidgetConstant.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.constant; public final class WidgetConstant { diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/DatabaseFileUploadController.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/DatabaseFileUploadController.java index ec32e42f..02cc9415 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/DatabaseFileUploadController.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/DatabaseFileUploadController.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.controller; import java.io.UnsupportedEncodingException; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/HealthController.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/HealthController.java index fc324ab1..dfe5c2d6 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/HealthController.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/HealthController.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.controller; import javax.servlet.http.HttpServletRequest; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/WidgetsCatalogController.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/WidgetsCatalogController.java index 1af5a3cc..60d92772 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/WidgetsCatalogController.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/controller/WidgetsCatalogController.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.controller; import java.io.IOException; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/dao/WidgetDataSource.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/dao/WidgetDataSource.java index 0a950c54..8b5692b8 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/dao/WidgetDataSource.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/dao/WidgetDataSource.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.dao; import javax.sql.DataSource; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/App.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/App.java index 19c6311b..40ef2529 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/App.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/App.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.domain; import java.io.Serializable; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceData.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceData.java index 831b1e65..02df499c 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceData.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceData.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.domain; import javax.persistence.Column; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceParameter.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceParameter.java index 9f19c0d4..87cabb76 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceParameter.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/MicroserviceParameter.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.domain; import javax.persistence.Column; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/RoleApp.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/RoleApp.java index ca73f313..8ff7cc31 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/RoleApp.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/RoleApp.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.domain; import java.io.Serializable; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/ValidationRespond.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/ValidationRespond.java index 25c74af1..94196f18 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/ValidationRespond.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/ValidationRespond.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.domain; public class ValidationRespond { diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetCatalog.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetCatalog.java index 6b7823e6..d54748a5 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetCatalog.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetCatalog.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.domain; import java.util.Set; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetFile.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetFile.java index 7eb3c1ef..b405c82f 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetFile.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/domain/WidgetFile.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.domain; import javax.persistence.Column; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageException.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageException.java index 65b71454..80a4f21f 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageException.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageException.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.excetpion; public class StorageException extends RuntimeException { diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageFileNotFoundException.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageFileNotFoundException.java index 44fb7286..fc3afe4a 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageFileNotFoundException.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/excetpion/StorageFileNotFoundException.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.excetpion; public class StorageFileNotFoundException extends StorageException { diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/filters/CorsConfiguration.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/filters/CorsConfiguration.java index 2fdb5480..9d1dd8f5 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/filters/CorsConfiguration.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/filters/CorsConfiguration.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.filters; import org.springframework.context.annotation.Configuration; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/hibernate/HibernateConfiguration.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/hibernate/HibernateConfiguration.java index a376da0a..c132a85b 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/hibernate/HibernateConfiguration.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/hibernate/HibernateConfiguration.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.hibernate; import java.util.Properties; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/listener/WidgetEventListener.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/listener/WidgetEventListener.java index 25eadfa7..04b1dbcf 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/listener/WidgetEventListener.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/listener/WidgetEventListener.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.listener; import org.openecomp.portalapp.widget.service.InitializationService; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/InitializationService.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/InitializationService.java index 4a34606a..a6e9fcbf 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/InitializationService.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/InitializationService.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.service; public interface InitializationService { diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/MicroserviceService.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/MicroserviceService.java index 32eb48b1..377ed53c 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/MicroserviceService.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/MicroserviceService.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.service; import org.openecomp.portalapp.widget.domain.MicroserviceData; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/StorageService.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/StorageService.java index 1eb14704..7d1fab9b 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/StorageService.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/StorageService.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.service; import java.io.File; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/WidgetCatalogService.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/WidgetCatalogService.java index e9bd0f33..c8670baf 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/WidgetCatalogService.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/WidgetCatalogService.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.service; import java.util.List; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/InitializationServiceImpl.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/InitializationServiceImpl.java index 7a45d71e..4b0c04f4 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/InitializationServiceImpl.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/InitializationServiceImpl.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.service.impl; import java.io.File; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java index 80c45a2e..bb1e5f6f 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.service.impl; import java.util.List; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/StorageServiceImpl.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/StorageServiceImpl.java index f459ffc4..8c5e0778 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/StorageServiceImpl.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/StorageServiceImpl.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.service.impl; import java.io.File; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java index 51f78227..3becc779 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.service.impl; import java.util.List; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/AuthorizationUtil.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/AuthorizationUtil.java index f25f0db6..2711c3da 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/AuthorizationUtil.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/AuthorizationUtil.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.utils; import java.nio.charset.Charset; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java index 1d61d587..edf35d53 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/openecomp/portalapp/widget/utils/UnzipUtil.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.utils; import java.io.BufferedOutputStream; diff --git a/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetFileControllerTest.java b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetFileControllerTest.java index 2045435c..0ff2c573 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetFileControllerTest.java +++ b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetFileControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.test.controller; import static org.junit.Assert.assertEquals; diff --git a/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java index bd7eba3a..3d728c95 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java +++ b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.test.controller; diff --git a/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/service/WidgetCatalogServiceTest.java b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/service/WidgetCatalogServiceTest.java index 3def6062..92bcf805 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/service/WidgetCatalogServiceTest.java +++ b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/openecomp/portalapp/widget/test/service/WidgetCatalogServiceTest.java @@ -1,3 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * 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.openecomp.portalapp.widget.test.service; @@ -1,132 +1,155 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - - <groupId>org.openecomp.portal</groupId> - <artifactId>ecompportal-parent-project</artifactId> - <version>0</version> + + <parent> + <groupId>org.onap.oparent</groupId> + <artifactId>oparent</artifactId> + <version>0.1.1</version> + <relativePath /> + </parent> + + <groupId>org.onap.portal</groupId> + <artifactId>onap-portal-parent</artifactId> + <version>1.3.0-SNAPSHOT</version> <packaging>pom</packaging> <name>portal</name> - <properties> - <sonar.language>java</sonar.language> - <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> - <sonar.skipDesign>true</sonar.skipDesign> - <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath> - <sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath> - <sonar.jacoco.itReportPath>${project.basedir}/target/it-jacoco.exec</sonar.jacoco.itReportPath> - <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero> - <sonar.projectVersion>${project.version}</sonar.projectVersion> - <sonar.skipDesign>true</sonar.skipDesign> - <sonar.projectBaseDir>${project.basedir}</sonar.projectBaseDir> - <sonar.exclusions>**/scripts/**/*,**.js</sonar.exclusions> - <sonar.test.exclusions>**/test/**/*,**/tests/**/*</sonar.test.exclusions> - <sonar.java.binaries>.</sonar.java.binaries> - </properties> - - <modules> - <!-- Child modules do NOT name this parent. --> - <!-- Defined for build convenience only! --> - <!-- This POM names only ONAP projects --> + <modules> + <!-- This parent POM names only ONAP projects --> <module>ecomp-portal-BE-common</module> - <module>ecomp-portal-BE-os</module> -<!-- <module>ecomp-portal-BE-common-test</module> --> + <module>ecomp-portal-BE-os</module> <module>ecomp-portal-FE-os</module> <module>ecomp-portal-widget-ms</module> </modules> + <properties> + <!-- Jenkins SHOULD invoke mvn with argument -Dbuild.number=${BUILD_NUMBER} --> + <build.number>0</build.number> + <epsdk.version>1.3.0</epsdk.version> + <springframework.version>4.2.0.RELEASE</springframework.version> + <hibernate.version>4.3.11.Final</hibernate.version> + <fasterxml.version>2.7.4</fasterxml.version> + <eelf.version>1.0.0</eelf.version> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <encoding>UTF-8</encoding> + <sonar.language>java</sonar.language> + <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> + <sonar.skipDesign>true</sonar.skipDesign> + <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath> + <sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath> + <sonar.jacoco.itReportPath>${project.basedir}/target/it-jacoco.exec</sonar.jacoco.itReportPath> + <sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero> + <sonar.projectVersion>${project.version}</sonar.projectVersion> + <sonar.skipDesign>true</sonar.skipDesign> + <sonar.projectBaseDir>${project.basedir}</sonar.projectBaseDir> + <sonar.exclusions>**/scripts/**/*,**.js</sonar.exclusions> + <sonar.test.exclusions>**/test/**/*,**/tests/**/*</sonar.test.exclusions> + <sonar.java.binaries>.</sonar.java.binaries> + </properties> + + <!-- Specify the repositories here to avoid coordination of ~/.m2/settings.xml files + among all developers. Also use values (not properties) so oparent can be resolved. + --> + <repositories> + <repository> + <id>onap-releases</id> + <name>ONAP - Release Repository</name> + <url>https://nexus.onap.org/content/repositories/releases</url> + </repository> + <repository> + <id>onap-staging</id> + <name>ONAP - Staging Repository</name> + <url>https://nexus.onap.org/content/repositories/staging</url> + </repository> + <repository> + <id>onap-snapshots</id> + <name>ONAP - Snapshot Repository</name> + <url>https://nexus.onap.org/content/repositories/snapshots</url> + </repository> + <repository> + <id>onap-public</id> + <url>https://nexus.onap.org/content/groups/public</url> + </repository> + </repositories> + + <!-- Specify the repositories here to avoid coordination of ~/.m2/settings.xml files + among all developers. --> + <pluginRepositories> + <pluginRepository> + <id>onap-plugin-release</id> + <url>https://nexus.onap.org/content/repositories/releases/</url> + </pluginRepository> + <pluginRepository> + <id>onap-plugin-staging</id> + <url>https://nexus.onap.org/content/repositories/staging/</url> + </pluginRepository> + <pluginRepository> + <id>onap-plugin-snapshots</id> + <url>https://nexus.onap.org/content/repositories/snapshots/</url> + </pluginRepository> + </pluginRepositories> + + <profiles> + <!-- disable doclint, a new feature in Java 8, when generating javadoc --> + <profile> + <id>doclint-java8-disable</id> + <activation> + <jdk>[1.8,)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.0-M1</version> + <configuration> + <additionalparam>-Xdoclint:none</additionalparam> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + </profiles> + <build> <pluginManagement> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.1</version> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - <plugin> - <groupId>org.sonarsource.scanner.maven</groupId> - <artifactId>sonar-maven-plugin</artifactId> - <version>3.0.2</version> - </plugin> - </plugins> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.1</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + <plugin> + <groupId>org.sonarsource.scanner.maven</groupId> + <artifactId>sonar-maven-plugin</artifactId> + <version>3.0.2</version> + </plugin> + </plugins> </pluginManagement> <plugins> - <!-- No deployment step for this project --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-deploy-plugin</artifactId> - <version>2.8</version> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>0.7.6.201602180812</version> - <inherited>True</inherited> - <executions> - <!-- Unit-Tests --> - <execution> - <id>prepare-agent</id> - <goals> - <goal>prepare-agent</goal> - </goals> - <configuration> - <destFile>${sonar.jacoco.reportPath}</destFile> - </configuration> - </execution> - <execution> - <id>report</id> - <goals> - <goal>report</goal> - </goals> - <configuration> - <dataFile>${sonar.jacoco.reportPath}</dataFile> - <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory> - </configuration> - </execution> - <!-- Integration Tests (Only report goal) --> - <execution> - <id>report-integration</id> - <goals> - <goal>report-integration</goal> - </goals> - <configuration> - <dataFile>${sonar.jacoco.itReportPath}</dataFile> - <outputDirectory>${project.basedir}/target/site/it-jacoco</outputDirectory> - </configuration> - </execution> - <execution> - <id>default-instrument</id> - <goals> - <goal>instrument</goal> - </goals> - <configuration> - <skip>${skipTests}</skip> - </configuration> - </execution> - <execution> - <id>default-restore-instrumented-classes</id> - <goals> - <goal>restore-instrumented-classes</goal> - </goals> - <configuration> - <skip>${skipTests}</skip> - </configuration> - </execution> - </executions> - </plugin> - </plugins> -</build> - <dependencies> - <dependency> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>0.7.6.201602180812</version> - </dependency> - </dependencies> -</project>
\ No newline at end of file + <!-- No deployment step for this project --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> + + <distributionManagement> + <site> + <id>ecomp-site</id> + <url>dav:https://nexus.onap.org/content/sites/site/org/onap/portal/${project.version}</url> + </site> + </distributionManagement> + +</project> diff --git a/version.properties b/version.properties index 7f86aa15..a254b216 100644 --- a/version.properties +++ b/version.properties @@ -3,7 +3,7 @@ # because they are used in Jenkins, whose plug-in doesn't support major=1 -minor=1 +minor=3 patch=0 base_version=${major}.${minor}.${patch} |