From 8bb473147cb28f10f05de442237d0387c9810363 Mon Sep 17 00:00:00 2001 From: mhajas Date: Fri, 18 Aug 2017 11:18:19 +0200 Subject: [PATCH] KEYCLOAK-5312 Add preview profile assumption --- .../testsuite/admin/AuthzCleanupTest.java | 7 +++++++ .../AbstractPolicyManagementTest.java | 7 +++++++ .../testsuite/authz/AbstractAuthzTest.java | 16 ++++++++++++++++ .../authz/AuthzClientCredentialsTest.java | 2 +- .../authz/ConflictingScopePermissionTest.java | 2 +- .../testsuite/authz/EntitlementAPITest.java | 2 +- .../testsuite/authz/GroupNamePolicyTest.java | 2 +- .../testsuite/authz/GroupPathPolicyTest.java | 2 +- .../authz/PolicyEvaluationCompositeRoleTest.java | 9 ++++++--- .../authz/RequireUmaAuthorizationScopeTest.java | 2 +- .../keycloak/testsuite/authz/RolePolicyTest.java | 2 +- .../AbstractAuthorizationSettingsTest.java | 7 +++++++ 12 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/AbstractAuthzTest.java diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/AuthzCleanupTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/AuthzCleanupTest.java index 4c472fba5f..5adec447e8 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/AuthzCleanupTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/AuthzCleanupTest.java @@ -22,6 +22,7 @@ import java.util.List; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.BeforeClass; import org.junit.Test; import org.keycloak.admin.client.resource.ClientsResource; import org.keycloak.authorization.AuthorizationProvider; @@ -37,6 +38,7 @@ import org.keycloak.representations.idm.authorization.Logic; import org.keycloak.representations.idm.authorization.ResourceServerRepresentation; import org.keycloak.representations.idm.authorization.RolePolicyRepresentation; import org.keycloak.testsuite.AbstractKeycloakTest; +import org.keycloak.testsuite.ProfileAssume; import org.keycloak.testsuite.runonserver.RunOnServerDeployment; import org.keycloak.testsuite.util.ClientBuilder; import org.keycloak.testsuite.util.RealmBuilder; @@ -48,6 +50,11 @@ import org.keycloak.util.JsonSerialization; */ public class AuthzCleanupTest extends AbstractKeycloakTest { + @BeforeClass + public static void enabled() { + ProfileAssume.assumePreview(); + } + @Deployment public static WebArchive deploy() { return RunOnServerDeployment.create(); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/authorization/AbstractPolicyManagementTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/authorization/AbstractPolicyManagementTest.java index 41f3890f6c..77045a1072 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/authorization/AbstractPolicyManagementTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/client/authorization/AbstractPolicyManagementTest.java @@ -31,6 +31,7 @@ import java.util.function.Supplier; import javax.ws.rs.core.Response; import org.junit.Before; +import org.junit.BeforeClass; import org.keycloak.admin.client.resource.ClientResource; import org.keycloak.admin.client.resource.ClientsResource; import org.keycloak.admin.client.resource.RealmResource; @@ -41,6 +42,7 @@ import org.keycloak.representations.idm.authorization.ResourceRepresentation; import org.keycloak.representations.idm.authorization.ScopeRepresentation; import org.keycloak.representations.idm.authorization.UserPolicyRepresentation; import org.keycloak.testsuite.AbstractKeycloakTest; +import org.keycloak.testsuite.ProfileAssume; import org.keycloak.testsuite.util.ClientBuilder; import org.keycloak.testsuite.util.RealmBuilder; import org.keycloak.testsuite.util.UserBuilder; @@ -50,6 +52,11 @@ import org.keycloak.testsuite.util.UserBuilder; */ public abstract class AbstractPolicyManagementTest extends AbstractKeycloakTest { + @BeforeClass + public static void enabled() { + ProfileAssume.assumePreview(); + } + @Override public void addTestRealms(List testRealms) { testRealms.add(createTestRealm().build()); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/AbstractAuthzTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/AbstractAuthzTest.java new file mode 100644 index 0000000000..00917cd6d7 --- /dev/null +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/AbstractAuthzTest.java @@ -0,0 +1,16 @@ +package org.keycloak.testsuite.authz; + +import org.junit.BeforeClass; +import org.keycloak.testsuite.AbstractKeycloakTest; +import org.keycloak.testsuite.ProfileAssume; + +/** + * @author mhajas + */ +public abstract class AbstractAuthzTest extends AbstractKeycloakTest { + + @BeforeClass + public static void enabled() { + ProfileAssume.assumePreview(); + } +} diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/AuthzClientCredentialsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/AuthzClientCredentialsTest.java index 2e9086a2b3..38a194dd2a 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/AuthzClientCredentialsTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/AuthzClientCredentialsTest.java @@ -64,7 +64,7 @@ import org.keycloak.testsuite.util.UserBuilder; * @author Bill Burke * @version $Revision: 1 $ */ -public class AuthzClientCredentialsTest extends AbstractKeycloakTest { +public class AuthzClientCredentialsTest extends AbstractAuthzTest { @Override public void addTestRealms(List testRealms) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/ConflictingScopePermissionTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/ConflictingScopePermissionTest.java index 450820ed5e..d7f8c6bb53 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/ConflictingScopePermissionTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/ConflictingScopePermissionTest.java @@ -59,7 +59,7 @@ import org.keycloak.util.JsonSerialization; * @author Bill Burke * @version $Revision: 1 $ */ -public class ConflictingScopePermissionTest extends AbstractKeycloakTest { +public class ConflictingScopePermissionTest extends AbstractAuthzTest { @Override public void addTestRealms(List testRealms) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/EntitlementAPITest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/EntitlementAPITest.java index 0f2ac61da4..2145c6f82e 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/EntitlementAPITest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/EntitlementAPITest.java @@ -58,7 +58,7 @@ import org.keycloak.util.JsonSerialization; /** * @author Pedro Igor */ -public class EntitlementAPITest extends AbstractKeycloakTest { +public class EntitlementAPITest extends AbstractAuthzTest { private AuthzClient authzClient; diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupNamePolicyTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupNamePolicyTest.java index cc4b9118f9..256c24c69b 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupNamePolicyTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupNamePolicyTest.java @@ -63,7 +63,7 @@ import org.keycloak.util.JsonSerialization; /** * @author Pedro Igor */ -public class GroupNamePolicyTest extends AbstractKeycloakTest { +public class GroupNamePolicyTest extends AbstractAuthzTest { @Override public void addTestRealms(List testRealms) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupPathPolicyTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupPathPolicyTest.java index 19f74b42fc..9b3b72862c 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupPathPolicyTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/GroupPathPolicyTest.java @@ -66,7 +66,7 @@ import org.keycloak.util.JsonSerialization; /** * @author Pedro Igor */ -public class GroupPathPolicyTest extends AbstractKeycloakTest { +public class GroupPathPolicyTest extends AbstractAuthzTest { @Override public void addTestRealms(List testRealms) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/PolicyEvaluationCompositeRoleTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/PolicyEvaluationCompositeRoleTest.java index e5f84e26dc..cb93c96f02 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/PolicyEvaluationCompositeRoleTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/PolicyEvaluationCompositeRoleTest.java @@ -19,6 +19,7 @@ package org.keycloak.testsuite.authz; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; import org.keycloak.admin.client.resource.RealmResource; import org.keycloak.authorization.AuthorizationProvider; @@ -42,6 +43,7 @@ import org.keycloak.representations.idm.authorization.PolicyEvaluationResponse; import org.keycloak.representations.idm.authorization.PolicyRepresentation; import org.keycloak.representations.idm.authorization.ScopePermissionRepresentation; import org.keycloak.testsuite.AbstractKeycloakTest; +import org.keycloak.testsuite.ProfileAssume; import org.keycloak.testsuite.runonserver.RunOnServerDeployment; import java.util.HashMap; @@ -54,7 +56,8 @@ import static org.keycloak.testsuite.auth.page.AuthRealm.TEST; * @author Bill Burke * @version $Revision: 1 $ */ -public class PolicyEvaluationCompositeRoleTest extends AbstractKeycloakTest { +public class PolicyEvaluationCompositeRoleTest extends AbstractAuthzTest { + @Override public void addTestRealms(List testRealms) { RealmRepresentation testRealmRep = new RealmRepresentation(); @@ -63,10 +66,10 @@ public class PolicyEvaluationCompositeRoleTest extends AbstractKeycloakTest { testRealmRep.setEnabled(true); testRealms.add(testRealmRep); } - + @Deployment public static WebArchive deploy() { - return RunOnServerDeployment.create(); + return RunOnServerDeployment.create(AbstractAuthzTest.class); } public static void setup(KeycloakSession session) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/RequireUmaAuthorizationScopeTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/RequireUmaAuthorizationScopeTest.java index cf54a66a62..0b24c2aeaf 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/RequireUmaAuthorizationScopeTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/RequireUmaAuthorizationScopeTest.java @@ -55,7 +55,7 @@ import org.keycloak.util.JsonSerialization; /** * @author Pedro Igor */ -public class RequireUmaAuthorizationScopeTest extends AbstractKeycloakTest { +public class RequireUmaAuthorizationScopeTest extends AbstractAuthzTest { @Override public void addTestRealms(List testRealms) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/RolePolicyTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/RolePolicyTest.java index 93aa5ca209..994e52e835 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/RolePolicyTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/authz/RolePolicyTest.java @@ -59,7 +59,7 @@ import org.keycloak.util.JsonSerialization; /** * @author Pedro Igor */ -public class RolePolicyTest extends AbstractKeycloakTest { +public class RolePolicyTest extends AbstractAuthzTest { @Override public void addTestRealms(List testRealms) { diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/AbstractAuthorizationSettingsTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/AbstractAuthorizationSettingsTest.java index 276985e190..de199f7834 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/AbstractAuthorizationSettingsTest.java +++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/AbstractAuthorizationSettingsTest.java @@ -22,7 +22,9 @@ import static org.keycloak.testsuite.auth.page.login.Login.OIDC; import org.jboss.arquillian.graphene.page.Page; import org.junit.Before; +import org.junit.BeforeClass; import org.keycloak.representations.idm.ClientRepresentation; +import org.keycloak.testsuite.ProfileAssume; import org.keycloak.testsuite.console.clients.AbstractClientTest; import org.keycloak.testsuite.console.page.clients.authorization.Authorization; import org.keycloak.testsuite.console.page.clients.settings.ClientSettings; @@ -41,6 +43,11 @@ public abstract class AbstractAuthorizationSettingsTest extends AbstractClientTe protected ClientRepresentation newClient; + @BeforeClass + public static void enabled() { + ProfileAssume.assumePreview(); + } + @Before public void configureTest() { this.newClient = createResourceServer();