Author: darran.lofthouse(a)jboss.com
Date: 2008-12-19 12:39:19 -0500 (Fri, 19 Dec 2008)
New Revision: 8957
Added:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role-unchecked.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-unchecked.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role-unchecked.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-roles.xml
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-unchecked.xml
Modified:
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java
Log:
Completion of configuration test case.
Modified:
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java 2008-12-18
18:06:14 UTC (rev 8956)
+++
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/metadata/wsse/Authorize.java 2008-12-19
17:39:19 UTC (rev 8957)
@@ -47,6 +47,10 @@
public void addRole(final Role role)
{
+ if (isUnchecked())
+ {
+ throw new IllegalStateException("Can not add role after setting
'Unchecked'");
+ }
roles.add(role);
}
@@ -57,6 +61,10 @@
void setUnchecked(Unchecked unchecked)
{
+ if (roles.isEmpty() == false)
+ {
+ throw new IllegalStateException("Can not set 'Unchecked' with
role(s) defined.");
+ }
this.unchecked = unchecked;
}
Modified:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java 2008-12-18
18:06:14 UTC (rev 8956)
+++
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1999/JBWS1999ConfigurationTestCase.java 2008-12-19
17:39:19 UTC (rev 8957)
@@ -28,6 +28,7 @@
import org.jboss.ws.metadata.wsse.Authorize;
import org.jboss.ws.metadata.wsse.Config;
+import org.jboss.ws.metadata.wsse.Port;
import org.jboss.ws.metadata.wsse.Role;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
import org.jboss.ws.metadata.wsse.WSSecurityOMFactory;
@@ -60,6 +61,7 @@
Config config = wsConfig.getDefaultConfig();
Authorize authorize = config.getAuthorize();
+ assertFalse("Unchecked", authorize.isUnchecked());
List<Role> roles = authorize.getRoles();
assertEquals("Expected 2 roles", 2, roles.size());
@@ -73,4 +75,137 @@
assertTrue("Expected 'Banker' role.",
roleNames.contains("Banker"));
}
+ /**
+ * Test loading a configuration with a port 'authorize' definition
+ * which contains two roles.
+ */
+ public void testPortRoles() throws Exception
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-port-roles.xml");
+
+ Port port = wsConfig.getPorts().get("TestPort");
+ Config config = port.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ assertFalse("Unchecked", authorize.isUnchecked());
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 2 roles", 2, roles.size());
+
+ List<String> roleNames = new ArrayList<String>(roles.size());
+ for (Role current : roles)
+ {
+ roleNames.add(current.getName());
+ }
+ assertTrue("Expected 'Trader' role.",
roleNames.contains("Trader"));
+ assertTrue("Expected 'Banker' role.",
roleNames.contains("Banker"));
+ }
+
+ /**
+ * Test loading a configuration with a default 'authorize' definition
+ * which contains one role.
+ */
+ public void testDefaultRole() throws Exception
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-default-role.xml");
+
+ Config config = wsConfig.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ assertFalse("Unchecked", authorize.isUnchecked());
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 1 roles", 1, roles.size());
+
+ Role role = roles.get(0);
+ assertEquals("Expected 'Trader' role.", "Trader",
role.getName());
+ }
+
+ /**
+ * Test loading a configuration with a port 'authorize' definition
+ * which contains one role.
+ */
+ public void testPortRole() throws Exception
+ {
+ WSSecurityConfiguration wsConfig = load("jboss-wsse-port-role.xml");
+
+ Port port = wsConfig.getPorts().get("TestPort");
+ Config config = port.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ assertFalse("Unchecked", authorize.isUnchecked());
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 1 roles", 1, roles.size());
+
+ Role role = roles.get(0);
+ assertEquals("Expected 'Trader' role.", "Trader",
role.getName());
+ }
+
+ /**
+ * Test loading a configuration with a default 'authorize' definition
+ * with unchecked.
+ */
+ public void testDefaultUnchecked() throws Exception
+ {
+ WSSecurityConfiguration wsConfig =
load("jboss-wsse-default-unchecked.xml");
+
+ Config config = wsConfig.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ assertTrue("Unchecked", authorize.isUnchecked());
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 0 roles", 0, roles.size());
+ }
+
+ /**
+ * Test loading a configuration with a port 'authorize' definition
+ * with unchecked.
+ */
+ public void testPortUnchecked() throws Exception
+ {
+ WSSecurityConfiguration wsConfig =
load("jboss-wsse-port-unchecked.xml");
+
+ Port port = wsConfig.getPorts().get("TestPort");
+ Config config = port.getDefaultConfig();
+ Authorize authorize = config.getAuthorize();
+ assertTrue("Unchecked", authorize.isUnchecked());
+ List<Role> roles = authorize.getRoles();
+
+ assertEquals("Expected 0 roles", 0, roles.size());
+ }
+
+ /**
+ * Test loading a configuration with a default 'authorize' definition
+ * with unchecked and a role defined, parsing should fail.
+ */
+ public void testDefaultRoleUnchecked() throws Exception
+ {
+ try
+ {
+ WSSecurityConfiguration wsConfig =
load("jboss-wsse-default-role-unchecked.xml");
+ fail("Expected exception not thrown.");
+ }
+ catch (IOException expected)
+ {
+ Throwable cause = expected.getCause();
+ assertEquals(IllegalStateException.class, cause.getClass());
+ }
+ }
+
+ /**
+ * Test loading a configuration with a port 'authorize' definition
+ * with unchecked and a role defined, parsing should fail.
+ */
+ public void testPortRoleUnchecked() throws Exception
+ {
+ try
+ {
+ WSSecurityConfiguration wsConfig =
load("jboss-wsse-port-role-unchecked.xml");
+ fail("Expected exception not thrown.");
+ }
+ catch (IOException expected)
+ {
+ Throwable cause = expected.getCause();
+ assertEquals(IllegalStateException.class, cause.getClass());
+ }
+ }
+
}
Added:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role-unchecked.xml
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role-unchecked.xml
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role-unchecked.xml 2008-12-19
17:39:19 UTC (rev 8957)
@@ -0,0 +1,12 @@
+<jboss-ws-security
xmlns='http://www.jboss.com/ws-security/config'
+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+
xsi:schemaLocation='http://www.jboss.com/ws-security/config
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <role>Trader</role>
+ <unchecked/>
+ </authorize>
+ </config>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role-unchecked.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role.xml
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role.xml
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role.xml 2008-12-19
17:39:19 UTC (rev 8957)
@@ -0,0 +1,11 @@
+<jboss-ws-security
xmlns='http://www.jboss.com/ws-security/config'
+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+
xsi:schemaLocation='http://www.jboss.com/ws-security/config
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <role>Trader</role>
+ </authorize>
+ </config>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-role.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-unchecked.xml
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-unchecked.xml
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-unchecked.xml 2008-12-19
17:39:19 UTC (rev 8957)
@@ -0,0 +1,11 @@
+<jboss-ws-security
xmlns='http://www.jboss.com/ws-security/config'
+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+
xsi:schemaLocation='http://www.jboss.com/ws-security/config
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <unchecked/>
+ </authorize>
+ </config>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-default-unchecked.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role-unchecked.xml
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role-unchecked.xml
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role-unchecked.xml 2008-12-19
17:39:19 UTC (rev 8957)
@@ -0,0 +1,20 @@
+<jboss-ws-security
xmlns='http://www.jboss.com/ws-security/config'
+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+
xsi:schemaLocation='http://www.jboss.com/ws-security/config
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <role>Trader</role>
+ </authorize>
+ </config>
+
+ <port name="TestPort">
+ <config>
+ <authorize>
+ <role>Trader</role>
+ <unchecked/>
+ </authorize>
+ </config>
+ </port>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role-unchecked.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role.xml
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role.xml
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role.xml 2008-12-19
17:39:19 UTC (rev 8957)
@@ -0,0 +1,19 @@
+<jboss-ws-security
xmlns='http://www.jboss.com/ws-security/config'
+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+
xsi:schemaLocation='http://www.jboss.com/ws-security/config
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <unchecked/>
+ </authorize>
+ </config>
+
+ <port name="TestPort">
+ <config>
+ <authorize>
+ <role>Trader</role>
+ </authorize>
+ </config>
+ </port>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-role.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-roles.xml
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-roles.xml
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-roles.xml 2008-12-19
17:39:19 UTC (rev 8957)
@@ -0,0 +1,20 @@
+<jboss-ws-security
xmlns='http://www.jboss.com/ws-security/config'
+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+
xsi:schemaLocation='http://www.jboss.com/ws-security/config
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <unchecked/>
+ </authorize>
+ </config>
+
+ <port name="TestPort">
+ <config>
+ <authorize>
+ <role>Banker</role>
+ <role>Trader</role>
+ </authorize>
+ </config>
+ </port>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-roles.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-unchecked.xml
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-unchecked.xml
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-unchecked.xml 2008-12-19
17:39:19 UTC (rev 8957)
@@ -0,0 +1,19 @@
+<jboss-ws-security
xmlns='http://www.jboss.com/ws-security/config'
+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+
xsi:schemaLocation='http://www.jboss.com/ws-security/config
http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd'>
+
+ <config>
+ <authorize>
+ <role>Trader</role>
+ </authorize>
+ </config>
+
+ <port name="TestPort">
+ <config>
+ <authorize>
+ <unchecked/>
+ </authorize>
+ </config>
+ </port>
+
+</jboss-ws-security>
\ No newline at end of file
Property changes on:
stack/native/branches/dlofthouse/JBWS-1999/modules/testsuite/native-tests/src/test/resources/jaxws/jbws1999/config/jboss-wsse-port-unchecked.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF