KEYCLOAK-7589 - adapter tests - Fuse7.0 provider

This commit is contained in:
vramik 2018-06-26 13:24:38 +02:00 committed by Pavel Drozd
parent 0e2e867e4a
commit 8ac7bda52c
18 changed files with 379 additions and 210 deletions

View file

@ -26,8 +26,8 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-arquillian-servers-app-server-fuse70</artifactId>
<packaging>pom</packaging>
<name>App Server - Karaf - JBoss Fuse 7.0</name>
<packaging>jar</packaging>
<name>App Server - Fuse 7.0</name>
<properties>
<app.server.karaf>fuse70</app.server.karaf>
@ -38,6 +38,29 @@
<app.server.karaf.client.auth>-u admin -p admin</app.server.karaf.client.auth>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-osgi</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>

View file

@ -0,0 +1,41 @@
/*
* 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.fuse;
import org.jboss.arquillian.container.osgi.OSGiApplicationArchiveProcessor;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.core.spi.LoadableExtension;
import org.keycloak.testsuite.utils.arquillian.fuse.CustomFuseContainer;
import org.keycloak.testsuite.utils.arquillian.fuse.KeycloakOSGiApplicationArchiveProcessor;
/**
*
* @author <a href="mailto:vramik@redhat.com">Vlasta Ramik</a>
*/
public class Fuse70AppServerArquillianExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder builder) {
builder.service(DeployableContainer.class, CustomFuseContainer.class);
builder.override(ApplicationArchiveProcessor.class, OSGiApplicationArchiveProcessor.class, KeycloakOSGiApplicationArchiveProcessor.class);
}
}

View file

@ -0,0 +1,92 @@
/*
* 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.fuse.container;
import java.util.ArrayList;
import java.util.List;
import org.jboss.arquillian.core.spi.Validate;
import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.keycloak.testsuite.arquillian.container.AppServerContainerProvider;
import org.keycloak.testsuite.utils.arquillian.fuse.CustomFuseContainer;
/**
* @author <a href="mailto:vramik@redhat.com">Vlasta Ramik</a>
*/
public class Fuse70AppServerProvider implements AppServerContainerProvider {
private Node configuration;
private static final String containerName = "fuse70";
private final String appServerHome;
private final String appServerJavaHome;
private final String managementUser;
private final String managementPassword;
public Fuse70AppServerProvider() {
appServerHome = System.getProperty("app.server.home");
appServerJavaHome = System.getProperty("app.server.java.home");
managementUser = System.getProperty("app.server.management.user");
managementPassword = System.getProperty("app.server.management.password");
Validate.notNullOrEmpty(appServerHome, "app.server.home is not set.");
Validate.notNullOrEmpty(appServerJavaHome, "app.server.java.home is not set.");
Validate.notNullOrEmpty(managementUser, "app.server.management.user is not set.");
Validate.notNullOrEmpty(managementPassword, "app.server.management.password is not set.");
}
@Override
public String getName() {
return containerName;
}
@Override
public List<Node> getContainers() {
List<Node> containers = new ArrayList<>();
containers.add(standaloneContainer());
return containers;
}
private void createChild(String name, String text) {
configuration.createChild("property").attribute("name", name).text(text);
}
private Node standaloneContainer() {
Node container = new Node("container");
container.attribute("mode", "manual");
container.attribute("qualifier", AppServerContainerProvider.APP_SERVER + "-" + containerName);
configuration = container.createChild("configuration");
createChild("enabled", "true");
createChild("adapterImplClass", CustomFuseContainer.class.getName());
createChild("autostartBundle", "false");
createChild("karafHome", appServerHome);
createChild("javaHome", appServerJavaHome);
createChild("javaVmArguments",
System.getProperty("app.server.karaf.jvm.debug.args", "") + " " +
System.getProperty("adapter.test.props", " ")
);
createChild("jmxServiceURL", "service:jmx:rmi://127.0.0.1:44444/jndi/rmi://127.0.0.1:1099/karaf-root");
createChild("jmxUsername", managementUser);
createChild("jmxPassword", managementPassword);
return container;
}
}

View file

@ -0,0 +1 @@
org.keycloak.testsuite.arquillian.fuse.Fuse70AppServerArquillianExtension

View file

