From 2a349673b9e283ddffd980f56a9d3b6e6b4c9ac0 Mon Sep 17 00:00:00 2001 From: mposolda Date: Wed, 23 Sep 2015 14:47:20 +0200 Subject: [PATCH] Fix integration-arquillian --- .../testsuite/console/page/roles/RoleForm.java | 15 ++++++++++++++- .../console/clients/ClientRolesTest.java | 2 +- .../testsuite/console/roles/DefaultRolesTest.java | 2 +- .../testsuite/console/roles/RealmRolesTest.java | 6 +++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/roles/RoleForm.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/roles/RoleForm.java index ac1db15fa8..b4f974a485 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/roles/RoleForm.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/roles/RoleForm.java @@ -18,6 +18,9 @@ public class RoleForm extends Form { @FindBy(id = "description") private WebElement descriptionInput; + @FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='scopeParamRequired']]") + private OnOffSwitch scopeParamRequired; + @FindBy(xpath = ".//div[contains(@class,'onoffswitch') and ./input[@id='compositeSwitch']]") private OnOffSwitch compositeSwitch; @@ -28,7 +31,7 @@ public class RoleForm extends Form { private WebElement removeIcon; public RoleRepresentation getRole() { - RoleRepresentation role = new RoleRepresentation(getName(), getDescription()); + RoleRepresentation role = new RoleRepresentation(getName(), getDescription(), isScopeParamRequired()); role.setComposite(isComposite()); if (role.isComposite()) { role.setComposites(compositeRoles.getComposites()); @@ -44,6 +47,7 @@ public class RoleForm extends Form { RoleRepresentation role = new RoleRepresentation(); role.setName(getName()); role.setDescription(getDescription()); + role.setScopeParamRequired(isScopeParamRequired()); role.setComposite(isComposite()); log.info(role.getName() + ": " + role.getDescription() + ", comp: " + role.isComposite()); return role; @@ -52,6 +56,7 @@ public class RoleForm extends Form { public void setBasicAttributes(RoleRepresentation role) { setName(role.getName()); setDescription(role.getDescription()); + setScopeParamRequired(role.isScopeParamRequired()); if (role.isComposite()) { setCompositeRoles(role); } @@ -82,6 +87,14 @@ public class RoleForm extends Form { return getInputValue(descriptionInput); } + public void setScopeParamRequired(boolean scopeParamRequired) { + this.scopeParamRequired.setOn(scopeParamRequired); + } + + public boolean isScopeParamRequired() { + return scopeParamRequired.isOn(); + } + public void setComposite(boolean composite) { compositeSwitch.setOn(composite); } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientRolesTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientRolesTest.java index e005d6048c..a8a4c35e41 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientRolesTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientRolesTest.java @@ -44,7 +44,7 @@ public class ClientRolesTest extends AbstractClientTest { @Test public void testAddClientRole() { ClientRepresentation newClient = createClientRepresentation("test-client1", "http://example.com/*"); - RoleRepresentation newRole = new RoleRepresentation("client-role", ""); + RoleRepresentation newRole = new RoleRepresentation("client-role", "", false); createClient(newClient); assertFlashMessageSuccess(); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/roles/DefaultRolesTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/roles/DefaultRolesTest.java index 2f3bd8e3bf..e156c39699 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/roles/DefaultRolesTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/roles/DefaultRolesTest.java @@ -30,7 +30,7 @@ public class DefaultRolesTest extends AbstractRolesTest { @Before public void beforeDefaultRolesTest() { // create a role via admin client - defaultRoleRep = new RoleRepresentation("default-role", ""); + defaultRoleRep = new RoleRepresentation("default-role", "", false); rolesPage.rolesResource().create(defaultRoleRep); defaultRolesPage.navigateTo(); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/roles/RealmRolesTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/roles/RealmRolesTest.java index f92ccacaee..0df9c152ab 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/roles/RealmRolesTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/roles/RealmRolesTest.java @@ -32,7 +32,7 @@ public class RealmRolesTest extends AbstractRolesTest { @Before public void beforeTestAddNewRole() { - testRole = new RoleRepresentation("test_role", "role description"); + testRole = new RoleRepresentation("test_role", "role description", false); realmRolesPage.navigateTo(); } @@ -104,7 +104,7 @@ public class RealmRolesTest extends AbstractRolesTest { @Ignore public void testAddRoleWithLongName() { String name = "hjewr89y1894yh98(*&*&$jhjkashd)*(&y8934h*&@#hjkahsdj"; - addRole(new RoleRepresentation(name, "")); + addRole(new RoleRepresentation(name, "", false)); assertNotNull(realmRolesPage.table().findRole(name)); } @@ -124,7 +124,7 @@ public class RealmRolesTest extends AbstractRolesTest { Timer.time(); for (int i = 0; i < count; i++) { String roleName = String.format("%s%02d", namePrefix, i); - RoleRepresentation rr = new RoleRepresentation(roleName, ""); + RoleRepresentation rr = new RoleRepresentation(roleName, "", false); testRealmResource().roles().create(rr); } Timer.time("create " + count + " roles");