keycloak-aplcache

Details

diff --git a/testsuite/integration-arquillian/tests/adapters/as7/pom.xml b/testsuite/integration-arquillian/tests/adapters/as7/pom.xml
index b63ae88..88e4732 100644
--- a/testsuite/integration-arquillian/tests/adapters/as7/pom.xml
+++ b/testsuite/integration-arquillian/tests/adapters/as7/pom.xml
@@ -23,12 +23,6 @@
             <groupId>org.wildfly</groupId>
             <artifactId>wildfly-arquillian-container-managed</artifactId>
         </dependency>
-        <!--for as7-->
-        <dependency>
-            <groupId>org.jboss.as</groupId>
-            <artifactId>jboss-as-arquillian-container-managed</artifactId>
-            <version>${as7.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.jboss.as</groupId>
             <artifactId>jboss-as-dist</artifactId>
diff --git a/testsuite/integration-arquillian/tests/adapters/eap6/pom.xml b/testsuite/integration-arquillian/tests/adapters/eap6/pom.xml
index cc82d36..c74baa6 100644
--- a/testsuite/integration-arquillian/tests/adapters/eap6/pom.xml
+++ b/testsuite/integration-arquillian/tests/adapters/eap6/pom.xml
@@ -19,16 +19,16 @@
 
     <dependencies>
         <!-- This dependency is for starting auth server based on wildfly (eap7)-->
-<!--        <dependency>
+        <dependency>
             <groupId>org.wildfly</groupId>
             <artifactId>wildfly-arquillian-container-managed</artifactId>
-        </dependency>-->
+        </dependency>
         <!-- This is for EAP6-->
-        <dependency>
+<!--        <dependency>
             <groupId>org.jboss.as</groupId>
             <artifactId>jboss-as-arquillian-container-managed</artifactId>
             <version>7.2.0.Final</version>
-        </dependency>
+        </dependency>-->
         <dependency>
             <groupId>org.jboss.as</groupId>
             <artifactId>jboss-as-dist</artifactId>
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/ContainersTestEnricher.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/ContainersTestEnricher.java
index 2512d1c..b2175d3 100644
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/ContainersTestEnricher.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/ContainersTestEnricher.java
@@ -127,60 +127,7 @@ public class ContainersTestEnricher {
             alreadyStopped = true;
         }
         
-        if (!alreadyInstalled && !skipInstallAdapters && isJBossBased(container)) {
-            String jbossCliPath = jbossHomePath + "/bin/jboss-cli.sh";
-            String adapterScriptPathArg = "--file=" + jbossHomePath + "/bin/adapter-install.cli";
-            String samlAdapterScriptPathArg = "--file=" + jbossHomePath + "/bin/adapter-install-saml.cli";
-            String managementPort = container.getContainerConfiguration().getContainerProperties().get("managementPort");
-            String controllerArg = "--controller=localhost:" + managementPort;
-
-            log.info("Installing adapter to app server via cli script");
-            execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", adapterScriptPathArg, controllerArg});
-            log.info("Installing saml adapter to app server via cli script");
-            execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", samlAdapterScriptPathArg, controllerArg});
-            log.info("Restarting container");
-            execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", "--command=:reload", controllerArg});
-            pause(5000);
-            log.info("Container restarted");
-            checkServerLog(jbossHomePath);
-            if (container.getName().startsWith("app-server")) {
-                alreadyInstalled = true;
-            }
-        }
-    }
-
-    private void execCommand(String... command) throws IOException, InterruptedException {
-        Process process = Runtime.getRuntime().exec(command);
-
-        if (process.waitFor(10, TimeUnit.SECONDS)) {
-            if (process.exitValue() != 0) {
-                throw new RuntimeException("Adapter installation failed. Process exitValue: " 
-                        + process.exitValue() + "; <error output>\n" + getOutput(process.getErrorStream()) 
-                        + "</error output>");
-            }
-            log.debug("process.isAlive(): " + process.isAlive());
-        } else {
-            process.destroyForcibly();
-            throw new RuntimeException("Timeout after 10 seconds.");
-        }
-    }
-
-    private String getOutput(InputStream is) throws IOException {
-        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
-        StringBuilder builder = new StringBuilder();
-        while (reader.ready()) {
-            builder.append(reader.readLine());
-        }
-        return builder.toString();
-    }
-
-    private boolean isJBossBased(Container container) {
-        if (container == null) {
-            return false;
-        }
-        return container.getName().matches("a.*-server-wildfly")
-                || container.getName().matches("a.*-server-eap.")
-                || container.getName().equals("app-server-as7");
+        installAdapters(container);
     }
 
     /*
@@ -326,4 +273,60 @@ public class ContainersTestEnricher {
         return "http://localhost:" + Integer.parseInt(System.getProperty("app.server.http.port", "8280"));
     }
 
+    private void installAdapters(Container container) throws InterruptedException, IOException {
+        if (!alreadyInstalled && !skipInstallAdapters && isJBossBased(container)) {
+            String jbossCliPath = jbossHomePath + "/bin/jboss-cli.sh";
+            String adapterScriptPathArg = "--file=" + jbossHomePath + "/bin/adapter-install.cli";
+            String samlAdapterScriptPathArg = "--file=" + jbossHomePath + "/bin/adapter-install-saml.cli";
+            String managementPort = container.getContainerConfiguration().getContainerProperties().get("managementPort");
+            String controllerArg = "--controller=localhost:" + managementPort;
+
+            log.info("Installing adapter to app server via cli script");
+            execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", adapterScriptPathArg, controllerArg});
+            log.info("Installing saml adapter to app server via cli script");
+            execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", samlAdapterScriptPathArg, controllerArg});
+            log.info("Restarting container");
+            execCommand(new String[]{"/bin/sh", jbossCliPath, "--connect", "--command=:reload", controllerArg});
+            pause(5000);
+            log.info("Container restarted");
+            checkServerLog(jbossHomePath);
+            if (container.getName().startsWith("app-server")) {
+                alreadyInstalled = true;
+            }
+        }
+    }
+
+    private void execCommand(String... command) throws IOException, InterruptedException {
+        Process process = Runtime.getRuntime().exec(command);
+
+        if (process.waitFor(10, TimeUnit.SECONDS)) {
+            if (process.exitValue() != 0) {
+                throw new RuntimeException("Adapter installation failed. Process exitValue: " 
+                        + process.exitValue() + "; <error output>\n" + getOutput(process.getErrorStream()) 
+                        + "</error output>");
+            }
+            log.debug("process.isAlive(): " + process.isAlive());
+        } else {
+            process.destroyForcibly();
+            throw new RuntimeException("Timeout after 10 seconds.");
+        }
+    }
+
+    private String getOutput(InputStream is) throws IOException {
+        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+        StringBuilder builder = new StringBuilder();
+        while (reader.ready()) {
+            builder.append(reader.readLine());
+        }
+        return builder.toString();
+    }
+
+    private boolean isJBossBased(Container container) {
+        if (container == null) {
+            return false;
+        }
+        return container.getName().matches("a.*-server-wildfly")
+                || container.getName().matches("a.*-server-eap.")
+                || container.getName().equals("app-server-as7");
+    }
 }