KEYCLOAK-7718 DemoFilterServletAdapterTest test not configured correctly
This commit is contained in:
parent
5f0c86a49f
commit
9039b44f4d
16 changed files with 219 additions and 11 deletions
|
@ -0,0 +1,35 @@
|
||||||
|
set NOPAUSE=true
|
||||||
|
|
||||||
|
start "JBoss Server" /b cmd /c %JBOSS_HOME%\bin\standalone.bat -Djboss.server.config.dir=%JBOSS_HOME%\standalone-secured-deployments\configuration
|
||||||
|
|
||||||
|
set ERROR=0
|
||||||
|
set TIMEOUT=10
|
||||||
|
set I=0
|
||||||
|
|
||||||
|
ping 127.0.0.1 -n 3 > nul
|
||||||
|
|
||||||
|
|
||||||
|
:wait_for_jboss
|
||||||
|
call %JBOSS_HOME%\bin\jboss-cli.bat -c --command=":read-attribute(name=server-state)" | findstr "running"
|
||||||
|
if %ERRORLEVEL% equ 0 goto add_secured_deployments
|
||||||
|
ping 127.0.0.1 -n 1 > nul
|
||||||
|
set /a I=%I%+1
|
||||||
|
if %I% gtr %TIMEOUT% (
|
||||||
|
set ERROR=1
|
||||||
|
goto shutdown_jboss
|
||||||
|
)
|
||||||
|
goto wait_for_jboss
|
||||||
|
|
||||||
|
|
||||||
|
:add_secured_deployments
|
||||||
|
call %JBOSS_HOME%\bin\jboss-cli.bat -c --file="%CLI_PATH%\add-secured-deployments.cli"
|
||||||
|
set ERROR=%ERRORLEVEL%
|
||||||
|
echo Error code: "%ERROR%"
|
||||||
|
if %ERROR% neq 0 (
|
||||||
|
goto shutdown_jboss
|
||||||
|
)
|
||||||
|
|
||||||
|
:shutdown_jboss
|
||||||
|
echo Shutting down with error code: "%ERROR%"
|
||||||
|
call %JBOSS_HOME%\bin\jboss-cli.bat -c --command=":shutdown"
|
||||||
|
exit /b %ERROR%
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "JBOSS_HOME=$JBOSS_HOME"
|
||||||
|
|
||||||
|
if [ ! -d "$JBOSS_HOME/bin" ] ; then
|
||||||
|
>&2 echo "JBOSS_HOME/bin doesn't exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $JBOSS_HOME/bin
|
||||||
|
|
||||||
|
./standalone.sh -Djboss.server.config.dir=$JBOSS_HOME/standalone-secured-deployments/configuration &
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
TIMEOUT=10
|
||||||
|
DELAY=1
|
||||||
|
T=0
|
||||||
|
|
||||||
|
RESULT=0
|
||||||
|
|
||||||
|
until [ $T -gt $TIMEOUT ]
|
||||||
|
do
|
||||||
|
if ./jboss-cli.sh -c --command=":read-attribute(name=server-state)" | grep -q "running" ; then
|
||||||
|
echo "Server is running. Adding secured deployments"
|
||||||
|
|
||||||
|
./jboss-cli.sh -c --file="$CLI_PATH/add-secured-deployments.cli"
|
||||||
|
RESULT=$?
|
||||||
|
echo "Return code:"${RESULT}
|
||||||
|
|
||||||
|
./jboss-cli.sh -c --command=":shutdown"
|
||||||
|
rm -rf $JBOSS_HOME/standalone/data
|
||||||
|
rm -rf $JBOSS_HOME/standalone/log
|
||||||
|
|
||||||
|
echo "Exiting with return code: "$RESULT
|
||||||
|
exit $RESULT
|
||||||
|
fi
|
||||||
|
echo "Server is not running."
|
||||||
|
sleep $DELAY
|
||||||
|
let T=$T+$DELAY
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 1
|
|
@ -39,7 +39,6 @@ if "%SAML_SUPPORTED%" == "true" (
|
||||||
)
|
)
|
||||||
|
|
||||||
call %JBOSS_HOME%\bin\jboss-cli.bat -c --file="%CLI_PATH%\add-adapter-log-level.cli"
|
call %JBOSS_HOME%\bin\jboss-cli.bat -c --file="%CLI_PATH%\add-adapter-log-level.cli"
|
||||||
call %JBOSS_HOME%\bin\jboss-cli.bat -c --file="%CLI_PATH%\add-secured-deployments.cli"
|
|
||||||
|
|
||||||
:shutdown_jboss
|
:shutdown_jboss
|
||||||
echo Shutting down with error code: "%ERROR%"
|
echo Shutting down with error code: "%ERROR%"
|
||||||
|
|
|
@ -33,7 +33,6 @@ do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./jboss-cli.sh -c --file="$CLI_PATH/add-adapter-log-level.cli"
|
./jboss-cli.sh -c --file="$CLI_PATH/add-adapter-log-level.cli"
|
||||||
./jboss-cli.sh -c --file="$CLI_PATH/add-secured-deployments.cli"
|
|
||||||
|
|
||||||
./jboss-cli.sh -c --command=":shutdown"
|
./jboss-cli.sh -c --command=":shutdown"
|
||||||
rm -rf $JBOSS_HOME/standalone/data
|
rm -rf $JBOSS_HOME/standalone/data
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class EAPAppServerProvider implements AppServerContainerProvider {
|
||||||
createChild("jbossHome", appServerHome);
|
createChild("jbossHome", appServerHome);
|
||||||
createChild("javaHome", appServerJavaHome);
|
createChild("javaHome", appServerJavaHome);
|
||||||
createChild("jbossArguments",
|
createChild("jbossArguments",
|
||||||
|
"-Djboss.server.base.dir=" + appServerHome + "/standalone-test " +
|
||||||
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
|
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
|
||||||
System.getProperty("adapter.test.props", " ") +
|
System.getProperty("adapter.test.props", " ") +
|
||||||
System.getProperty("kie.maven.settings", " ")
|
System.getProperty("kie.maven.settings", " ")
|
||||||
|
|
|
@ -118,6 +118,22 @@
|
||||||
</environmentVariables>
|
</environmentVariables>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>add-secured-deployments-eap6</id>
|
||||||
|
<phase>generate-test-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>exec</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<executable>${common.resources}/add-secured-deployments.${script.suffix}</executable>
|
||||||
|
<workingDirectory>${app.server.jboss.home}/bin</workingDirectory>
|
||||||
|
<environmentVariables>
|
||||||
|
<JAVA_HOME>${app.server.java.home}</JAVA_HOME>
|
||||||
|
<JBOSS_HOME>${app.server.jboss.home}</JBOSS_HOME>
|
||||||
|
<CLI_PATH>${common.resources}/cli/eap6/</CLI_PATH>
|
||||||
|
</environmentVariables>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class EAP6AppServerProvider implements AppServerContainerProvider {
|
||||||
createChild("jbossHome", appServerHome);
|
createChild("jbossHome", appServerHome);
|
||||||
createChild("javaHome", appServerJavaHome);
|
createChild("javaHome", appServerJavaHome);
|
||||||
createChild("jbossArguments",
|
createChild("jbossArguments",
|
||||||
|
"-Djboss.server.base.dir=" + appServerHome + "/standalone-test " +
|
||||||
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
|
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
|
||||||
System.getProperty("adapter.test.props", " ") +
|
System.getProperty("adapter.test.props", " ") +
|
||||||
System.getProperty("kie.maven.settings", " ")
|
System.getProperty("kie.maven.settings", " ")
|
||||||
|
|
|
@ -204,6 +204,21 @@
|
||||||
</resources>
|
</resources>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>copy-configs-secured-deployments</id>
|
||||||
|
<phase>generate-test-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${app.server.jboss.home}/standalone-secured-deployments</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${app.server.jboss.home}/standalone</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
<id>copy-configs-crossdc</id>
|
<id>copy-configs-crossdc</id>
|
||||||
<phase>generate-test-sources</phase>
|
<phase>generate-test-sources</phase>
|
||||||
|
@ -393,7 +408,7 @@
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
<id>add-secured-deployments</id>
|
<id>add-secured-deployments</id>
|
||||||
<phase>process-resources</phase>
|
<phase>generate-test-sources</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>exec</goal>
|
<goal>exec</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
@ -403,6 +418,7 @@
|
||||||
<executable>./jboss-cli.sh</executable>
|
<executable>./jboss-cli.sh</executable>
|
||||||
<arguments>
|
<arguments>
|
||||||
<argument>--file=${common.resources}/cli/add-secured-deployments.cli</argument>
|
<argument>--file=${common.resources}/cli/add-secured-deployments.cli</argument>
|
||||||
|
<argument>-Djboss.server.config.dir=${app.server.jboss.home}/standalone-secured-deployments/configuration</argument>
|
||||||
</arguments>
|
</arguments>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class WildflyAppServerProvider implements AppServerContainerProvider {
|
||||||
createChild("jbossHome", appServerHome);
|
createChild("jbossHome", appServerHome);
|
||||||
createChild("javaHome", appServerJavaHome);
|
createChild("javaHome", appServerJavaHome);
|
||||||
createChild("jbossArguments",
|
createChild("jbossArguments",
|
||||||
|
"-Djboss.server.base.dir=" + appServerHome + "/standalone-test " +
|
||||||
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
|
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
|
||||||
System.getProperty("adapter.test.props", " ") +
|
System.getProperty("adapter.test.props", " ") +
|
||||||
System.getProperty("kie.maven.settings", " ")
|
System.getProperty("kie.maven.settings", " ")
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class Wildfly10AppServerProvider implements AppServerContainerProvider {
|
||||||
createChild("jbossHome", appServerHome);
|
createChild("jbossHome", appServerHome);
|
||||||
createChild("javaHome", appServerJavaHome);
|
createChild("javaHome", appServerJavaHome);
|
||||||
createChild("jbossArguments",
|
createChild("jbossArguments",
|
||||||
|
"-Djboss.server.base.dir=" + appServerHome + "/standalone-test " +
|
||||||
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
|
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
|
||||||
System.getProperty("adapter.test.props", " ") +
|
System.getProperty("adapter.test.props", " ") +
|
||||||
System.getProperty("kie.maven.settings", " ")
|
System.getProperty("kie.maven.settings", " ")
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class Wildfly9AppServerProvider implements AppServerContainerProvider {
|
||||||
createChild("jbossHome", appServerHome);
|
createChild("jbossHome", appServerHome);
|
||||||
createChild("javaHome", appServerJavaHome);
|
createChild("javaHome", appServerJavaHome);
|
||||||
createChild("jbossArguments",
|
createChild("jbossArguments",
|
||||||
|
"-Djboss.server.base.dir=" + appServerHome + "/standalone-test " +
|
||||||
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
|
"-Djboss.socket.binding.port-offset=" + appServerPortOffset + " " +
|
||||||
System.getProperty("adapter.test.props", " ") +
|
System.getProperty("adapter.test.props", " ") +
|
||||||
System.getProperty("kie.maven.settings", " ")
|
System.getProperty("kie.maven.settings", " ")
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.arquillian;
|
package org.keycloak.testsuite.arquillian;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.jboss.arquillian.container.test.api.ContainerController;
|
import org.jboss.arquillian.container.test.api.ContainerController;
|
||||||
import org.jboss.arquillian.core.api.Instance;
|
import org.jboss.arquillian.core.api.Instance;
|
||||||
import org.jboss.arquillian.core.api.annotation.Inject;
|
import org.jboss.arquillian.core.api.annotation.Inject;
|
||||||
|
@ -25,6 +27,7 @@ import org.jboss.arquillian.test.spi.event.suite.BeforeClass;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.AppServerContainers;
|
import org.keycloak.testsuite.arquillian.annotation.AppServerContainers;
|
||||||
|
import org.keycloak.testsuite.arquillian.containers.SelfManagedAppContainerLifecycle;
|
||||||
import org.wildfly.extras.creaper.core.ManagementClient;
|
import org.wildfly.extras.creaper.core.ManagementClient;
|
||||||
import org.wildfly.extras.creaper.core.online.ManagementProtocol;
|
import org.wildfly.extras.creaper.core.online.ManagementProtocol;
|
||||||
import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
|
import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
|
||||||
|
@ -33,6 +36,8 @@ import org.wildfly.extras.creaper.core.online.OnlineOptions;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -46,7 +51,7 @@ import static org.keycloak.testsuite.arquillian.AuthServerTestEnricher.getAuthSe
|
||||||
*/
|
*/
|
||||||
public class AppServerTestEnricher {
|
public class AppServerTestEnricher {
|
||||||
|
|
||||||
protected final Logger log = Logger.getLogger(this.getClass());
|
private static final Logger log = Logger.getLogger(AppServerTestEnricher.class);
|
||||||
|
|
||||||
public static final String CURRENT_APP_SERVER = System.getProperty("app.server", "undertow");
|
public static final String CURRENT_APP_SERVER = System.getProperty("app.server", "undertow");
|
||||||
|
|
||||||
|
@ -160,7 +165,15 @@ public class AppServerTestEnricher {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startAppServer(@Observes(precedence = -1) BeforeClass event) throws MalformedURLException, InterruptedException, IOException {
|
public void startAppServer(@Observes(precedence = -1) BeforeClass event) throws MalformedURLException, InterruptedException, IOException {
|
||||||
|
// if testClass implements SelfManagedAppContainerLifecycle we skip starting container and let the test to manage the lifecycle itself
|
||||||
|
if (SelfManagedAppContainerLifecycle.class.isAssignableFrom(event.getTestClass().getJavaClass())) {
|
||||||
|
log.debug("Skipping starting App server. Server should be started by testClass.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (testContext.isAdapterContainerEnabled() && !testContext.isRelativeAdapterTest()) {
|
if (testContext.isAdapterContainerEnabled() && !testContext.isRelativeAdapterTest()) {
|
||||||
|
if (isJBossBased()) {
|
||||||
|
prepareServerDir("standalone");
|
||||||
|
}
|
||||||
ContainerController controller = containerConrollerInstance.get();
|
ContainerController controller = containerConrollerInstance.get();
|
||||||
if (!controller.isStarted(testContext.getAppServerInfo().getQualifier())) {
|
if (!controller.isStarted(testContext.getAppServerInfo().getQualifier())) {
|
||||||
log.info("Starting app server: " + testContext.getAppServerInfo().getQualifier());
|
log.info("Starting app server: " + testContext.getAppServerInfo().getQualifier());
|
||||||
|
@ -169,6 +182,25 @@ public class AppServerTestEnricher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Workaround for WFARQ-44. It cannot be used 'cleanServerBaseDir' property.
|
||||||
|
*
|
||||||
|
* It copies deployments and configuration into $JBOSS_HOME/standalone-test from where
|
||||||
|
* the container is started for the test
|
||||||
|
*
|
||||||
|
* @param baseDir string representing folder name, relative to app.server.home, from which the copy is made
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public static void prepareServerDir(String baseDir) throws IOException {
|
||||||
|
log.debug("Creating cleanServerBaseDir from: " + baseDir);
|
||||||
|
Path path = Paths.get(System.getProperty("app.server.home"), "standalone-test");
|
||||||
|
File targetSubdirFile = path.toFile();
|
||||||
|
FileUtils.deleteDirectory(targetSubdirFile);
|
||||||
|
FileUtils.forceMkdir(targetSubdirFile);
|
||||||
|
FileUtils.copyDirectory(Paths.get(System.getProperty("app.server.home"), baseDir, "deployments").toFile(), new File(targetSubdirFile, "deployments"));
|
||||||
|
FileUtils.copyDirectory(Paths.get(System.getProperty("app.server.home"), baseDir, "configuration").toFile(), new File(targetSubdirFile, "configuration"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param testClass
|
* @param testClass
|
||||||
|
@ -230,4 +262,7 @@ public class AppServerTestEnricher {
|
||||||
return CURRENT_APP_SERVER.contains("karaf") || CURRENT_APP_SERVER.contains("fuse");
|
return CURRENT_APP_SERVER.contains("karaf") || CURRENT_APP_SERVER.contains("fuse");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isJBossBased() {
|
||||||
|
return testContext.getAppServerInfo().isJBossBased();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2018 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* 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.keycloak.testsuite.arquillian.containers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author vramik
|
||||||
|
*/
|
||||||
|
public interface SelfManagedAppContainerLifecycle {
|
||||||
|
|
||||||
|
void startServer();
|
||||||
|
void stopServer();
|
||||||
|
}
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.adapter;
|
package org.keycloak.testsuite.adapter;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
import org.jboss.shrinkwrap.api.Archive;
|
import org.jboss.shrinkwrap.api.Archive;
|
||||||
|
@ -43,10 +44,14 @@ import org.wildfly.extras.creaper.core.online.operations.admin.Administration;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.junit.Before;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>@AppServerContainer</code> is needed for stopping recursion in
|
* <code>@AppServerContainer</code> is needed for stopping recursion in
|
||||||
|
|
|
@ -997,7 +997,7 @@ public class DemoServletsAdapterTest extends AbstractServletsAdapterTest {
|
||||||
|
|
||||||
String appServer = System.getProperty("app.server");
|
String appServer = System.getProperty("app.server");
|
||||||
if (appServer != null && (appServer.equals("wildfly") || appServer.equals("eap6") || appServer.equals("eap"))) {
|
if (appServer != null && (appServer.equals("wildfly") || appServer.equals("eap6") || appServer.equals("eap"))) {
|
||||||
serverLogPath = System.getProperty("app.server.home") + "/standalone/log/server.log";
|
serverLogPath = System.getProperty("app.server.home") + "/standalone-test/log/server.log";
|
||||||
}
|
}
|
||||||
|
|
||||||
String appServerUrl;
|
String appServerUrl;
|
||||||
|
|
|
@ -17,29 +17,41 @@
|
||||||
|
|
||||||
package org.keycloak.testsuite.adapter.servlet;
|
package org.keycloak.testsuite.adapter.servlet;
|
||||||
|
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
|
||||||
|
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import org.jboss.arquillian.container.test.api.ContainerController;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
import org.jboss.arquillian.container.test.api.Deployment;
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
|
import org.jboss.arquillian.test.api.ArquillianResource;
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
|
import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest;
|
||||||
import org.keycloak.testsuite.adapter.filter.AdapterActionsFilter;
|
import org.keycloak.testsuite.adapter.filter.AdapterActionsFilter;
|
||||||
import org.keycloak.testsuite.adapter.page.CustomerDb;
|
import org.keycloak.testsuite.adapter.page.CustomerDb;
|
||||||
import org.keycloak.testsuite.adapter.page.CustomerPortalSubsystem;
|
import org.keycloak.testsuite.adapter.page.CustomerPortalSubsystem;
|
||||||
import org.keycloak.testsuite.adapter.page.ProductPortalSubsystem;
|
import org.keycloak.testsuite.adapter.page.ProductPortalSubsystem;
|
||||||
|
import org.keycloak.testsuite.arquillian.AppServerTestEnricher;
|
||||||
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
|
||||||
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
|
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
|
||||||
|
import org.keycloak.testsuite.arquillian.containers.SelfManagedAppContainerLifecycle;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
|
||||||
import static org.junit.Assert.assertThat;
|
|
||||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
|
|
||||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
|
|
||||||
|
|
||||||
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
|
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY)
|
||||||
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY10)
|
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY10)
|
||||||
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY9)
|
@AppServerContainer(ContainerConstants.APP_SERVER_WILDFLY9)
|
||||||
@AppServerContainer(ContainerConstants.APP_SERVER_EAP)
|
@AppServerContainer(ContainerConstants.APP_SERVER_EAP)
|
||||||
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
|
@AppServerContainer(ContainerConstants.APP_SERVER_EAP6)
|
||||||
public class SecuredDeploymentsAdapterTest extends AbstractServletsAdapterTest {
|
public class SecuredDeploymentsAdapterTest extends AbstractServletsAdapterTest implements SelfManagedAppContainerLifecycle {
|
||||||
|
|
||||||
|
@ArquillianResource
|
||||||
|
private ContainerController controller;
|
||||||
|
|
||||||
@Page
|
@Page
|
||||||
private CustomerPortalSubsystem customerPortalSubsystem;
|
private CustomerPortalSubsystem customerPortalSubsystem;
|
||||||
|
@ -62,6 +74,24 @@ public class SecuredDeploymentsAdapterTest extends AbstractServletsAdapterTest {
|
||||||
return servletDeployment(CustomerDb.DEPLOYMENT_NAME, AdapterActionsFilter.class, CustomerDatabaseServlet.class);
|
return servletDeployment(CustomerDb.DEPLOYMENT_NAME, AdapterActionsFilter.class, CustomerDatabaseServlet.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
@Override
|
||||||
|
public void startServer() {
|
||||||
|
try {
|
||||||
|
AppServerTestEnricher.prepareServerDir("standalone-secured-deployments");
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new RuntimeException("Wasn't able to prepare server dir.", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.start(testContext.getAppServerInfo().getQualifier());
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
@Override
|
||||||
|
public void stopServer() {
|
||||||
|
controller.stop(testContext.getAppServerInfo().getQualifier());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSecuredDeployments() {
|
public void testSecuredDeployments() {
|
||||||
customerPortalSubsystem.navigateTo();
|
customerPortalSubsystem.navigateTo();
|
||||||
|
|
Loading…
Reference in a new issue