geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r581677 - in /geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src: main/resources/META-INF/geronimo-application.xml test/java/org/apache/geronimo/testsuite/jcacms/CmsTest.java
Date Wed, 03 Oct 2007 18:27:52 GMT
Author: gawor
Date: Wed Oct  3 11:27:51 2007
New Revision: 581677

URL: http://svn.apache.org/viewvc?rev=581677&view=rev
Log:
fixed the jca-cms-tests. added another login module that actaully validates the credentials

Modified:
    geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src/main/resources/META-INF/geronimo-application.xml
    geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src/test/java/org/apache/geronimo/testsuite/jcacms/CmsTest.java

Modified: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src/main/resources/META-INF/geronimo-application.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src/main/resources/META-INF/geronimo-application.xml?rev=581677&r1=581676&r2=581677&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src/main/resources/META-INF/geronimo-application.xml
(original)
+++ geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src/main/resources/META-INF/geronimo-application.xml
Wed Oct  3 11:27:51 2007
@@ -85,14 +85,20 @@
             </resourceadapter>
             <gbean name="test-cms-realm" class="org.apache.geronimo.security.realm.GenericSecurityRealm">
                 <attribute name="realmName">test-cms-realm</attribute>
-                <xml-reference name="LoginModuleConfiguration">
-                    <lc:login-config xmlns:lc="http://geronimo.apache.org/xml/ns/loginconfig-1.1">
+                <xml-reference name="LoginModuleConfiguration" xmlns:lc="http://geronimo.apache.org/xml/ns/loginconfig-1.1">
+                    <lc:login-config>
                         <lc:login-module-ref control-flag="REQUIRED">
                             <lc:pattern>
                                 <name xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">test-cms-credentials
                                 </name>
                             </lc:pattern>
                         </lc:login-module-ref>
+                        <lc:login-module control-flag="REQUIRED" wrap-principals="false">
+                            <lc:login-domain-name>test-app-credentials</lc:login-domain-name>
+                            <lc:login-module-class>org.apache.geronimo.security.realm.providers.PropertiesFileLoginModule</lc:login-module-class>
+                            <lc:option name="usersURI">var/security/demo_users.properties</lc:option>
+                            <lc:option name="groupsURI">var/security/demo_groups.properties</lc:option>
+                        </lc:login-module>
                     </lc:login-config>
                 </xml-reference>
                 <reference name="ServerInfo">
@@ -125,7 +131,7 @@
                 </default-subject>
                 <role-mappings>
                     <role role-name="test">
-                        <principal class="org.apache.geronimo.connector.outbound.security.ResourcePrincipal"
name="system"/>
+                        <principal class="org.apache.geronimo.connector.outbound.security.ResourcePrincipal"
name="george"/>
                     </role>
                     <role role-name="fail">
                         <run-as-subject>
@@ -145,22 +151,22 @@
                                 <id>test</id>
                                 <credential>
                                     <type>org.apache.geronimo.security.credentialstore.NameCallbackHandler</type>
-                                    <value>system</value>
+                                    <value>george</value>
                                 </credential>
                                 <credential>
                                     <type>org.apache.geronimo.security.credentialstore.PasswordCallbackHandler</type>
-                                    <value>manager</value>
+                                    <value>bone</value>
                                 </credential>
                             </subject>
                             <subject>
                                 <id>fail</id>
                                 <credential>
                                     <type>org.apache.geronimo.security.credentialstore.NameCallbackHandler</type>
-                                    <value>unauthorized</value>
+                                    <value>gracie</value>
                                 </credential>
                                 <credential>
                                     <type>org.apache.geronimo.security.credentialstore.PasswordCallbackHandler</type>
-                                    <value>nope</value>
+                                    <value>biscuit</value>
                                 </credential>
                             </subject>
                         </realm>

Modified: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src/test/java/org/apache/geronimo/testsuite/jcacms/CmsTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src/test/java/org/apache/geronimo/testsuite/jcacms/CmsTest.java?rev=581677&r1=581676&r2=581677&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src/test/java/org/apache/geronimo/testsuite/jcacms/CmsTest.java
(original)
+++ geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/jca-cms-ear/src/test/java/org/apache/geronimo/testsuite/jcacms/CmsTest.java
Wed Oct  3 11:27:51 2007
@@ -32,11 +32,13 @@
     extends SeleniumTestSupport
 {
     @Test
-    public void testPageContent() throws Exception {
-        selenium.open("http://system:manager@localhost:8080/jca-cms/default-subject-servlet");
+    public void testPageContent1() throws Exception {
+        selenium.open("http://localhost:8080/jca-cms/default-subject-servlet");
         selenium.waitForPageToLoad("30000");
 
-        assertTrue(selenium.getText("xpath=/html/body").endsWith(
+        String body = selenium.getText("xpath=/html/body");
+
+        assertTrue(body.endsWith(
 //                "Current subject: Subject:\n" +
 //                "\tPrincipal: org.apache.geronimo.connector.outbound.security.ResourcePrincipal@cb1c722f\n"
+
 //                "\tPrincipal: org.apache.geronimo.security.IdentificationPrincipal[[1186174499145:0x607c7eb7837eabcd6b759e6f9d29e7eee72622d6]]\n"
+
@@ -52,6 +54,31 @@
                 "Successfully got configured connection\n" +
                 "\n" +
                 "Successfully got container managed connection"));
+
+        String expectedPrincipal = "Principal: george";
+        int pos1 = body.indexOf(expectedPrincipal);
+        assertTrue("Expected current subject principal", pos1 > 0);
+        int pos2 = body.indexOf(expectedPrincipal, pos1 + expectedPrincipal.length());
+        assertTrue("Expected next subject principal", pos2 > 0);
+    }
+
+    @Test
+    public void testPageContent2() throws Exception {
+        selenium.open("http://localhost:8080/jca-cms/run-as-servlet");
+        selenium.waitForPageToLoad("30000");
+
+        String body = selenium.getText("xpath=/html/body");
+
+        assertTrue(body.endsWith(
+                "Successfully got configured connection\n" +
+                "\n" +
+                "Successfully got container managed connection"));
+
+        String expectedPrincipal = "Principal: george";
+        int pos1 = body.indexOf(expectedPrincipal);
+        assertTrue("Expected current subject principal", pos1 > 0);
+        int pos2 = body.indexOf("Principal: gracie", pos1 + expectedPrincipal.length());
+        assertTrue("Expected next subject principal", pos2 > 0);
     }
 }
 



Mime
View raw message