keycloak-uncached

Merge pull request #4505 from mhajas/KEYCLOAK-5568 KEYCLOAK-5568

10/4/2017 3:02:31 AM

Details

diff --git a/testsuite/integration-arquillian/servers/app-server/jboss/common/install-adapters.sh b/testsuite/integration-arquillian/servers/app-server/jboss/common/install-adapters.sh
index bd9e65b..d170a1e 100755
--- a/testsuite/integration-arquillian/servers/app-server/jboss/common/install-adapters.sh
+++ b/testsuite/integration-arquillian/servers/app-server/jboss/common/install-adapters.sh
@@ -26,6 +26,8 @@ do
 
         if [ "$ELYTRON_SUPPORTED" = true ]; then
             ./jboss-cli.sh -c --file="adapter-elytron-install.cli"
+        else
+            ./jboss-cli.sh -c --command="/subsystem=elytron:remove"
         fi
 
         if [ $? -ne 0 ]; then RESULT=1; fi
diff --git a/testsuite/integration-arquillian/tests/other/adapters/jboss/wildfly/src/test/java/org/keycloak/testsuite/adapter/example/hal/WildflyConsoleProtectionTest.java b/testsuite/integration-arquillian/tests/other/adapters/jboss/wildfly/src/test/java/org/keycloak/testsuite/adapter/example/hal/WildflyConsoleProtectionTest.java
index 8057da7..ce2ab8d 100644
--- a/testsuite/integration-arquillian/tests/other/adapters/jboss/wildfly/src/test/java/org/keycloak/testsuite/adapter/example/hal/WildflyConsoleProtectionTest.java
+++ b/testsuite/integration-arquillian/tests/other/adapters/jboss/wildfly/src/test/java/org/keycloak/testsuite/adapter/example/hal/WildflyConsoleProtectionTest.java
@@ -19,20 +19,25 @@ package org.keycloak.testsuite.adapter.example.hal;
 import static org.junit.Assert.assertTrue;
 import static org.keycloak.testsuite.util.IOUtil.loadRealm;
 
+import java.io.IOException;
 import java.util.List;
 
 import org.jboss.arquillian.graphene.page.Page;
+import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Test;
 import org.keycloak.representations.idm.RealmRepresentation;
 import org.keycloak.testsuite.adapter.AbstractAdapterTest;
+import org.keycloak.testsuite.arquillian.AppServerTestEnricher;
 import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
 import org.keycloak.testsuite.pages.AccountUpdateProfilePage;
 import org.keycloak.testsuite.pages.AppServerWelcomePage;
 import org.keycloak.testsuite.util.WaitUtils;
-import org.wildfly.extras.creaper.core.ManagementClient;
+import org.wildfly.extras.creaper.core.online.CliException;
 import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
-import org.wildfly.extras.creaper.core.online.OnlineOptions;
+import org.wildfly.extras.creaper.core.online.operations.Address;
+import org.wildfly.extras.creaper.core.online.operations.OperationException;
+import org.wildfly.extras.creaper.core.online.operations.Operations;
 
 /**
  *
@@ -54,14 +59,17 @@ public class WildflyConsoleProtectionTest extends AbstractAdapterTest {
     }
 
     @Before
-    public void beforeAuthTest() {
+    public void beforeAuthTest() throws IOException, OperationException {
         super.beforeAuthTest();
 
+        OnlineManagementClient clientWorkerNodeClient = null;
+
         try {
-            OnlineManagementClient clientWorkerNodeClient = ManagementClient.online(OnlineOptions
-                    .standalone()
-                    .hostAndPort("localhost", 10190)
-                    .build());
+            clientWorkerNodeClient = AppServerTestEnricher.getManagementClient();
+
+            Operations operations = new Operations(clientWorkerNodeClient);
+
+            Assume.assumeTrue(operations.exists(Address.subsystem("elytron")));
 
             // Create a realm for both wildfly console and mgmt interface
             clientWorkerNodeClient.execute("/subsystem=keycloak/realm=jboss-infra:add(auth-server-url=http://localhost:8180/auth,realm-public-key=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB)");
@@ -84,8 +92,12 @@ public class WildflyConsoleProtectionTest extends AbstractAdapterTest {
 
             // reload
             clientWorkerNodeClient.execute("reload");
-        } catch (Exception cause) {
+        } catch (CliException cause) {
             throw new RuntimeException("Failed to configure app server", cause);
+        } finally {
+            if (clientWorkerNodeClient != null) {
+                clientWorkerNodeClient.close();
+            }
         }
     }