@ -563,6 +563,60 @@
</plugins>
</build>
</profile>
<profile>
<id>app-server-fuse70</id>
<activation>
<property>
<name>app.server</name>
<value>fuse70</value>
</property>
</activation>
<properties>
<app.server>fuse70</app.server> <!--in case the profile is called directly-->
<app.server.skip.unpack>false</app.server.skip.unpack>
<!--fuse examples expect auth server on 8080-->
<auth.server.port.offset>0</auth.server.port.offset>
<auth.server.http.port>8080</auth.server.http.port>
<auth.server.management.port>9990</auth.server.management.port>
<!--fuse examples expect default karaf http port 8181-->
<app.server.http.port>8181</app.server.http.port>
<app.server.management.user>admin</app.server.management.user>
<app.server.management.password>admin</app.server.management.password>
<app.server.karaf.jvm.debug.args>-agentlib:jdwp=transport=dt_socket,server=y,suspend=${app.server.debug.suspend},address=localhost:${app.server.debug.port}</app.server.karaf.jvm.debug.args>
</properties>
<dependencies>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-servers-app-server-fuse70</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-karaf-managed</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<app.server.management.user>${app.server.management.user}</app.server.management.user>
<app.server.management.password>${app.server.management.password}</app.server.management.password>
<app.server.karaf.jvm.debug.args>${app.server.karaf.jvm.debug.args}</app.server.karaf.jvm.debug.args>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>auth-servers-crossdc-undertow</id>
<properties>

View file

@ -1,11 +1,11 @@
package org.keycloak.testsuite.adapter.page;
import org.keycloak.testsuite.page.AbstractPage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import javax.ws.rs.core.UriBuilder;
import org.keycloak.testsuite.util.JavascriptBrowser;
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
@ -27,15 +27,17 @@ public class Hawtio2Page extends AbstractPage {
}
@FindBy(xpath = "//a[@id ='userDropdownMenu']")
@JavascriptBrowser
private WebElement dropDownMenu;
@FindBy(xpath = "//a[@ng-click='userDetails.logout()']")
@JavascriptBrowser
private WebElement logoutButton;
public void logout() {
waitUntilElement(dropDownMenu).is().visible();
waitUntilElement(dropDownMenu).is().clickable();
dropDownMenu.click();
waitUntilElement(logoutButton).is().visible();
waitUntilElement(logoutButton).is().clickable();
logoutButton.click();
}
}

View file

@ -1,11 +1,11 @@
package org.keycloak.testsuite.adapter.page;
import org.keycloak.testsuite.page.AbstractPage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import javax.ws.rs.core.UriBuilder;
import org.keycloak.testsuite.util.JavascriptBrowser;
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
@ -27,18 +27,24 @@ public class HawtioPage extends AbstractPage {
}
@FindBy(xpath = "//a[@class='dropdown-toggle' and @data-original-title='Preferences and log out']")
@JavascriptBrowser
private WebElement dropDownMenu;
@FindBy(xpath = "//a[@ng-click='logout()']")
@JavascriptBrowser
private WebElement logoutButton;
@FindBy(xpath = "//input[@type='submit' and @value='Yes']")
@JavascriptBrowser
private WebElement modal;
public void logout() {
waitUntilElement(dropDownMenu).is().visible();
log.debug("logging out");
waitUntilElement(dropDownMenu).is().clickable();
dropDownMenu.click();
waitUntilElement(logoutButton).is().visible();
waitUntilElement(logoutButton).is().clickable();
logoutButton.click();
By modal = By.xpath("//input[@type='submit' and @value='Yes']");
waitUntilElement(modal).is().visible();
driver.findElement(modal).click();
waitUntilElement(modal).is().clickable();
modal.click();
}
}

View file

