diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-08-04 14:16:00 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2020-09-08 13:45:31 +0200 |
commit | 30670accb070b20c1c770d1ebbd6d72e24fee2db (patch) | |
tree | 8ddb5d70500aa1b3baa4e262de411e8394e22e6a /catalog-be/src | |
parent | a8a96339680fa1c4df5577285442e902b5637631 (diff) |
Upgrade to java 11
MOve SDC to Java 11, this is one of the PR to move to Jdk 11, jenkins will have to be changed as well
Issue-ID: SDC-2725
Change-Id: I85f13f14ba8004f6e9656093a837465a2e4af3e1
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Signed-off-by: xuegao <xg353y@intl.att.com>
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'catalog-be/src')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java index c488a9a6ca..30a123dcad 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/aaf/RoleAuthorizationHandlerTest.java @@ -22,8 +22,9 @@ package org.openecomp.sdc.be.impl.aaf; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.Signature; +import org.hibernate.validator.internal.util.annotationfactory.AnnotationDescriptor; +import org.hibernate.validator.internal.util.annotationfactory.AnnotationFactory; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -36,15 +37,12 @@ import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.servlets.BeGenericServlet; -import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.FilterDecisionEnum; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.openecomp.sdc.common.util.ThreadLocalsHolder; -import sun.reflect.annotation.AnnotationParser; import javax.servlet.http.HttpServletRequest; -import java.util.Collections; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.catchThrowable; @@ -78,8 +76,9 @@ public class RoleAuthorizationHandlerTest { @Test public void testAuthorizeRoleOnePermittedRole() { String[] permsAllowed = {AafPermission.PermNames.WRITE_VALUE}; - PermissionAllowed rolesAllowed = - (PermissionAllowed) AnnotationParser.annotationForMap(PermissionAllowed.class, Collections.singletonMap("value", permsAllowed)); + AnnotationDescriptor<PermissionAllowed> permissionDescriptor = new AnnotationDescriptor<PermissionAllowed>(PermissionAllowed.class); + permissionDescriptor.setValue("value", permsAllowed); + PermissionAllowed rolesAllowed = (PermissionAllowed) AnnotationFactory.create(permissionDescriptor); when(httpServletRequest.isUserInRole(AafPermission.getEnumByString(permsAllowed[0]).getFullPermission())) .thenReturn(true); roleAuthorizationHandler.authorizeRole(joinPoint, rolesAllowed); @@ -88,8 +87,9 @@ public class RoleAuthorizationHandlerTest { @Test public void testAuthorizeRoleTwoPermittedRole() { String[] permsAllowed = {AafPermission.PermNames.WRITE_VALUE, AafPermission.PermNames.READ_VALUE}; - PermissionAllowed rolesAllowed = - (PermissionAllowed) AnnotationParser.annotationForMap(PermissionAllowed.class, Collections.singletonMap("value", permsAllowed)); + AnnotationDescriptor<PermissionAllowed> permissionDescriptor = new AnnotationDescriptor<PermissionAllowed>(PermissionAllowed.class); + permissionDescriptor.setValue("value", permsAllowed); + PermissionAllowed rolesAllowed = (PermissionAllowed)AnnotationFactory.create(permissionDescriptor); when(httpServletRequest.isUserInRole(AafPermission.getEnumByString(permsAllowed[0]).getFullPermission())) .thenReturn(true); roleAuthorizationHandler.authorizeRole(joinPoint, rolesAllowed); @@ -98,8 +98,9 @@ public class RoleAuthorizationHandlerTest { @Test public void testAuthorizeRoleNonPermittedRole() { String[] permsAllowed = {AafPermission.PermNames.WRITE_VALUE, AafPermission.PermNames.READ_VALUE}; - PermissionAllowed rolesAllowed = - (PermissionAllowed) AnnotationParser.annotationForMap(PermissionAllowed.class, Collections.singletonMap("value", permsAllowed)); + AnnotationDescriptor<PermissionAllowed> permissionDescriptor = new AnnotationDescriptor<PermissionAllowed>(PermissionAllowed.class); + permissionDescriptor.setValue("value", permsAllowed); + PermissionAllowed rolesAllowed = (PermissionAllowed)AnnotationFactory.create(permissionDescriptor); when(httpServletRequest.isUserInRole(AafPermission.getEnumByString(permsAllowed[0]).getFullPermission())) .thenReturn(false); @@ -110,8 +111,9 @@ public class RoleAuthorizationHandlerTest { @Test public void testAuthorizeRoleEmptyRole() { String[] permsAllowed = {}; - PermissionAllowed rolesAllowed = - (PermissionAllowed) AnnotationParser.annotationForMap(PermissionAllowed.class, Collections.singletonMap("value", permsAllowed)); + AnnotationDescriptor<PermissionAllowed> permissionDescriptor = new AnnotationDescriptor<PermissionAllowed>(PermissionAllowed.class); + permissionDescriptor.setValue("value", permsAllowed); + PermissionAllowed rolesAllowed = (PermissionAllowed)AnnotationFactory.create(permissionDescriptor); ComponentException thrown = (ComponentException) catchThrowable(()->roleAuthorizationHandler.authorizeRole(joinPoint, rolesAllowed)); assertThat(thrown.getActionStatus()).isEqualTo(ActionStatus.AUTH_FAILED); |