keycloak-uncached

Details

diff --git a/distribution/demo-dist/src/main/xslt/standalone.xsl b/distribution/demo-dist/src/main/xslt/standalone.xsl
index 6099aa2..b75b775 100755
--- a/distribution/demo-dist/src/main/xslt/standalone.xsl
+++ b/distribution/demo-dist/src/main/xslt/standalone.xsl
@@ -42,14 +42,14 @@
     <xsl:template match="//ds:datasources">
         <xsl:copy>
             <xsl:apply-templates select="node()[name(.)='datasource']"/>
-            <xa-datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" use-java-context="true">
-                <xa-datasource-property name="URL">jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE</xa-datasource-property>
+            <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" use-java-context="true">
+                <connection-url>jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE</connection-url>
                 <driver>h2</driver>
                 <security>
                     <user-name>sa</user-name>
                     <password>sa</password>
                 </security>
-            </xa-datasource>
+            </datasource>
             <xsl:apply-templates select="node()[name(.)='drivers']"/>
         </xsl:copy>
     </xsl:template>
diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/common/datasource.xsl b/testsuite/integration-arquillian/servers/auth-server/jboss/common/datasource.xsl
index 72b0403..f5ac4cd 100644
--- a/testsuite/integration-arquillian/servers/auth-server/jboss/common/datasource.xsl
+++ b/testsuite/integration-arquillian/servers/auth-server/jboss/common/datasource.xsl
@@ -29,42 +29,24 @@
     <!-- Remove keycloak datasource definition. -->
     <xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
 		         /*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
-                         /*[local-name()='xa-datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
+                         /*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
     </xsl:template>
     
     <xsl:param name="db.jdbc_url"/>
-    <xsl:param name="db.hostname"/>
-    <xsl:param name="db.name"/>
-    <xsl:param name="db.port"/>
     <xsl:param name="driver"/>
-    <xsl:param name="datasource.class.xa"/>
+
+    <xsl:param name="min.poolsize" select="'10'"/>
+    <xsl:param name="max.poolsize" select="'50'"/>
+    <xsl:param name="pool.prefill" select="'true'"/>
     
     <xsl:param name="username"/>
     <xsl:param name="password"/>
     
     <xsl:variable name="newDatasourceDefinition">
-        <xa-datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" use-java-context="true">
-            <xsl:choose>
-                <xsl:when test="contains($driver, 'oracle')">
-                    <xa-datasource-property name="URL">
-                        <xsl:value-of select="$db.jdbc_url"/>
-                    </xa-datasource-property>
-                </xsl:when>
-                <xsl:otherwise>
-                    <xa-datasource-property name="ServerName">
-                        <xsl:value-of select="$db.hostname"/>
-                    </xa-datasource-property>
-                    <xa-datasource-property name="PortNumber">
-                        <xsl:value-of select="$db.port"/>
-                    </xa-datasource-property>
-                    <xa-datasource-property name="DatabaseName">
-                        <xsl:value-of select="$db.name"/>
-                    </xa-datasource-property>
-                    <xsl:if test="contains($driver, 'db2')">
-                        <xa-datasource-property name="DriverType">4</xa-datasource-property>
-                    </xsl:if>
-                </xsl:otherwise>
-            </xsl:choose>
+        <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" use-java-context="true">
+            <connection-url>
+                <xsl:value-of select="$db.jdbc_url"/>
+            </connection-url>
             <driver>
                 <xsl:value-of select="$driver"/>
             </driver>
@@ -76,16 +58,23 @@
                     <xsl:value-of select="$password"/>
                 </password>
             </security>
-        </xa-datasource>
+            <pool>
+                <min-pool-size>
+                    <xsl:value-of select="$min.poolsize"/>
+                </min-pool-size>
+                <max-pool-size>
+                    <xsl:value-of select="$max.poolsize"/>
+                </max-pool-size>
+                <prefill>
+                    <xsl:value-of select="$pool.prefill"/>
+                </prefill>
+            </pool>
+        </datasource>
     </xsl:variable>
     
     <xsl:variable name="newDriverDefinition">
         <xsl:if test="$driver != 'h2'">
-            <driver name="{$driver}" module="com.{$driver}">
-                <xa-datasource-class>
-                    <xsl:value-of select="$datasource.class.xa"/>
-                </xa-datasource-class>
-            </driver>
+            <driver name="{$driver}" module="com.{$driver}" />
         </xsl:if>
     </xsl:variable>
     
diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/common/datasource-jdbc-url.xsl b/testsuite/integration-arquillian/servers/auth-server/jboss/common/datasource-jdbc-url.xsl
index f7d35d3..445b973 100644
--- a/testsuite/integration-arquillian/servers/auth-server/jboss/common/datasource-jdbc-url.xsl
+++ b/testsuite/integration-arquillian/servers/auth-server/jboss/common/datasource-jdbc-url.xsl
@@ -15,11 +15,11 @@
     <!-- replace JDBC URL -->
     <xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
 		         /*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
-                         /*[local-name()='xa-datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name=$pool.name]
-                         /*[local-name()='xa-datasource-property' and starts-with(namespace-uri(), $nsDS) and @name='URL']">
-        <xa-datasource-property name="URL">
+                         /*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name=$pool.name]
+                         /*[local-name()='connection-url' and starts-with(namespace-uri(), $nsDS)]">
+        <connection-url>
             <xsl:value-of select="$jdbc.url"/>
-        </xa-datasource-property>
+        </connection-url>
     </xsl:template>
 
     <!-- Copy everything else. -->
diff --git a/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml b/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml
index dc65870..303da20 100644
--- a/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml
+++ b/testsuite/integration-arquillian/servers/auth-server/jboss/pom.xml
@@ -429,9 +429,6 @@
                                                 <property>jdbc.mvn.version</property>
                                             </requireProperty>
                                             <requireProperty>
-                                                <property>datasource.class.xa</property>
-                                            </requireProperty>
-                                            <requireProperty>
                                                 <property>keycloak.connectionsJpa.user</property>
                                             </requireProperty>
                                             <requireProperty>
@@ -440,15 +437,6 @@
                                             <requireProperty>
                                                 <property>keycloak.connectionsJpa.url</property>
                                             </requireProperty>
-                                            <requireProperty>
-                                                <property>db.hostname</property>
-                                            </requireProperty>
-                                            <requireProperty>
-                                                <property>db.name</property>
-                                            </requireProperty>
-                                            <requireProperty>
-                                                <property>db.port</property>
-                                            </requireProperty>
                                         </rules>
                                     </configuration>
                                 </execution>
@@ -524,22 +512,6 @@
                                                         <value>${keycloak.connectionsJpa.url}</value>
                                                     </parameter>
                                                     <parameter>
-                                                        <name>db.hostname</name>
-                                                        <value>${db.hostname}</value>
-                                                    </parameter>
-                                                    <parameter>
-                                                        <name>db.port</name>
-                                                        <value>${db.port}</value>
-                                                    </parameter>
-                                                    <parameter>
-                                                        <name>db.name</name>
-                                                        <value>${db.name}</value>
-                                                    </parameter>
-                                                    <parameter>
-                                                        <name>datasource.class.xa</name>
-                                                        <value>${datasource.class.xa}</value>
-                                                    </parameter>
-                                                    <parameter>
                                                         <name>driver</name>
                                                         <value>${jdbc.mvn.artifactId}</value>
                                                     </parameter>
diff --git a/testsuite/integration-arquillian/servers/migration/pom.xml b/testsuite/integration-arquillian/servers/migration/pom.xml
index d6091dd..07e6293 100644
--- a/testsuite/integration-arquillian/servers/migration/pom.xml
+++ b/testsuite/integration-arquillian/servers/migration/pom.xml
@@ -67,9 +67,6 @@
                                     <property>jdbc.mvn.version</property>
                                 </requireProperty>
                                 <requireProperty>
-                                    <property>datasource.class.xa</property>
-                                </requireProperty>
-                                <requireProperty>
                                     <property>keycloak.connectionsJpa.user</property>
                                 </requireProperty>
                                 <requireProperty>
@@ -78,15 +75,6 @@
                                 <requireProperty>
                                     <property>keycloak.connectionsJpa.url</property>
                                 </requireProperty>
-                                <requireProperty>
-                                    <property>db.hostname</property>
-                                </requireProperty>
-                                <requireProperty>
-                                    <property>db.name</property>
-                                </requireProperty>
-                                <requireProperty>
-                                    <property>db.port</property>
-                                </requireProperty>
                             </rules>
                         </configuration>
                     </execution>
diff --git a/testsuite/integration-arquillian/servers/migration/src/main/xslt/datasource.xsl b/testsuite/integration-arquillian/servers/migration/src/main/xslt/datasource.xsl
index 909c797..3ca8aa4 100644
--- a/testsuite/integration-arquillian/servers/migration/src/main/xslt/datasource.xsl
+++ b/testsuite/integration-arquillian/servers/migration/src/main/xslt/datasource.xsl
@@ -25,51 +25,27 @@
 
     <xsl:variable name="nsDS" select="'urn:jboss:domain:datasources:'"/>
     
-    <!-- Remove keycloak datasource definition. For versions from 2.3.0-->
-    <xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
-		         /*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
-                         /*[local-name()='xa-datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
-    </xsl:template>
-
-    <!-- Remove keycloak xa-datasource definition. For versions below 2.3.0-->
+    <!-- Remove keycloak datasource definition -->
     <xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
 		         /*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
                          /*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
     </xsl:template>
     
     <xsl:param name="db.jdbc_url"/>
-    <xsl:param name="db.hostname"/>
-    <xsl:param name="db.name"/>
-    <xsl:param name="db.port"/>
     <xsl:param name="driver"/>
-    <xsl:param name="datasource.class.xa"/>
+
+    <xsl:param name="min.poolsize" select="'10'"/>
+    <xsl:param name="max.poolsize" select="'50'"/>
+    <xsl:param name="pool.prefill" select="'true'"/>
     
     <xsl:param name="username"/>
     <xsl:param name="password"/>
     
     <xsl:variable name="newDatasourceDefinition">
-        <xa-datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
-            <xsl:choose>
-                <xsl:when test="contains($driver, 'oracle')">
-                    <xa-datasource-property name="URL">
-                        <xsl:value-of select="$db.jdbc_url"/>
-                    </xa-datasource-property>
-                </xsl:when>
-                <xsl:otherwise>
-                    <xa-datasource-property name="ServerName">
-                        <xsl:value-of select="$db.hostname"/>
-                    </xa-datasource-property>
-                    <xa-datasource-property name="PortNumber">
-                        <xsl:value-of select="$db.port"/>
-                    </xa-datasource-property>
-                    <xa-datasource-property name="DatabaseName">
-                        <xsl:value-of select="$db.name"/>
-                    </xa-datasource-property>
-                    <xsl:if test="contains($driver, 'db2')">
-                        <xa-datasource-property name="DriverType">4</xa-datasource-property>
-                    </xsl:if>
-                </xsl:otherwise>
-            </xsl:choose>
+        <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
+            <connection-url>
+                <xsl:value-of select="$db.jdbc_url"/>
+            </connection-url>
             <driver>
                 <xsl:value-of select="$driver"/>
             </driver>
@@ -81,16 +57,23 @@
                     <xsl:value-of select="$password"/>
                 </password>
             </security>
-        </xa-datasource>
+            <pool>
+                <min-pool-size>
+                    <xsl:value-of select="$min.poolsize"/>
+                </min-pool-size>
+                <max-pool-size>
+                    <xsl:value-of select="$max.poolsize"/>
+                </max-pool-size>
+                <prefill>
+                    <xsl:value-of select="$pool.prefill"/>
+                </prefill>
+            </pool>
+        </datasource>
     </xsl:variable>
     
     <xsl:variable name="newDriverDefinition">
         <xsl:if test="$driver != 'h2'">
-            <driver name="{$driver}" module="com.{$driver}">
-                <xa-datasource-class>
-                    <xsl:value-of select="$datasource.class.xa"/>
-                </xa-datasource-class>
-            </driver>
+            <driver name="{$driver}" module="com.{$driver}"/>
         </xsl:if>
     </xsl:variable>
     
diff --git a/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-datasources.xml b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-datasources.xml
index cd7fc81..11d1240 100755
--- a/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-datasources.xml
+++ b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-datasources.xml
@@ -21,22 +21,22 @@
     <extension-module>org.jboss.as.connector</extension-module>
     <subsystem xmlns="urn:jboss:domain:datasources:4.0">
         <datasources>
-            <xa-datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
-                <xa-datasource-property name="URL">jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</xa-datasource-property>
+            <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
+                <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                 <driver>h2</driver>
                 <security>
                     <user-name>sa</user-name>
                     <password>sa</password>
                 </security>
-            </xa-datasource>
-            <xa-datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
-                <xa-datasource-property name="URL"><?KEYCLOAK_DS_CONNECTION_URL?></xa-datasource-property>
+            </datasource>
+            <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
+                <connection-url><?KEYCLOAK_DS_CONNECTION_URL?></connection-url>
                 <driver>h2</driver>
                 <security>
                     <user-name>sa</user-name>
                     <password>sa</password>
                 </security>
-            </xa-datasource>
+            </datasource>
             <drivers>
                 <driver name="h2" module="com.h2database.h2">
                     <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>