keycloak-uncached

Details

diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/clustering/ClientClusteringForm.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/clustering/ClientClusteringForm.java
new file mode 100644
index 0000000..e8e2748
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/clustering/ClientClusteringForm.java
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite.console.page.clients.clustering;
+
+import org.keycloak.testsuite.page.Form;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.ui.Select;
+
+/**
+ *
+ * @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
+ */
+public class ClientClusteringForm extends Form {
+
+    @FindBy(id = "nodeReRegistrationTimeout")
+    private WebElement nodeReRegistrationTimeoutInput;
+    
+    @FindBy(xpath = ".//select")
+    private Select nodeReRegistrationTimeoutUnitSelect;
+    
+    @FindBy(linkText = "Register node manually")
+    private WebElement registerNodeManuallyLink;
+    
+    @FindBy(id = "host")
+    private WebElement hostNameInput;
+
+    private void setNodeReRegistrationTimeout(String value) {
+        setInputValue(nodeReRegistrationTimeoutInput, value);
+    }
+    
+    private void setNodeReRegistrationTimeoutUnit(String value) {
+        nodeReRegistrationTimeoutUnitSelect.selectByVisibleText(value);
+    }
+    
+    public void setNodeReRegistrationTimeout(String timeout, String unit) {
+        setNodeReRegistrationTimeoutUnit(unit);
+        setNodeReRegistrationTimeout(timeout);
+    }
+    
+    public void addNode(String hostName) {
+        registerNodeManuallyLink.click();
+//        waitforElement(hostNameInput);
+        setInputValue(hostNameInput, hostName);
+        save();
+    }
+}
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/installation/ClientInstallationForm.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/installation/ClientInstallationForm.java
new file mode 100644
index 0000000..6ed4d9e
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/clients/installation/ClientInstallationForm.java
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite.console.page.clients.installation;
+
+import org.keycloak.testsuite.page.Form;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.ui.Select;
+
+/**
+ *
+ * @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
+ */
+public class ClientInstallationForm extends Form {
+
+    @FindBy(id = "configFormats")
+    private Select configFormatsSelect;
+    
+    @FindBy(tagName = "textarea")
+    private WebElement textarea;
+
+    public void setConfigFormat(String value) {
+        configFormatsSelect.selectByVisibleText(value);
+    }
+    
+    public String getTextareaContent() {
+        return textarea.getText();
+    }
+}
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientClusteringTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientClusteringTest.java
new file mode 100644
index 0000000..4bfe7c8
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientClusteringTest.java
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite.console.clients;
+
+import org.jboss.arquillian.graphene.page.Page;
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.Test;
+import org.keycloak.representations.idm.ClientRepresentation;
+import static org.keycloak.testsuite.console.clients.AbstractClientTest.createOidcClientRep;
+import static org.keycloak.testsuite.console.page.clients.CreateClientForm.OidcAccessType.CONFIDENTIAL;
+import org.keycloak.testsuite.console.page.clients.clustering.ClientClustering;
+
+/**
+ *
+ * @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
+ */
+public class ClientClusteringTest extends AbstractClientTest {
+
+    private ClientRepresentation newClient;
+    private ClientRepresentation found;
+    
+    @Page
+    private ClientClustering clientClusteringPage;
+    
+    @Before
+    public void before() {
+        newClient = createOidcClientRep(CONFIDENTIAL, TEST_CLIENT_ID, TEST_REDIRECT_URIS);
+        testRealmResource().clients().create(newClient).close();
+        
+        found = findClientByClientId(TEST_CLIENT_ID);
+        assertNotNull("Client " + TEST_CLIENT_ID + " was not found.", found);
+        clientClusteringPage.setId(found.getId());
+        clientClusteringPage.navigateTo();
+    }
+    
+    @Test
+    public void basicConfigurationTest() {
+        assertTrue(found.getNodeReRegistrationTimeout() == -1);
+        
+        clientClusteringPage.form().setNodeReRegistrationTimeout("10", "Seconds");
+        clientClusteringPage.form().save();
+        assertFlashMessageSuccess();
+        assertTrue(findClientByClientId(TEST_CLIENT_ID).getNodeReRegistrationTimeout() == 10);
+        
+        clientClusteringPage.form().setNodeReRegistrationTimeout("10", "Minutes");
+        clientClusteringPage.form().save();
+        assertFlashMessageSuccess();
+        assertTrue(findClientByClientId(TEST_CLIENT_ID).getNodeReRegistrationTimeout() == 600);
+        
+        clientClusteringPage.form().setNodeReRegistrationTimeout("1", "Hours");
+        clientClusteringPage.form().save();
+        assertFlashMessageSuccess();
+        assertTrue(findClientByClientId(TEST_CLIENT_ID).getNodeReRegistrationTimeout() == 3600);
+        
+        clientClusteringPage.form().setNodeReRegistrationTimeout("1", "Days");
+        clientClusteringPage.form().save();
+        assertFlashMessageSuccess();
+        assertTrue(findClientByClientId(TEST_CLIENT_ID).getNodeReRegistrationTimeout() == 86400);
+        
+        clientClusteringPage.form().setNodeReRegistrationTimeout("", "Days");
+        clientClusteringPage.form().save();
+        assertFlashMessageDanger();
+        
+        clientClusteringPage.form().setNodeReRegistrationTimeout("text", "Days");
+        clientClusteringPage.form().save();
+        assertFlashMessageDanger();
+    }
+    
+    @Test
+    public void registerNodeTest() {
+        clientClusteringPage.form().addNode("new node");
+        assertFlashMessageSuccess();
+        assertNotNull(findClientByClientId(TEST_CLIENT_ID).getRegisteredNodes().get("new node"));
+        
+        clientClusteringPage.form().addNode("");
+        assertFlashMessageDanger();
+    }
+}
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientInstallationTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientInstallationTest.java
new file mode 100644
index 0000000..3ee6335
--- /dev/null
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientInstallationTest.java
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.testsuite.console.clients;
+
+import org.jboss.arquillian.graphene.page.Page;
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.Test;
+import org.keycloak.representations.idm.ClientRepresentation;
+import static org.keycloak.testsuite.console.clients.AbstractClientTest.createOidcClientRep;
+import org.keycloak.testsuite.console.page.clients.installation.ClientInstallation;
+import static org.keycloak.testsuite.console.page.clients.CreateClientForm.OidcAccessType.CONFIDENTIAL;
+
+/**
+ *
+ * @author <a href="mailto:vramik@redhat.com">Vlastislav Ramik</a>
+ */
+public class ClientInstallationTest extends AbstractClientTest {
+
+    private ClientRepresentation newClient;
+    private ClientRepresentation found;
+    
+    @Page
+    private ClientInstallation clientInstallationPage;
+    
+    @Before
+    public void before() {
+        newClient = createOidcClientRep(CONFIDENTIAL, TEST_CLIENT_ID, TEST_REDIRECT_URIS);
+        testRealmResource().clients().create(newClient).close();
+        
+        found = findClientByClientId(TEST_CLIENT_ID);
+        assertNotNull("Client " + TEST_CLIENT_ID + " was not found.", found);
+        clientInstallationPage.setId(found.getId());
+        clientInstallationPage.navigateTo();
+    }
+    
+    @Test
+    public void jsonTest() {
+        clientInstallationPage.form().setConfigFormat("Keycloak JSON");
+        assertTrue(clientInstallationPage.form().getTextareaContent().contains("\"realm\": \"test\""));
+    }
+    
+    @Test
+    public void wildflySubsystemTest() {
+        clientInstallationPage.form().setConfigFormat("Wildfly/EAP Subsystem XML");
+        assertTrue(clientInstallationPage.form().getTextareaContent().contains("<realm>test</realm>"));
+    }
+}
diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientScopeTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientScopeTest.java
index 94d0db6..cf5a464 100644
--- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientScopeTest.java
+++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/clients/ClientScopeTest.java
@@ -33,7 +33,6 @@ import org.keycloak.representations.idm.MappingsRepresentation;
 import org.keycloak.representations.idm.RoleRepresentation;
 import static org.keycloak.testsuite.console.clients.AbstractClientTest.createOidcClientRep;
 import static org.keycloak.testsuite.console.page.clients.CreateClientForm.OidcAccessType.CONFIDENTIAL;
-import org.keycloak.testsuite.console.page.clients.credentials.ClientCredentialsGeneratePrivateKeys;
 import org.keycloak.testsuite.console.page.clients.scope.ClientScope;
 
 /**
@@ -47,8 +46,6 @@ public class ClientScopeTest extends AbstractClientTest {
     
     @Page
     private ClientScope clientScopePage;
-    @Page
-    private ClientCredentialsGeneratePrivateKeys generatePrivateKeysPage;
     
     @Before
     public void before() {