@ -21,6 +21,7 @@ import org.keycloak.testsuite.adapter.page.AppServerContextRoot;
import java.net.MalformedURLException;
import java.net.URL;
import org.keycloak.testsuite.util.DroneUtils;
/**
*
@ -54,7 +55,7 @@ public abstract class AbstractFuseExample extends AppServerContextRoot {
public void navigateTo() {
super.navigateTo();
if (driver.getPageSource().contains("<html><head></head><body></body></html>")) {
if (DroneUtils.getCurrentDriver().getPageSource().contains("<html><head></head><body></body></html>")) {
log.debug("Page wasn't properly loaded - redirecting.");
super.navigateTo();
}

View file

@ -36,4 +36,5 @@ public interface ContainerConstants {
public static final String APP_SERVER_EAP6_CLUSTER = APP_SERVER_EAP6 + "-ha-node-1;" + APP_SERVER_EAP6 + "-ha-node-2";
public static final String APP_SERVER_FUSE63 = APP_SERVER_PREFIX + "fuse63";
public static final String APP_SERVER_FUSE70 = APP_SERVER_PREFIX + "fuse70";
}

View file

@ -24,6 +24,8 @@ import org.keycloak.testsuite.arquillian.AuthServerTestEnricher;
public class ContainerAssume {
private static final Logger log = Logger.getLogger(ContainerAssume.class);
private static final String fuse6 = "fuse63";
private static final String fuse7 = "fuse70";
public static void assumeNotAuthServerUndertow() {
Assume.assumeFalse("Doesn't work on auth-server-undertow",
@ -40,4 +42,11 @@ public class ContainerAssume {
System.getProperty("app.server", "undertow").equals("undertow"));
}
public static void assumeNotAppServerFuse6() {
Assume.assumeFalse("The test doesn't work on " + fuse6, fuse6.equals(System.getProperty("app.server")));
}
public static void assumeNotAppServerFuse7() {
Assume.assumeFalse("The test doesn't work on " + fuse7, fuse7.equals(System.getProperty("app.server")));
}
}

View file

@ -17,6 +17,7 @@
package org.keycloak.testsuite.adapter.example.fuse;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
@ -29,6 +30,7 @@ import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
@ -53,21 +55,45 @@ import org.apache.sshd.client.channel.ClientChannelEvent;
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.client.session.ClientSession.ClientSessionEvent;
import org.hamcrest.Matchers;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest;
import org.keycloak.testsuite.adapter.page.Hawtio2Page;
import org.keycloak.testsuite.adapter.page.HawtioPage;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.arquillian.containers.ContainerConstants;
import org.keycloak.testsuite.auth.page.login.OIDCLogin;
import org.keycloak.testsuite.util.ContainerAssume;
import org.keycloak.testsuite.util.DroneUtils;
import org.keycloak.testsuite.util.JavascriptBrowser;
import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
@AppServerContainer(ContainerConstants.APP_SERVER_FUSE63)
@AppServerContainer(ContainerConstants.APP_SERVER_FUSE70)
public class FuseAdminAdapterTest extends AbstractExampleAdapterTest {
@Drone
@JavascriptBrowser
protected WebDriver jsDriver;
@Page
@JavascriptBrowser
private HawtioPage hawtioPage;
@Page
@JavascriptBrowser
private Hawtio2Page hawtio2Page;
@Page
@JavascriptBrowser
private OIDCLogin testRealmLoginPageFuse;
private SshClient client;
protected enum Result { OK, NOT_FOUND, NO_CREDENTIALS, NO_ROLES };
@ -81,41 +107,122 @@ public class FuseAdminAdapterTest extends AbstractExampleAdapterTest {
@Override
public void setDefaultPageUriParameters() {
super.setDefaultPageUriParameters();
testRealmPage.setAuthRealm(DEMO);
testRealmLoginPage.setAuthRealm(DEMO);
testRealmLoginPageFuse.setAuthRealm(DEMO);
}
@Before
public void addJsDriver() {
DroneUtils.addWebDriver(jsDriver);
}
@Test
public void hawtioLoginTest() throws Exception {
// Note that this does works only in Fuse 6 with Hawtio 1 since Fuse 7 contains Hawtio 2, and is thus overriden in Fuse 7 test classes
public void hawtio1LoginTest() throws Exception {
// Note that this does work only in Fuse 6 with Hawtio 1, Fuse 7 contains Hawtio 2
ContainerAssume.assumeNotAppServerFuse7();
hawtioPage.navigateTo();
testRealmLoginPage.form().login("user", "invalid-password");
testRealmLoginPageFuse.form().login("user", "invalid-password");
assertCurrentUrlDoesntStartWith(hawtioPage);
testRealmLoginPage.form().login("invalid-user", "password");
testRealmLoginPageFuse.form().login("invalid-user", "password");
assertCurrentUrlDoesntStartWith(hawtioPage);
testRealmLoginPage.form().login("root", "password");
assertCurrentUrlStartsWith(hawtioPage.toString() + "/welcome", hawtioPage.getDriver());
testRealmLoginPageFuse.form().login("root", "password");
assertCurrentUrlStartsWith(hawtioPage.toString() + "/welcome");
hawtioPage.logout();
assertCurrentUrlStartsWith(testRealmLoginPage);
assertCurrentUrlStartsWith(testRealmLoginPageFuse);
hawtioPage.navigateTo();
testRealmLoginPage.form().login("mary", "password");
assertThat(driver.getPageSource(), not(containsString("welcome")));
log.debug("logging in as mary");
testRealmLoginPageFuse.form().login("mary", "password");
log.debug("Previous WARN waitForPageToLoad time exceeded! is expected");
assertThat(DroneUtils.getCurrentDriver().getPageSource(),
allOf(
containsString("Unauthorized User"),
not(containsString("welcome"))
)
);
}
@Test
public void hawtio2LoginTest() throws Exception {
// Note that this does work only in Fuse 7 with Hawtio 2, Fuse 6 contains Hawtio 1
ContainerAssume.assumeNotAppServerFuse6();
hawtio2Page.navigateTo();
WaitUtils.waitForPageToLoad();
testRealmLoginPageFuse.form().login("user", "invalid-password");
assertCurrentUrlDoesntStartWith(hawtio2Page);
testRealmLoginPageFuse.form().login("invalid-user", "password");
assertCurrentUrlDoesntStartWith(hawtio2Page);
testRealmLoginPageFuse.form().login("root", "password");
assertCurrentUrlStartsWith(hawtio2Page.toString());
WaitUtils.waitForPageToLoad();
WaitUtils.waitUntilElement(By.xpath("//img[@alt='Red Hat Fuse Management Console']")).is().present();
hawtio2Page.logout();
WaitUtils.waitForPageToLoad();
assertCurrentUrlStartsWith(testRealmLoginPageFuse);
hawtio2Page.navigateTo();
WaitUtils.waitForPageToLoad();
log.debug("logging in as mary");
testRealmLoginPageFuse.form().login("mary", "password");
log.debug("Current URL: " + DroneUtils.getCurrentDriver().getCurrentUrl());
assertCurrentUrlStartsWith(hawtio2Page.toString());
WaitUtils.waitForPageToLoad();
assertThat(DroneUtils.getCurrentDriver().getPageSource(),
allOf(
containsString("keycloak-session-iframe"),//todo check this if it's correct
not(containsString("Camel"))
)
);
}
@Test
public void sshLoginTest() throws Exception {
// Note that this does not work for Fuse 7 since the error codes have changed, and is thus overriden for Fuse 7 test classes
public void sshLoginTestFuse6() throws Exception {
// Note that this does not work for Fuse 7 since the error codes have changed
ContainerAssume.assumeNotAppServerFuse7();
assertCommand("mary", "password", "shell:date", Result.NO_CREDENTIALS);
assertCommand("john", "password", "shell:info", Result.NO_CREDENTIALS);
assertCommand("john", "password", "shell:date", Result.OK);
assertCommand("root", "password", "shell:info", Result.OK);
}
@Test
public void sshLoginTestFuse7() throws Exception {
// Note that this works for Fuse 7 and newer
ContainerAssume.assumeNotAppServerFuse6();
assertCommand("mary", "password", "shell:date", Result.NOT_FOUND);
assertCommand("john", "password", "shell:info", Result.NOT_FOUND);
assertCommand("john", "password", "shell:date", Result.OK);
assertRoles("root",
"ssh",
"jmxAdmin",
"admin",
"manager",
"viewer",
"Administrator",
"Auditor",
"Deployer",
"Maintainer",
"Operator",
"SuperUser"
);
}
private void assertRoles(String username, String... expectedRoles) throws Exception {
final String commandOutput = getCommandOutput(username, "password", "jaas:whoami -r --no-format");
final List<String> parsedOutput = Arrays.asList(commandOutput.split("\\n+"));
assertThat(parsedOutput, Matchers.containsInAnyOrder(expectedRoles));
}
@Test
public void jmxLoginTest() throws Exception {
setJMXAuthentication("keycloak", "password");

View file

@ -46,6 +46,7 @@ import org.keycloak.testsuite.util.WaitUtils;
* @author tkyjovsk
*/
@AppServerContainer(ContainerConstants.APP_SERVER_FUSE63)
@AppServerContainer(ContainerConstants.APP_SERVER_FUSE70)
public class FuseExampleAdapterTest extends AbstractExampleAdapterTest {
@Page

View file

@ -1,48 +0,0 @@
<?xml version="1.0"?>
<!--
~ Copyright 2016 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.
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-tests-adapters-karaf</artifactId>
<version>4.1.0.Final-SNAPSHOT</version>
</parent>
<artifactId>integration-arquillian-tests-adapters-fuse70</artifactId>
<name>Adapter Tests - Karaf - JBoss Fuse 7.0</name>
<properties>
<app.server>fuse70</app.server>
<app.server.management.user>admin</app.server.management.user>
<app.server.management.password>admin</app.server.management.password>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
</dependencies>
</project>

View file

@ -1,96 +0,0 @@
/*
* Copyright 2016 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.adapter.example;
import org.keycloak.testsuite.adapter.page.Hawtio2Page;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
import org.keycloak.testsuite.util.WaitUtils;
import java.util.Arrays;
import java.util.List;
import org.hamcrest.Matchers;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Test;
import org.openqa.selenium.By;
import static org.junit.Assert.assertThat;
import org.keycloak.testsuite.adapter.example.fuse.FuseAdminAdapterTest;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlDoesntStartWith;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
@AppServerContainer("app-server-fuse70")
public class Fuse70AdminAdapterTest extends FuseAdminAdapterTest {
@Page
protected Hawtio2Page hawtioPage;
@Test
@Override
public void hawtioLoginTest() throws Exception {
hawtioPage.navigateTo();
WaitUtils.waitForPageToLoad();
testRealmLoginPage.form().login("user", "invalid-password");
assertCurrentUrlDoesntStartWith(hawtioPage);
testRealmLoginPage.form().login("invalid-user", "password");
assertCurrentUrlDoesntStartWith(hawtioPage);
testRealmLoginPage.form().login("root", "password");
assertCurrentUrlStartsWith(hawtioPage.toString(), hawtioPage.getDriver());
WaitUtils.waitForPageToLoad();
WaitUtils.waitUntilElement(By.linkText("Camel"));
hawtioPage.logout();
WaitUtils.waitForPageToLoad();
assertCurrentUrlStartsWith(testRealmLoginPage);
hawtioPage.navigateTo();
WaitUtils.waitForPageToLoad();
testRealmLoginPage.form().login("mary", "password");
assertCurrentUrlStartsWith(hawtioPage.toString(), hawtioPage.getDriver());
WaitUtils.waitForPageToLoad();
WaitUtils.waitUntilElementIsNotPresent(By.linkText("Camel"));
}
@Test
@Override
public void sshLoginTest() throws Exception {
assertCommand("mary", "password", "shell:date", Result.NOT_FOUND);
assertCommand("john", "password", "shell:info", Result.NOT_FOUND);
assertCommand("john", "password", "shell:date", Result.OK);
assertRoles("root",
"ssh",
"jmxAdmin",
"admin",
"manager",
"viewer",
"Administrator",
"Auditor",
"Deployer",
"Maintainer",
"Operator",
"SuperUser"
);
}
private void assertRoles(String username, String... expectedRoles) throws Exception {
final String commandOutput = getCommandOutput(username, "password", "jaas:whoami -r --no-format");
final List<String> parsedOutput = Arrays.asList(commandOutput.split("\\n+"));
assertThat(parsedOutput, Matchers.containsInAnyOrder(expectedRoles));
}
}

View file

@ -1,26 +0,0 @@
/*
* Copyright 2016 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.adapter.example;
import org.keycloak.testsuite.adapter.example.fuse.FuseExampleAdapterTest;
import org.keycloak.testsuite.arquillian.annotation.AppServerContainer;
@AppServerContainer("app-server-fuse70")
public class Fuse70ExampleAdapterTest extends FuseExampleAdapterTest {
}

View file

@ -65,12 +65,6 @@
<module>fuse62</module>
</modules>
</profile>
<profile>
<id>app-server-fuse70</id>
<modules>
<module>fuse70</module>
</modules>
</profile>
</profiles>
</project>

View file

@ -1492,6 +1492,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak.testsuite</groupId>
<artifactId>integration-arquillian-util</artifactId>
<version>${project.version}</version>
</dependency>
<!-- <dependency>
<groupId>org.arquillian.extension</groupId>
<artifactId>arquillian-recorder-reporter-impl</artifactId>