diff --git a/testsuite/integration-arquillian/HOW-TO-RUN.md b/testsuite/integration-arquillian/HOW-TO-RUN.md
index 4033559130..7b663e4154 100644
--- a/testsuite/integration-arquillian/HOW-TO-RUN.md
+++ b/testsuite/integration-arquillian/HOW-TO-RUN.md
@@ -446,19 +446,19 @@ and argument: `-p 8181`
## Cross-DC tests
-Cross-DC tests use 2 data centers, each with one automatically started and one manually controlled backend servers
-(currently only Keycloak on Undertow), and 1 frontend loadbalancer server node that sits in front of all servers.
+Cross-DC tests use 2 data centers, each with one automatically started and one manually controlled backend servers,
+and 1 frontend loadbalancer server node that sits in front of all servers.
The browser usually communicates directly with the frontent node and the test controls where the HTTP requests
land by adjusting load balancer configuration (e.g. to direct the traffic to only a single DC).
For an example of a test, see [org.keycloak.testsuite.crossdc.ActionTokenCrossDCTest](tests/base/src/test/java/org/keycloak/testsuite/crossdc/ActionTokenCrossDCTest.java).
-The cross DC requires setting a profile specifying used cache server (currently only Infinispan) by specifying
-`cache-server-infinispan` profile in maven.
+The cross DC requires setting a profile specifying used cache server by specifying
+`cache-server-infinispan` or `cache-server-jdg` profile in maven.
#### Run Cross-DC Tests from Maven
-First compile the Infinispan/JDG test server via the following command:
+a) First compile the Infinispan/JDG test server via the following command:
`mvn -Pcache-server-infinispan -f testsuite/integration-arquillian -DskipTests clean install`
@@ -466,14 +466,30 @@ or
`mvn -Pcache-server-jdg -f testsuite/integration-arquillian -DskipTests clean install`
-Then you can run the tests using the following command (adjust the test specification according to your needs):
+b) Then in case you want to use **JBoss-based** containers instead of containers on Embedded Undertow run following command:
- `mvn -Pcache-server-infinispan -Dtest=*.crossdc.* -pl testsuite/integration-arquillian/tests/base test`
+ `mvn -Pauth-servers-crossdc-jboss,auth-server-wildfly -f testsuite/integration-arquillian -DskipTests clean install`
+
+*note: 'auth-server-wildfly' can be replaced by 'auth-server-eap'*
+
+c1) Then you can run the tests using the following command (adjust the test specification according to your needs) for containers on **Undertow**:
+
+ `mvn -Pcache-server-infinispan,auth-servers-crossdc-undertow -Dtest=*.crossdc.* -pl testsuite/integration-arquillian/tests/base clean install`
or
- `mvn -Pcache-server-jdg -Dtest=*.crossdc.* -pl testsuite/integration-arquillian/tests/base test`
-
+ `mvn -Pcache-server-jdg,auth-servers-crossdc-undertow -Dtest=*.crossdc.* -pl testsuite/integration-arquillian/tests/base clean install`
+
+c2) For **JBoss-based** containers:
+
+ `mvn -Pcache-server-infinispan,auth-servers-crossdc-jboss,auth-server-wildfly -Dtest=*.crossdc.* -pl testsuite/integration-arquillian/tests/base clean install`
+
+or
+
+ `mvn -Pcache-server-jdg,auth-servers-crossdc-jboss,auth-server-wildfly -Dtest=*.crossdc.* -pl testsuite/integration-arquillian/tests/base clean install`
+
+*note: 'auth-server-wildfly can be replaced by auth-server-eap'*
+
It can be useful to add additional system property to enable logging:
-Dkeycloak.infinispan.logging.level=debug
diff --git a/testsuite/integration-arquillian/pom.xml b/testsuite/integration-arquillian/pom.xml
index c5674ff480..c21ea8fb23 100644
--- a/testsuite/integration-arquillian/pom.xml
+++ b/testsuite/integration-arquillian/pom.xml
@@ -45,7 +45,7 @@
3.5.3
2.4.2
2.3.1
- 2.1.0.Beta1
+ 2.1.0.Final
1.0.1.Final
1.2.0.Beta2
2.2.6
@@ -56,7 +56,7 @@
1.9.8.Final
2.2.1.Final
2.5.5.Final
-
+
1.8
1.8
diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/common/crossdc/cross-dc-setup.cli b/testsuite/integration-arquillian/servers/auth-server/jboss/common/crossdc/cross-dc-setup.cli
new file mode 100644
index 0000000000..836cde1d82
--- /dev/null
+++ b/testsuite/integration-arquillian/servers/auth-server/jboss/common/crossdc/cross-dc-setup.cli
@@ -0,0 +1,129 @@
+embed-server --server-config=standalone-ha.xml
+
+echo **** Begin ****
+
+echo *** Update jgoups subsystem ***
+/subsystem=jgroups/stack=udp/transport=UDP:write-attribute(name=site, value=${jboss.site.name})
+
+echo *** Update infinispan subsystem ***
+/subsystem=infinispan/cache-container=keycloak:write-attribute(name=module, value=org.keycloak.keycloak-model-infinispan)
+
+echo ** Update replicated-cache work element **
+/subsystem=infinispan/cache-container=keycloak/replicated-cache=work/store=custom:add( \
+ class=org.keycloak.models.sessions.infinispan.remotestore.KeycloakRemoteStoreConfigurationBuilder, \
+ passivation=false, \
+ fetch-state=false, \
+ purge=false, \
+ preload=false, \
+ shared=true \
+)
+
+/subsystem=infinispan/cache-container=keycloak/replicated-cache=work/store=custom:write-attribute( \
+ name=properties, value={ \
+ rawValues=true, \
+ marshaller=org.keycloak.cluster.infinispan.KeycloakHotRodMarshallerFactory, \
+ transportFactory=org.keycloak.models.sessions.infinispan.remotestore.KeycloakTcpTransportFactory, \
+ remoteServers=localhost:${remote.cache.port}, \
+ remoteCacheName=work, \
+ sessionCache=false \
+ } \
+)
+
+/subsystem=infinispan/cache-container=keycloak/replicated-cache=work:write-attribute(name=statistics-enabled,value=true)
+
+echo ** Update distributed-cache sessions element **
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=sessions/store=custom:add( \
+ class=org.keycloak.models.sessions.infinispan.remotestore.KeycloakRemoteStoreConfigurationBuilder, \
+ passivation=false, \
+ fetch-state=false, \
+ purge=false, \
+ preload=false, \
+ shared=true \
+)
+
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=sessions/store=custom:write-attribute( \
+ name=properties, value={ \
+ remoteCacheName=sessions, \
+ useConfigTemplateFromCache=work, \
+ sessionCache=true \
+ } \
+)
+
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=sessions:write-attribute(name=statistics-enabled,value=true)
+
+echo ** Update distributed-cache offlineSessions element **
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineSessions/store=custom:add( \
+ class=org.keycloak.models.sessions.infinispan.remotestore.KeycloakRemoteStoreConfigurationBuilder, \
+ passivation=false, \
+ fetch-state=false, \
+ purge=false, \
+ preload=false, \
+ shared=true \
+)
+
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineSessions/store=custom:write-attribute( \
+ name=properties, value={ \
+ remoteCacheName=offlineSessions, \
+ useConfigTemplateFromCache=work, \
+ sessionCache=true \
+ } \
+)
+
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineSessions:write-attribute(name=statistics-enabled,value=true)
+
+echo ** Update distributed-cache loginFailures element **
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=loginFailures/store=custom:add( \
+ class=org.keycloak.models.sessions.infinispan.remotestore.KeycloakRemoteStoreConfigurationBuilder, \
+ passivation=false, \
+ fetch-state=false, \
+ purge=false, \
+ preload=false, \
+ shared=true \
+)
+
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=loginFailures/store=custom:write-attribute( \
+ name=properties, value={ \
+ remoteCacheName=loginFailures, \
+ useConfigTemplateFromCache=work, \
+ sessionCache=true \
+ } \
+)
+
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=loginFailures:write-attribute(name=statistics-enabled,value=true)
+
+echo ** Update distributed-cache actionTokens element **
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=actionTokens/store=custom:add( \
+ class=org.keycloak.models.sessions.infinispan.remotestore.KeycloakRemoteStoreConfigurationBuilder, \
+ passivation=false, \
+ fetch-state=false, \
+ purge=false, \
+ preload=true, \
+ shared=true \
+)
+
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=actionTokens/store=custom:write-attribute( \
+ name=properties, value={ \
+ remoteCacheName=actionTokens, \
+ useConfigTemplateFromCache=work, \
+ sessionCache=false \
+ } \
+)
+
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=actionTokens:write-attribute(name=statistics-enabled,value=true)
+
+echo ** Update distributed-cache authenticationSessions element **
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=authenticationSessions:write-attribute(name=statistics-enabled,value=true)
+
+echo *** Enable debug logging ***
+/subsystem=logging/logger=org.keycloak.cluster.infinispan:add(level=DEBUG)
+
+/subsystem=logging/logger=org.keycloak.connections.infinispan:add(level=DEBUG)
+
+/subsystem=logging/logger=org.keycloak.models.cache.infinispan:add(level=DEBUG)
+
+/subsystem=logging/logger=org.keycloak.models.sessions.infinispan:add(level=DEBUG)
+
+echo *** Update undertow subsystem ***
+/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding,value=true)
+
+echo **** End ****
diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/eap/pom.xml b/testsuite/integration-arquillian/servers/auth-server/jboss/eap/pom.xml
index 47e6a7fc9f..95b33ba2c0 100644
--- a/testsuite/integration-arquillian/servers/auth-server/jboss/eap/pom.xml
+++ b/testsuite/integration-arquillian/servers/auth-server/jboss/eap/pom.xml
@@ -26,11 +26,11 @@
4.0.0
pom
-
+
integration-arquillian-servers-auth-server-eap
-
+
Auth Server - JBoss - EAP
-
+
eap
${project.build.directory}/unpacked/${product.unpacked.folder.name}
@@ -57,6 +57,7 @@
enforce
+ false
product.version
@@ -71,5 +72,5 @@
-
+
diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml b/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml
index ae7d87a657..e670626471 100644
--- a/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml
+++ b/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml
@@ -191,6 +191,7 @@
${auth.server.home}/standalone/configuration
standalone.xml
+ standalone-ha.xml
${common.resources}/keycloak-server-subsystem.xsl
${auth.server.home}/standalone/configuration
@@ -575,6 +576,119 @@
+
+
+ auth-servers-crossdc-jboss
+
+ jdbc:h2:tcp://localhost:9092/mem:keycloak-dc-shared;DB_CLOSE_DELAY=-1
+
+
+
+
+ maven-enforcer-plugin
+
+ true
+
+
+
+
+
+
+ maven-enforcer-plugin
+
+
+ enforce-profile-activation
+
+ enforce
+
+
+
+
+ auth.server.jboss
+ Profile "auth-servers-crossdc-jboss" requires activation of another profile: either "auth-server-wildfly" or "auth-server-eap".
+ (wildfly|eap)
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ xml-maven-plugin
+
+
+ jpa-h2-tcp
+ process-resources
+
+ transform
+
+
+
+
+ ${auth.server.home}/standalone/configuration
+
+ standalone-ha.xml
+
+ ${common.resources}/datasource-jdbc-url.xsl
+ ${auth.server.home}/standalone/configuration
+
+
+ pool.name
+ KeycloakDS
+
+
+ jdbc.url
+ ${crossdc.jboss.jdbc.url}
+
+
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+
+
+ crossdc-setup
+ process-resources
+
+ exec
+
+
+ ${auth.server.home}/bin/jboss-cli.sh
+
+ --file=${common.resources}/crossdc/cross-dc-setup.cli
+
+
+
+
+ remove-temp-data-crossdc-setup
+ process-resources
+
+ exec
+
+
+ ${auth.server.home}/standalone/
+ rm
+
+ -rf
+ data
+ log
+ tmp
+
+
+
+
+
+
+
+
+
+
auth-server-cluster
diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/wildfly/pom.xml b/testsuite/integration-arquillian/servers/auth-server/jboss/wildfly/pom.xml
index c4f8f525aa..ab6f60fa90 100644
--- a/testsuite/integration-arquillian/servers/auth-server/jboss/wildfly/pom.xml
+++ b/testsuite/integration-arquillian/servers/auth-server/jboss/wildfly/pom.xml
@@ -26,9 +26,9 @@
4.0.0
pom
-
+
integration-arquillian-servers-auth-server-wildfly
-
+
Auth Server - JBoss - Wildfly
@@ -38,9 +38,20 @@
zip
-
+
wildfly
-
+
+
+
+
+ maven-enforcer-plugin
+
+ false
+
+
+
+
+
diff --git a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/resources/org/keycloak/testsuite/integration-arquillian-testsuite-providers/main/module.xml b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/resources/org/keycloak/testsuite/integration-arquillian-testsuite-providers/main/module.xml
index 1e4b3f762c..467601a3f9 100644
--- a/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/resources/org/keycloak/testsuite/integration-arquillian-testsuite-providers/main/module.xml
+++ b/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/resources/org/keycloak/testsuite/integration-arquillian-testsuite-providers/main/module.xml
@@ -33,6 +33,7 @@
+
diff --git a/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/lb/SimpleUndertowLoadBalancer.java b/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/lb/SimpleUndertowLoadBalancer.java
index 3da888afe3..c102df2830 100644
--- a/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/lb/SimpleUndertowLoadBalancer.java
+++ b/testsuite/integration-arquillian/servers/auth-server/undertow/src/main/java/org/keycloak/testsuite/arquillian/undertow/lb/SimpleUndertowLoadBalancer.java
@@ -94,7 +94,7 @@ public class SimpleUndertowLoadBalancer {
.build();
undertow.start();
- log.infof("Loadbalancer started and ready to serve requests on http://%s:%d", host, port);
+ log.infof("#### Loadbalancer started and ready to serve requests on http://%s:%d ####", host, port);
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java
index 5b0f6d8fd7..d2092ffe02 100644
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java
@@ -135,6 +135,11 @@ public class AuthServerTestEnricher {
return managementClient;
}
+
+ public void distinguishContainersInConsoleOutput(@Observes(precedence = 5) StartContainer event) {
+ log.info("*****************************************************************"
+ + "*****************************************************************************");
+ }
public void initializeSuiteContext(@Observes(precedence = 2) BeforeSuite event) {
Set containers = containerRegistry.get().getContainers().stream()
@@ -165,15 +170,16 @@ public class AuthServerTestEnricher {
}
containers.stream()
- .filter(c -> c.getQualifier().startsWith(AUTH_SERVER_CONTAINER + "-cross-dc-"))
- .sorted((a, b) -> a.getQualifier().compareTo(b.getQualifier()))
- .forEach(c -> {
- String portOffsetString = c.getArquillianContainer().getContainerConfiguration().getContainerProperties().getOrDefault("bindHttpPortOffset", "0");
- String dcString = c.getArquillianContainer().getContainerConfiguration().getContainerProperties().getOrDefault("dataCenter", "0");
- updateWithAuthServerInfo(c, Integer.valueOf(portOffsetString));
- suiteContext.addAuthServerBackendsInfo(Integer.valueOf(dcString), c);
- });
+ .filter(c -> c.getQualifier().startsWith("auth-server-" + System.getProperty("node.name") + "-"))
+ .sorted((a, b) -> a.getQualifier().compareTo(b.getQualifier()))
+ .forEach(c -> {
+ String portOffsetString = c.getArquillianContainer().getContainerConfiguration().getContainerProperties().getOrDefault("bindHttpPortOffset", "0");
+ updateWithAuthServerInfo(c, Integer.valueOf(portOffsetString));
+ String dcString = c.getArquillianContainer().getContainerConfiguration().getContainerProperties().getOrDefault("dataCenter", "0");
+ suiteContext.addAuthServerBackendsInfo(Integer.valueOf(dcString), c);
+ });
+
containers.stream()
.filter(c -> c.getQualifier().startsWith("cache-server-cross-dc-"))
.sorted((a, b) -> a.getQualifier().compareTo(b.getQualifier()))
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/CacheStatisticsControllerEnricher.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/CacheStatisticsControllerEnricher.java
index 33af2f2de7..04c611042b 100644
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/CacheStatisticsControllerEnricher.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/CacheStatisticsControllerEnricher.java
@@ -1,23 +1,18 @@
package org.keycloak.testsuite.arquillian;
-import org.keycloak.connections.infinispan.InfinispanConnectionProvider;
-import org.keycloak.testsuite.Retry;
-import java.util.Map;
-import org.jboss.arquillian.core.api.Instance;
-import org.jboss.arquillian.core.api.annotation.Inject;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.lang.management.ManagementFactory;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXServiceURL;
-import org.jboss.arquillian.container.spi.Container;
-import org.jboss.arquillian.container.spi.ContainerRegistry;
-import org.jboss.arquillian.test.spi.TestEnricher;
-import java.io.IOException;
import java.lang.reflect.Parameter;
+import java.net.MalformedURLException;
import java.util.Arrays;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.management.Attribute;
import javax.management.AttributeNotFoundException;
@@ -26,21 +21,26 @@ import javax.management.IntrospectionException;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanException;
import javax.management.MBeanInfo;
+import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
import javax.management.ReflectionException;
+import javax.management.remote.JMXServiceURL;
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.jboss.arquillian.container.spi.Container;
+import org.jboss.arquillian.container.spi.ContainerRegistry;
+import org.jboss.arquillian.core.api.Instance;
+import org.jboss.arquillian.core.api.annotation.Inject;
+import org.jboss.arquillian.core.spi.Validate;
+import org.jboss.arquillian.test.spi.TestEnricher;
+import org.jboss.logging.Logger;
+import org.keycloak.connections.infinispan.InfinispanConnectionProvider;
+import org.keycloak.testsuite.Retry;
import org.keycloak.testsuite.arquillian.annotation.JmxInfinispanCacheStatistics;
-import java.util.Set;
import org.keycloak.testsuite.arquillian.annotation.JmxInfinispanChannelStatistics;
import org.keycloak.testsuite.arquillian.jmx.JmxConnectorRegistry;
import org.keycloak.testsuite.arquillian.undertow.KeycloakOnUndertow;
import org.keycloak.testsuite.crossdc.DC;
-import java.io.NotSerializableException;
-import java.lang.management.ManagementFactory;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-import org.apache.commons.lang3.reflect.FieldUtils;
-import org.jboss.arquillian.core.spi.Validate;
-import org.jboss.logging.Logger;
/**
*
@@ -81,8 +81,6 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
}
private InfinispanStatistics getInfinispanCacheStatistics(JmxInfinispanCacheStatistics annotation) throws MalformedObjectNameException, IOException, MalformedURLException {
- MBeanServerConnection mbsc = getJmxServerConnection(annotation);
-
ObjectName mbeanName = new ObjectName(String.format(
"%s:type=%s,name=\"%s(%s)\",manager=\"%s\",component=%s",
annotation.domain().isEmpty() ? getDefaultDomain(annotation.dc().getDcIndex(), annotation.dcNodeIndex()) : InfinispanConnectionProvider.JMX_DOMAIN,
@@ -93,7 +91,7 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
annotation.component()
));
- InfinispanStatistics value = new InfinispanCacheStatisticsImpl(mbsc, mbeanName);
+ InfinispanStatistics value = new InfinispanCacheStatisticsImpl(getJmxServerConnection(annotation), mbeanName);
if (annotation.domain().isEmpty()) {
try {
@@ -101,7 +99,7 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
} catch (RuntimeException ex) {
if (annotation.dc() != DC.UNDEFINED && annotation.dcNodeIndex() != -1
&& suiteContext.get().getAuthServerBackendsInfo(annotation.dc().getDcIndex()).get(annotation.dcNodeIndex()).isStarted()) {
- LOG.warn("Could not reset statistics for " + mbeanName);
+ LOG.warn("Could not reset statistics for " + mbeanName + ". The reason is: \"" + ex.getMessage() + "\"");
}
}
}
@@ -110,8 +108,6 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
}
private InfinispanStatistics getJGroupsChannelStatistics(JmxInfinispanChannelStatistics annotation) throws MalformedObjectNameException, IOException, MalformedURLException {
- MBeanServerConnection mbsc = getJmxServerConnection(annotation);
-
ObjectName mbeanName = new ObjectName(String.format(
"%s:type=%s,cluster=\"%s\"",
annotation.domain().isEmpty() ? getDefaultDomain(annotation.dc().getDcIndex(), annotation.dcNodeIndex()) : InfinispanConnectionProvider.JMX_DOMAIN,
@@ -119,7 +115,7 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
annotation.cluster()
));
- InfinispanStatistics value = new InfinispanChannelStatisticsImpl(mbsc, mbeanName);
+ InfinispanStatistics value = new InfinispanChannelStatisticsImpl(getJmxServerConnection(annotation), mbeanName);
if (annotation.domain().isEmpty()) {
try {
@@ -127,7 +123,7 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
} catch (RuntimeException ex) {
if (annotation.dc() != DC.UNDEFINED && annotation.dcNodeIndex() != -1
&& suiteContext.get().getAuthServerBackendsInfo(annotation.dc().getDcIndex()).get(annotation.dcNodeIndex()).isStarted()) {
- LOG.warn("Could not reset statistics for " + mbeanName);
+ LOG.warn("Could not reset statistics for " + mbeanName + ". The reason is: \"" + ex.getMessage() + "\"");
}
}
}
@@ -162,12 +158,20 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
private String getDefaultDomain(int dcIndex, int dcNodeIndex) {
if (dcIndex != -1 && dcNodeIndex != -1) {
+ if (Boolean.parseBoolean(System.getProperty("auth.server.jboss.crossdc"))) {
+ //backend-jboss-server
+ return "org.wildfly.clustering.infinispan";
+ }
+
+ //backend-undertow-server
return InfinispanConnectionProvider.JMX_DOMAIN + "-" + suiteContext.get().getAuthServerBackendsInfo(dcIndex).get(dcNodeIndex).getQualifier();
}
+
+ //cache-server
return InfinispanConnectionProvider.JMX_DOMAIN;
}
- private MBeanServerConnection getJmxServerConnection(JmxInfinispanCacheStatistics annotation) throws MalformedURLException, IOException {
+ private Supplier getJmxServerConnection(JmxInfinispanCacheStatistics annotation) throws MalformedURLException {
final String host;
final int port;
@@ -175,7 +179,46 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
ContainerInfo node = suiteContext.get().getAuthServerBackendsInfo(annotation.dc().getDcIndex()).get(annotation.dcNodeIndex());
Container container = node.getArquillianContainer();
if (container.getDeployableContainer() instanceof KeycloakOnUndertow) {
- return ManagementFactory.getPlatformMBeanServer();
+ return () -> ManagementFactory.getPlatformMBeanServer();
+ }
+ host = "localhost";
+ port = container.getContainerConfiguration().getContainerProperties().containsKey("managementPort")
+ ? Integer.valueOf(container.getContainerConfiguration().getContainerProperties().get("managementPort"))
+ : 9990;
+ } else {
+ host = annotation.host().isEmpty()
+ ? System.getProperty((annotation.hostProperty().isEmpty()
+ ? "keycloak.connectionsInfinispan.remoteStoreServer"
+ : annotation.hostProperty()))
+ : annotation.host();
+
+ port = annotation.managementPort() == -1
+ ? Integer.valueOf(System.getProperty((annotation.managementPortProperty().isEmpty()
+ ? "cache.server.management.port"
+ : annotation.managementPortProperty())))
+ : annotation.managementPort();
+ }
+
+
+ JMXServiceURL url = new JMXServiceURL("service:jmx:remote+http://" + host + ":" + port);
+ return () -> {
+ try {
+ return jmxConnectorRegistry.get().getConnection(url).getMBeanServerConnection();
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ };
+ }
+
+ private Supplier getJmxServerConnection(JmxInfinispanChannelStatistics annotation) throws MalformedURLException {
+ final String host;
+ final int port;
+
+ if (annotation.dc() != DC.UNDEFINED && annotation.dcNodeIndex() != -1) {
+ ContainerInfo node = suiteContext.get().getAuthServerBackendsInfo(annotation.dc().getDcIndex()).get(annotation.dcNodeIndex());
+ Container container = node.getArquillianContainer();
+ if (container.getDeployableContainer() instanceof KeycloakOnUndertow) {
+ return () -> ManagementFactory.getPlatformMBeanServer();
}
host = "localhost";
port = container.getContainerConfiguration().getContainerProperties().containsKey("managementPort")
@@ -196,79 +239,50 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
}
JMXServiceURL url = new JMXServiceURL("service:jmx:remote+http://" + host + ":" + port);
- JMXConnector jmxc = jmxConnectorRegistry.get().getConnection(url);
-
- return jmxc.getMBeanServerConnection();
- }
-
- private MBeanServerConnection getJmxServerConnection(JmxInfinispanChannelStatistics annotation) throws MalformedURLException, IOException {
- final String host;
- final int port;
-
- if (annotation.dc() != DC.UNDEFINED && annotation.dcNodeIndex() != -1) {
- ContainerInfo node = suiteContext.get().getAuthServerBackendsInfo(annotation.dc().getDcIndex()).get(annotation.dcNodeIndex());
- Container container = node.getArquillianContainer();
- if (container.getDeployableContainer() instanceof KeycloakOnUndertow) {
- return ManagementFactory.getPlatformMBeanServer();
+ return () -> {
+ try {
+ return jmxConnectorRegistry.get().getConnection(url).getMBeanServerConnection();
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
}
- host = "localhost";
- port = container.getContainerConfiguration().getContainerProperties().containsKey("managementPort")
- ? Integer.valueOf(container.getContainerConfiguration().getContainerProperties().get("managementPort"))
- : 9990;
- } else {
- host = annotation.host().isEmpty()
- ? System.getProperty((annotation.hostProperty().isEmpty()
- ? "keycloak.connectionsInfinispan.remoteStoreServer"
- : annotation.hostProperty()))
- : annotation.host();
-
- port = annotation.managementPort() == -1
- ? Integer.valueOf(System.getProperty((annotation.managementPortProperty().isEmpty()
- ? "cache.server.management.port"
- : annotation.managementPortProperty())))
- : annotation.managementPort();
- }
-
- String jmxUrl = "service:jmx:remote+http://" + host + ":" + port;
- LOG.infof("JMX Service URL: %s", jmxUrl);
-
- JMXServiceURL url = new JMXServiceURL(jmxUrl);
- JMXConnector jmxc = jmxConnectorRegistry.get().getConnection(url);
-
- return jmxc.getMBeanServerConnection();
+ };
}
private static abstract class CacheStatisticsImpl implements InfinispanStatistics {
- protected final MBeanServerConnection mbsc;
+ private final Supplier mbscCreateor;
private final ObjectName mbeanNameTemplate;
private ObjectName mbeanName;
- public CacheStatisticsImpl(MBeanServerConnection mbsc, ObjectName mbeanNameTemplate) {
- this.mbsc = mbsc;
+ public CacheStatisticsImpl(Supplier mbscCreateor, ObjectName mbeanNameTemplate) {
+ this.mbscCreateor = mbscCreateor;
this.mbeanNameTemplate = mbeanNameTemplate;
}
+ protected MBeanServerConnection getConnection() {
+ return mbscCreateor.get();
+ }
+
@Override
public boolean exists() {
try {
getMbeanName();
return true;
- } catch (Exception ex) {
+ } catch (IOException | RuntimeException ex) {
return false;
}
}
-
+
@Override
public Map getStatistics() {
try {
- MBeanInfo mBeanInfo = mbsc.getMBeanInfo(getMbeanName());
+ MBeanInfo mBeanInfo = getConnection().getMBeanInfo(getMbeanName());
String[] statAttrs = Arrays.asList(mBeanInfo.getAttributes()).stream()
.filter(MBeanAttributeInfo::isReadable)
.map(MBeanAttributeInfo::getName)
.collect(Collectors.toList())
.toArray(new String[] {});
- return mbsc.getAttributes(getMbeanName(), statAttrs)
+ return getConnection().getAttributes(getMbeanName(), statAttrs)
.asList()
.stream()
.collect(Collectors.toMap(Attribute::getName, Attribute::getValue));
@@ -279,7 +293,7 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
protected ObjectName getMbeanName() throws IOException, RuntimeException {
if (this.mbeanName == null) {
- Set queryNames = mbsc.queryNames(mbeanNameTemplate, null);
+ Set queryNames = getConnection().queryNames(mbeanNameTemplate, null);
if (queryNames.isEmpty()) {
throw new RuntimeException("No MBean of template " + mbeanNameTemplate + " found at JMX server");
}
@@ -292,7 +306,7 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
@Override
public Comparable getSingleStatistics(String statisticsName) {
try {
- return (Comparable) mbsc.getAttribute(getMbeanName(), statisticsName);
+ return (Comparable) getConnection().getAttribute(getMbeanName(), statisticsName);
} catch (IOException | InstanceNotFoundException | MBeanException | ReflectionException | AttributeNotFoundException ex) {
throw new RuntimeException(ex);
}
@@ -305,7 +319,7 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
try {
getMbeanName();
if (! isAvailable()) throw new RuntimeException("Not available");
- } catch (Exception ex) {
+ } catch (IOException | RuntimeException ex) {
throw new RuntimeException("Timed out while waiting for " + mbeanNameTemplate + " to become available", ex);
}
}, 1 + (int) timeInMillis / 100, 100);
@@ -316,14 +330,14 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
private static class InfinispanCacheStatisticsImpl extends CacheStatisticsImpl {
- public InfinispanCacheStatisticsImpl(MBeanServerConnection mbsc, ObjectName mbeanName) {
- super(mbsc, mbeanName);
+ public InfinispanCacheStatisticsImpl(Supplier mbscCreator, ObjectName mbeanName) {
+ super(mbscCreator, mbeanName);
}
@Override
public void reset() {
try {
- mbsc.invoke(getMbeanName(), "resetStatistics", new Object[] {}, new String[] {});
+ getConnection().invoke(getMbeanName(), "resetStatistics", new Object[] {}, new String[] {});
} catch (IOException | InstanceNotFoundException | MBeanException | ReflectionException ex) {
throw new RuntimeException(ex);
}
@@ -337,14 +351,14 @@ public class CacheStatisticsControllerEnricher implements TestEnricher {
private static class InfinispanChannelStatisticsImpl extends CacheStatisticsImpl {
- public InfinispanChannelStatisticsImpl(MBeanServerConnection mbsc, ObjectName mbeanName) {
- super(mbsc, mbeanName);
+ public InfinispanChannelStatisticsImpl(Supplier mbscCreator, ObjectName mbeanName) {
+ super(mbscCreator, mbeanName);
}
@Override
public void reset() {
try {
- mbsc.invoke(getMbeanName(), "resetStats", new Object[] {}, new String[] {});
+ getConnection().invoke(getMbeanName(), "resetStats", new Object[] {}, new String[] {});
} catch (NotSerializableException ex) {
// Ignore return value not serializable, the invocation has already done its job
} catch (IOException | InstanceNotFoundException | MBeanException | ReflectionException ex) {
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/jmx/JmxConnectorRegistryCreator.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/jmx/JmxConnectorRegistryCreator.java
index 50c9b965c6..e5d1d2ac8f 100644
--- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/jmx/JmxConnectorRegistryCreator.java
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/jmx/JmxConnectorRegistryCreator.java
@@ -27,6 +27,7 @@ import org.jboss.arquillian.core.api.annotation.ApplicationScoped;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.core.api.annotation.Observes;
import org.jboss.arquillian.test.spi.event.suite.BeforeSuite;
+import org.jboss.logging.Logger;
/**
*
@@ -34,6 +35,8 @@ import org.jboss.arquillian.test.spi.event.suite.BeforeSuite;
*/
public class JmxConnectorRegistryCreator {
+ private final Logger log = Logger.getLogger(JmxConnectorRegistryCreator.class);
+
@Inject
@ApplicationScoped
private InstanceProducer connectorRegistry;
@@ -46,6 +49,7 @@ public class JmxConnectorRegistryCreator {
@Override
public JMXConnector getConnection(JMXServiceURL url) {
+
JMXConnector res = connectors.get(url);
if (res == null) {
try {
@@ -55,7 +59,10 @@ public class JmxConnectorRegistryCreator {
res = conn;
}
res.connect();
+ log.infof("Connected to JMX Service URL: %s", url);
} catch (IOException ex) {
+ //remove conn from connectors in case something goes wrong. The connection will be established on-demand
+ connectors.remove(url, res);
throw new RuntimeException("Could not instantiate JMX connector for " + url, ex);
}
}
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/concurrency/ConcurrentLoginTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/concurrency/ConcurrentLoginTest.java
index ee38faebea..219d7a2afd 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/concurrency/ConcurrentLoginTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/concurrency/ConcurrentLoginTest.java
@@ -21,8 +21,8 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.nio.charset.Charset;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.Response;
@@ -58,10 +58,12 @@ import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
import org.apache.http.client.CookieStore;
import org.apache.http.impl.client.BasicCookieStore;
import org.hamcrest.Matchers;
+import static org.hamcrest.Matchers.containsString;
/**
@@ -126,8 +128,7 @@ public class ConcurrentLoginTest extends AbstractConcurrencyTest {
CookieStore cookieStore = new BasicCookieStore();
context.setCookieStore(cookieStore);
HttpUriRequest request = handleLogin(getPageContent(oauth.getLoginFormUrl(), httpClient, context), userName, password);
- log.debug("Executing login request");
- Assert.assertTrue(parseAndCloseResponse(httpClient.execute(request, context)).contains("AUTH_RESPONSE"));
+ Assert.assertThat(parseAndCloseResponse(httpClient.execute(request, context)), containsString("AUTH_RESPONSE"));
return context;
}
@@ -306,12 +307,8 @@ public class ConcurrentLoginTest extends AbstractConcurrencyTest {
}
private static Map getQueryFromUrl(String url) throws URISyntaxException {
- Map m = new HashMap<>();
- List pairs = URLEncodedUtils.parse(new URI(url), "UTF-8");
- for (NameValuePair p : pairs) {
- m.put(p.getName(), p.getValue());
- }
- return m;
+ return URLEncodedUtils.parse(new URI(url), Charset.forName("UTF-8")).stream()
+ .collect(Collectors.toMap(p -> p.getName(), p -> p.getValue()));
}
@@ -411,4 +408,4 @@ public class ConcurrentLoginTest extends AbstractConcurrencyTest {
}
-}
\ No newline at end of file
+}
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/AbstractCrossDCTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/AbstractCrossDCTest.java
index d800162837..0de088fe79 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/AbstractCrossDCTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/AbstractCrossDCTest.java
@@ -50,6 +50,8 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest
// Keep the following constants in sync with arquillian
public static final String QUALIFIER_NODE_BALANCER = "auth-server-balancer-cross-dc";
+ public static final String QUALIFIER_JBOSS_DC_0_NODE_1 = "auth-server-jboss-cross-dc-0_1";
+ public static final String QUALIFIER_JBOSS_DC_1_NODE_1 = "auth-server-jboss-cross-dc-1_1";
@ArquillianResource
@LoadBalancer(value = QUALIFIER_NODE_BALANCER)
@@ -208,7 +210,7 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest
/**
* Disables routing requests to the given data center in the load balancer.
- * @param dcIndex
+ * @param dc
*/
public void disableDcOnLoadBalancer(DC dc) {
int dcIndex = dc.ordinal();
@@ -218,7 +220,7 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest
/**
* Enables routing requests to all started nodes to the given data center in the load balancer.
- * @param dcIndex
+ * @param dc
*/
public void enableDcOnLoadBalancer(DC dc) {
int dcIndex = dc.ordinal();
@@ -235,7 +237,7 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest
/**
* Disables routing requests to the given node within the given data center in the load balancer.
- * @param dcIndex
+ * @param dc
* @param nodeIndex
*/
public void disableLoadBalancerNode(DC dc, int nodeIndex) {
@@ -246,7 +248,7 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest
/**
* Enables routing requests to the given node within the given data center in the load balancer.
- * @param dcIndex
+ * @param dc
* @param nodeIndex
*/
public void enableLoadBalancerNode(DC dc, int nodeIndex) {
@@ -264,7 +266,7 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest
/**
* Starts a manually-controlled backend auth-server node in cross-DC scenario.
- * @param dcIndex
+ * @param dc
* @param nodeIndex
* @return Started instance descriptor.
*/
@@ -275,6 +277,8 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest
assertThat((Integer) nodeIndex, lessThan(dcNodes.size()));
ContainerInfo dcNode = dcNodes.get(nodeIndex);
assertTrue("Node " + dcNode.getQualifier() + " has to be controlled manually", dcNode.isManual());
+
+ log.infof("Starting backend node: %s (dcIndex: %d, nodeIndex: %d)", dcNode.getQualifier(), dcIndex, nodeIndex);
containerController.start(dcNode.getQualifier());
createRESTClientsForNode(dcNode);
@@ -284,7 +288,7 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest
/**
* Stops a manually-controlled backend auth-server node in cross-DC scenario.
- * @param dcIndex
+ * @param dc
* @param nodeIndex
* @return Stopped instance descriptor.
*/
@@ -298,13 +302,15 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest
removeRESTClientsForNode(dcNode);
assertTrue("Node " + dcNode.getQualifier() + " has to be controlled manually", dcNode.isManual());
+
+ log.infof("Stopping backend node: %s (dcIndex: %d, nodeIndex: %d)", dcNode.getQualifier(), dcIndex, nodeIndex);
containerController.stop(dcNode.getQualifier());
return dcNode;
}
/**
* Returns stream of all nodes in the given dc that are started manually.
- * @param dcIndex
+ * @param dc
* @return
*/
public Stream getManuallyStartedBackendNodes(DC dc) {
@@ -315,7 +321,7 @@ public abstract class AbstractCrossDCTest extends AbstractTestRealmKeycloakTest
/**
* Returns stream of all nodes in the given dc that are started automatically.
- * @param dcIndex
+ * @param dc
* @return
*/
public Stream getAutomaticallyStartedBackendNodes(DC dc) {
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/BruteForceCrossDCTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/BruteForceCrossDCTest.java
index 0573dbbe0b..735e29134c 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/BruteForceCrossDCTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/crossdc/BruteForceCrossDCTest.java
@@ -21,6 +21,9 @@ import java.io.IOException;
import java.net.URISyntaxException;
import javax.ws.rs.NotFoundException;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Before;
import org.junit.Test;
@@ -31,9 +34,11 @@ import org.keycloak.models.UserLoginFailureModel;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
+import org.keycloak.testsuite.AbstractTestRealmKeycloakTest;
import org.keycloak.testsuite.Assert;
import org.keycloak.testsuite.Retry;
import org.keycloak.testsuite.client.KeycloakTestingClient;
+import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
import org.keycloak.testsuite.util.ClientBuilder;
import org.keycloak.testsuite.util.OAuthClient;
import org.keycloak.testsuite.util.RealmBuilder;
@@ -45,7 +50,31 @@ import org.keycloak.testsuite.util.UserBuilder;
public class BruteForceCrossDCTest extends AbstractAdminCrossDCTest {
private static final String REALM_NAME = "brute-force-test";
-
+
+ @Deployment(name = "dc0")
+ @TargetsContainer(QUALIFIER_JBOSS_DC_0_NODE_1)
+ public static WebArchive deployDC0() {
+ return RunOnServerDeployment.create(
+ BruteForceCrossDCTest.class,
+ AbstractAdminCrossDCTest.class,
+ AbstractCrossDCTest.class,
+ AbstractTestRealmKeycloakTest.class,
+ KeycloakTestingClient.class
+ );
+ }
+
+ @Deployment(name = "dc1")
+ @TargetsContainer(QUALIFIER_JBOSS_DC_1_NODE_1)
+ public static WebArchive deployDC1() {
+ return RunOnServerDeployment.create(
+ BruteForceCrossDCTest.class,
+ AbstractAdminCrossDCTest.class,
+ AbstractCrossDCTest.class,
+ AbstractTestRealmKeycloakTest.class,
+ KeycloakTestingClient.class
+ );
+ }
+
@Before
public void beforeTest() {
try {
@@ -220,6 +249,7 @@ public class BruteForceCrossDCTest extends AbstractAdminCrossDCTest {
// TODO Having this working on Wildfly might be a challenge. Maybe require @Deployment with @TargetsContainer descriptor generated at runtime as we don't know the container qualifier at compile time... Maybe workaround by add endpoint to TestingResourceProvider if needed..
+ // resolution on Wildfly: make deployment available on both dc0_1 and dc1_1, see @Deployment methods
private void addUserLoginFailure(KeycloakTestingClient testingClient) throws URISyntaxException, IOException {
testingClient.server().run(session -> {
RealmModel realm = session.realms().getRealmByName(REALM_NAME);
diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml b/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml
index 55fa5e2eb3..55d5804ff2 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml
+++ b/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml
@@ -64,7 +64,7 @@
- ${auth.server.undertow} && ! ${auth.server.undertow.crossdc}
+ ${auth.server.undertow} && ! ${auth.server.crossdc}
0.0.0.0
org.keycloak.testsuite.arquillian.undertow.KeycloakOnUndertow
${auth.server.http.port}
@@ -74,7 +74,7 @@
- ${auth.server.jboss}
+ ${auth.server.jboss} && ! ${auth.server.crossdc}
${auth.server.adapter.impl.class}
${auth.server.home}
${auth.server.config.property.value}
@@ -186,18 +186,18 @@
-
-
+
+
- ${auth.server.undertow.crossdc} && ! ${cache.server.lifecycle.skip}
+ ${auth.server.crossdc} && ! ${cache.server.lifecycle.skip}
org.jboss.as.arquillian.container.managed.ManagedDeployableContainer
${cache.server.home}
clustered.xml
-Djboss.socket.binding.port-offset=${cache.server.port.offset}
-Djboss.default.multicast.address=234.56.78.99
- -Djboss.node.name=cache-server
+ -Djboss.node.name=cache-server-dc-1
${adapter.test.props}
${auth.server.profile}
@@ -213,7 +213,7 @@
- ${auth.server.undertow.crossdc} && ! ${cache.server.lifecycle.skip}
+ ${auth.server.crossdc} && ! ${cache.server.lifecycle.skip}
org.jboss.as.arquillian.container.managed.ManagedDeployableContainer
${cache.server.home}
true
@@ -238,11 +238,11 @@
- ${auth.server.undertow.crossdc}
+ ${auth.server.crossdc}
org.keycloak.testsuite.arquillian.undertow.lb.SimpleUndertowLoadBalancerContainer
localhost
${auth.server.http.port}
- auth-server-undertow-cross-dc-0_1=http://localhost:8101,auth-server-undertow-cross-dc-0_2-manual=http://localhost:8102,auth-server-undertow-cross-dc-1_1=http://localhost:8111,auth-server-undertow-cross-dc-1_2-manual=http://localhost:8112
+ auth-server-${node.name}-cross-dc-0_1=http://localhost:8101,auth-server-${node.name}-cross-dc-0_2-manual=http://localhost:8102,auth-server-${node.name}-cross-dc-1_1=http://localhost:8111,auth-server-${node.name}-cross-dc-1_2-manual=http://localhost:8112
@@ -253,7 +253,6 @@
localhost
${auth.server.http.port}
-79
- auth-server-undertow-cross-dc-0_1
${undertow.remote}
0
{
@@ -277,7 +276,6 @@
localhost
${auth.server.http.port}
-78
- auth-server-undertow-cross-dc-0_2-manual
${undertow.remote}
0
{
@@ -302,7 +300,6 @@
localhost
${auth.server.http.port}
-69
- auth-server-undertow-cross-dc-1_1
${undertow.remote}
1
{
@@ -326,7 +323,6 @@
localhost
${auth.server.http.port}
-68
- auth-server-undertow-cross-dc-1_2-manual
${undertow.remote}
1
{
@@ -343,8 +339,97 @@
}
-
+
+
+ ${auth.server.jboss.crossdc}
+ ${auth.server.adapter.impl.class}
+ ${auth.server.crossdc01.home}
+ standalone-ha.xml
+
+ -Djboss.socket.binding.port-offset=${auth.server.crossdc01.port.offset}
+ -Djboss.default.multicast.address=234.56.78.1
+ -Dremote.cache.port=12232
+ -Djboss.site.name=dc0
+ -Djboss.node.name=auth-server-${node.name}-cross-dc-0_1
+
+
+ -Djava.net.preferIPv4Stack=true
+ ${auth.server.crossdc01.jvm.debug.args}
+
+ ${auth.server.crossdc01.management.port}
+ -79
+ 0
+
+
+
+
+ ${auth.server.jboss.crossdc}
+ ${auth.server.adapter.impl.class}
+ ${auth.server.crossdc02.home}
+ standalone-ha.xml
+
+ -Djboss.socket.binding.port-offset=${auth.server.crossdc02.port.offset}
+ -Djboss.default.multicast.address=234.56.78.1
+ -Dremote.cache.port=12232
+ -Djboss.site.name=dc0
+ -Djboss.node.name=auth-server-${node.name}-cross-dc-0_2-manual
+
+
+ -Djava.net.preferIPv4Stack=true
+ ${auth.server.crossdc02.jvm.debug.args}
+
+ ${auth.server.crossdc02.management.port}
+ -78
+ 0
+
+
+
+
+ ${auth.server.jboss.crossdc}
+ ${auth.server.adapter.impl.class}
+ ${auth.server.crossdc11.home}
+ standalone-ha.xml
+
+ -Djboss.socket.binding.port-offset=${auth.server.crossdc11.port.offset}
+ -Djboss.default.multicast.address=234.56.78.2
+ -Dremote.cache.port=13232
+ -Djboss.site.name=dc1
+ -Djboss.node.name=auth-server-${node.name}-cross-dc-1_1
+
+
+ -Djava.net.preferIPv4Stack=true
+ ${auth.server.crossdc11.jvm.debug.args}
+
+ ${auth.server.crossdc11.management.port}
+ -69
+ 1
+
+
+
+
+ ${auth.server.jboss.crossdc}
+ ${auth.server.adapter.impl.class}
+ ${auth.server.crossdc12.home}
+ standalone-ha.xml
+
+ -Djboss.socket.binding.port-offset=${auth.server.crossdc12.port.offset}
+ -Djboss.default.multicast.address=234.56.78.2
+ -Dremote.cache.port=13232
+ -Djboss.site.name=dc1
+ -Djboss.node.name=auth-server-${node.name}-cross-dc-1_2-manual
+
+
+ -Djava.net.preferIPv4Stack=true
+ ${auth.server.crossdc12.jvm.debug.args}
+
+ ${auth.server.crossdc12.management.port}
+ -68
+ 1
+
+
+
+
diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml
index 43de93715e..96751f9b2d 100755
--- a/testsuite/integration-arquillian/tests/pom.xml
+++ b/testsuite/integration-arquillian/tests/pom.xml
@@ -41,10 +41,12 @@
undertow
true
- false
+
false
+ false
+ false
false
-
+
auth-server-${auth.server}
${containers.home}/${auth.server.container}
${auth.server.home}
@@ -60,16 +62,16 @@
-Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m
serverConfig
org.jboss.as.arquillian.container.managed.ManagedDeployableContainer
-
+
integration-arquillian-servers-auth-server-${auth.server}
${auth.server.undertow}
300
-
+
5005
n
-agentlib:jdwp=transport=dt_socket,server=y,suspend=${auth.server.debug.suspend},address=${auth.server.host}:${auth.server.debug.port}
-
+
false
@@ -91,7 +93,7 @@
-
+
${project.build.directory}/examples
htmlUnit
@@ -242,10 +244,10 @@
${auth.server.config.property.value}
${auth.server.adapter.impl.class}
${auth.server.jboss.jvm.debug.args}
-
+
${auth.server.profile}
${auth.server.feature}
-
+
${frontend.console.output}
${backend.console.output}
@@ -254,7 +256,7 @@
${adapter.test.props}
${migration.import.properties}
${kie.maven.settings}
-
+
${testsuite.constants}
${cli.log.output}
${test.intermittent}
@@ -287,10 +289,11 @@
${client.key.passphrase}
${auth.server.ocsp.responder.enabled}
-
+
${auth.server.crossdc}
${auth.server.undertow.crossdc}
+ ${auth.server.jboss.crossdc}
${cache.server.lifecycle.skip}
${cache.server}
@@ -367,14 +370,13 @@
-
+
auth-server-wildfly
wildfly
true
false
- false
standalone.xml
${auth.server.home}/standalone/configuration
1.3.173
@@ -393,7 +395,6 @@
eap
true
false
- false
standalone.xml
${auth.server.home}/standalone/configuration
1.3.173
@@ -406,14 +407,192 @@
+
+ auth-servers-crossdc-undertow
+
+ true
+ true
+ undertow
+
+
+
+
+ maven-enforcer-plugin
+
+
+ enforce-profile-activation
+
+ enforce
+
+
+
+
+ cache.server.jboss
+ Profile "auth-servers-crossdc-undertow" requires activation of another profile: either "cache-server-infinispan" or "cache-server-jdg".
+ true
+
+
+
+
+
+
+
+ maven-surefire-plugin
+
+
+ ${node.name}
+
+
+
+
+
+
+
+
+ auth-servers-crossdc-jboss
+
+ true
+ true
+ jboss
+
+ ${containers.home}/auth-server-${auth.server}-crossdc01
+ ${containers.home}/auth-server-${auth.server}-crossdc02
+ ${containers.home}/auth-server-${auth.server}-crossdc11
+ ${containers.home}/auth-server-${auth.server}-crossdc12
+
+
+ ${auth.server.crossdc01.home}/standalone/configuration
+
+ 5001
+ 5002
+ 5011
+ 5012
+
+
+ ${auth.server.debug.suspend}
+ ${auth.server.debug.suspend}
+ ${auth.server.debug.suspend}
+ ${auth.server.debug.suspend}
+
+
+
+
+
+ maven-antrun-plugin
+
+
+ copy-auth-server-crossdc-nodes
+ process-resources
+
+ run
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ maven-enforcer-plugin
+
+
+ enforce-profiles-activation
+
+ enforce
+
+
+
+
+ cache.server.jboss
+ Profile "auth-servers-crossdc-jboss" requires activation of another profile: either "cache-server-infinispan" or "cache-server-jdg".
+ true
+
+
+ auth.server.jboss
+ Profile "auth-servers-crossdc-jboss" requires activation of another profile: either "auth-server-wildfly" or "auth-server-eap".
+ true
+
+
+
+
+
+
+
+ maven-surefire-plugin
+
+
+
+ true
+ ${node.name}
+
+ ${auth.server.crossdc01.home}
+ ${auth.server.crossdc02.home}
+ ${auth.server.crossdc11.home}
+ ${auth.server.crossdc12.home}
+
+
+ 21
+
+ 22
+
+ 31
+
+ 32
+
+ 10011
+ 10012
+ 10021
+ 10022
+
+
+ -agentlib:jdwp=transport=dt_socket,server=y,suspend=${auth.server.crossdc01.debug.suspend},address=localhost:${auth.server.crossdc01.jvm.debug.port}
+
+
+ -agentlib:jdwp=transport=dt_socket,server=y,suspend=${auth.server.crossdc02.debug.suspend},address=localhost:${auth.server.crossdc02.jvm.debug.port}
+
+
+ -agentlib:jdwp=transport=dt_socket,server=y,suspend=${auth.server.crossdc11.debug.suspend},address=localhost:${auth.server.crossdc11.jvm.debug.port}
+
+
+ -agentlib:jdwp=transport=dt_socket,server=y,suspend=${auth.server.crossdc12.debug.suspend},address=localhost:${auth.server.crossdc12.jvm.debug.port}
+
+
+
+
+
+
+ maven-antrun-plugin
+
+ ${skipTests}
+
+
+
+
+
+
cache-server-infinispan
infinispan
- true
true
true
- ${cache.server.home}/standalone/configuration
+ ${cache.server.home}/standalone/configuration
%d{HH:mm:ss,SSS} [%t] %-5p [%c{1.}] %m%n
@@ -429,17 +608,15 @@
maven-enforcer-plugin
+ enforce-profile-activation
enforce
-
- cache.server
- (infinispan)|(jdg)
- Profile "cache-server-infinispan" requires activation of profile "cache-server-infinispan" or "cache-server-jdg".
+ auth.servers.crossdc
+ Profile "cache-server-infinispan" requires activation of another profile: either "auth-servers-crossdc-undertow" or "auth-servers-crossdc-jboss".
@@ -480,12 +657,11 @@
-
+
cache-server-jdg
jdg
- true
true
true
${cache.server.home}/standalone/configuration
@@ -504,17 +680,15 @@
maven-enforcer-plugin
+ enforce-profile-activation
enforce
-
- cache.server
- (infinispan)|(jdg)
- Profile "cache-server-jdg" requires activation of profile "cache-server-infinispan" or "cache-server-jdg".
+ auth.servers.crossdc
+ Profile "cache-server-jdg" requires activation of another profile: either "auth-servers-crossdc-undertow" or "auth-servers-crossdc-jboss".
@@ -569,8 +743,8 @@
auth-server-enable-disable-feature
@@ -765,7 +939,7 @@
-
+
jdbc-driver-dependency
@@ -807,13 +981,13 @@
-
+
auth-server-migration
target/test-classes/migration-test/migration-realm-${migrated.auth.server.version}.json
- -Dkeycloak.migration.action=import
+ -Dkeycloak.migration.action=import
-Dkeycloak.migration.provider=singleFile
-Dkeycloak.migration.file=${migration.import.file}
-Dkeycloak.migration.strategy=OVERWRITE_EXISTING
@@ -883,8 +1057,8 @@
-
-
+
+
migration-import
@@ -896,7 +1070,7 @@
target/test-classes/migration-test/migration-realm-${migrated.auth.server.version}.json
- -Dkeycloak.migration.action=import
+ -Dkeycloak.migration.action=import
-Dkeycloak.migration.provider=singleFile
-Dkeycloak.migration.file=${migration.import.file}
-Dkeycloak.migration.strategy=OVERWRITE_EXISTING
@@ -934,7 +1108,7 @@
-
+
migration-productized
@@ -946,7 +1120,7 @@
target/test-classes/migration-test/migration-realm-${migrated.version.import.file.suffix}.json
-
+
no-account
@@ -1280,7 +1454,7 @@
9999
-
+
kie.maven.settings
@@ -1299,7 +1473,7 @@
-
+
-
+