use of org.keycloak.testsuite.arquillian.ContainerInfo in project keycloak by keycloak.
the class AbstractInvalidationClusterTest method assertEntityOnSurvivorNodesEqualsTo.
protected void assertEntityOnSurvivorNodesEqualsTo(T testEntityOnFailNode) {
boolean entityDiffers = false;
for (ContainerInfo survivorNode : getCurrentSurvivorNodes()) {
log.debug(String.format("Attempt to verify %s on survivor %s (%s)", getEntityType(testEntityOnFailNode), survivorNode, survivorNode.getContextRoot()));
T testEntityOnSurvivorNode = readEntity(testEntityOnFailNode, survivorNode);
if (EqualsBuilder.reflectionEquals(sortFields(testEntityOnSurvivorNode), sortFields(testEntityOnFailNode), excludedComparisonFields)) {
log.info(String.format("Verification of %s on survivor %s PASSED", getEntityType(testEntityOnFailNode), survivorNode));
} else {
entityDiffers = true;
log.error(String.format("Verification of %s on survivor %s FAILED", getEntityType(testEntityOnFailNode), survivorNode));
String tf = ReflectionToStringBuilder.reflectionToString(testEntityOnFailNode, ToStringStyle.SHORT_PREFIX_STYLE);
String ts = ReflectionToStringBuilder.reflectionToString(testEntityOnSurvivorNode, ToStringStyle.SHORT_PREFIX_STYLE);
log.error(String.format("\nEntity on fail node: \n%s\n" + "\nEntity on survivor node: \n%s\n" + "\nDifference: \n%s\n", tf, ts, StringUtils.difference(tf, ts)));
}
}
assertFalse(entityDiffers);
}
use of org.keycloak.testsuite.arquillian.ContainerInfo in project keycloak by keycloak.
the class AbstractInvalidationClusterTest method assertEntityOnSurvivorNodesIsDeleted.
private void assertEntityOnSurvivorNodesIsDeleted(T testEntityOnFailNode) {
// check if deleted from all survivor nodes
boolean entityExists = false;
for (ContainerInfo survivorNode : getCurrentSurvivorNodes()) {
T testEntityOnSurvivorNode = readEntity(testEntityOnFailNode, survivorNode);
if (testEntityOnSurvivorNode == null) {
log.info(String.format("Verification of %s deletion on survivor %s PASSED", getEntityType(testEntityOnFailNode), survivorNode));
} else {
entityExists = true;
log.error(String.format("Verification of %s deletion on survivor %s FAILED", getEntityType(testEntityOnFailNode), survivorNode));
}
}
assertFalse(entityExists);
}
use of org.keycloak.testsuite.arquillian.ContainerInfo in project keycloak by keycloak.
the class ConcurrentLoginClusterTest method beforeTest.
@Before
@Override
public void beforeTest() {
// Start backend nodes
log.info("Starting 2 backend nodes now");
for (ContainerInfo node : suiteContext.getAuthServerBackendsInfo()) {
if (!controller.isStarted(node.getQualifier())) {
log.info("Starting backend node: " + node);
controller.start(node.getQualifier());
Assert.assertTrue(controller.isStarted(node.getQualifier()));
}
}
// Import realms
log.info("Importing realms");
List<RealmRepresentation> testRealms = new LinkedList<>();
super.addTestRealms(testRealms);
for (RealmRepresentation testRealm : testRealms) {
importRealm(testRealm);
}
log.info("Realms imported");
// Finally create clients
createClients();
}
use of org.keycloak.testsuite.arquillian.ContainerInfo in project keycloak by keycloak.
the class SpiProvidersSwitchingUtils method removeProvider.
public static void removeProvider(SuiteContext suiteContext, SetDefaultProvider annotation) {
ContainerInfo authServerInfo = suiteContext.getAuthServerInfo();
SpiSwitcher spiSwitcher = SpiSwitcher.getSpiSwitcherFor(authServerInfo);
String spi = annotation.spi();
Container container = authServerInfo.getArquillianContainer();
log.infof("Removing default provider setting for %s", spi);
if (annotation.onlyUpdateDefault()) {
spiSwitcher.unsetDefaultProvider(container, spi);
} else {
spiSwitcher.removeProviderConfig(container, spi);
}
}
use of org.keycloak.testsuite.arquillian.ContainerInfo in project keycloak by keycloak.
the class SpiProvidersSwitchingUtils method addProviderDefaultValue.
public static void addProviderDefaultValue(SuiteContext suiteContext, SetDefaultProvider annotation) {
ContainerInfo authServerInfo = suiteContext.getAuthServerInfo();
SpiSwitcher spiSwitcher = SpiSwitcher.getSpiSwitcherFor(authServerInfo);
String spi = annotation.spi();
Container container = authServerInfo.getArquillianContainer();
log.infof("Setting default provider for %s to %s", spi, annotation.providerId());
if (annotation.onlyUpdateDefault()) {
spiSwitcher.getCurrentDefaultProvider(container, spi, annotation).ifPresent(v -> originalSettingsBackup.put(spi, v));
spiSwitcher.updateDefaultProvider(container, spi, annotation.providerId());
} else {
spiSwitcher.setDefaultProvider(container, spi, annotation.providerId());
}
}
Aggregations