You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2010/09/28 23:55:44 UTC

svn commit: r1002369 [5/7] - in /openejb/trunk/openejb3: ./ assembly/ assembly/itest-runner/ assembly/openejb-jetty/ assembly/openejb-jetty/openejb-jetty-common/ assembly/openejb-jetty/openejb-jetty-webapp/ assembly/openejb-standalone/ assembly/openejb...

Modified: openejb/trunk/openejb3/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CalculatorTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CalculatorTest.java?rev=1002369&r1=1002368&r2=1002369&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CalculatorTest.java (original)
+++ openejb/trunk/openejb3/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CalculatorTest.java Tue Sep 28 21:55:40 2010
@@ -66,8 +66,8 @@ public class CalculatorTest extends Test
      */
     //START SNIPPET: webservice
     public void testCalculatorViaWsInterface() throws Exception {
-        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImpl?wsdl"), 
-        	new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
+        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImpl?wsdl"),
+            new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
         assertNotNull(calcService);
 
         CalculatorWs calc = calcService.getPort(CalculatorWs.class);
@@ -91,19 +91,19 @@ public class CalculatorTest extends Test
         WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
         endpoint.getOutInterceptors().add(wssOut);
 
-        assertEquals(10, calc.sum(4,6));
+        assertEquals(10, calc.sum(4, 6));
     }
-    
+
     public void testCalculatorViaWsInterfaceWithTimestamp1way() throws Exception {
-        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplTimestamp1way?wsdl"), 
-        	new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
+        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplTimestamp1way?wsdl"),
+            new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
         assertNotNull(calcService);
 
         // for debugging (ie. TCPMon)
         calcService.addPort(new QName("http://superbiz.org/wsdl",
-		"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
-		"http://127.0.0.1:8204/CalculatorImplTimestamp1way");
-        
+            "CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
+            "http://127.0.0.1:8204/CalculatorImplTimestamp1way");
+
 //        CalculatorWs calc = calcService.getPort(
 //        	new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
 //		CalculatorWs.class);
@@ -119,19 +119,19 @@ public class CalculatorTest extends Test
         WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
         endpoint.getOutInterceptors().add(wssOut);
 
-	assertEquals(12, calc.multiply(3,4));
+        assertEquals(12, calc.multiply(3, 4));
     }
-    
+
     public void testCalculatorViaWsInterfaceWithTimestamp2ways() throws Exception {
-        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplTimestamp2ways?wsdl"), 
-        	new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
+        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplTimestamp2ways?wsdl"),
+            new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
         assertNotNull(calcService);
 
         // for debugging (ie. TCPMon)
         calcService.addPort(new QName("http://superbiz.org/wsdl",
-		"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
-		"http://127.0.0.1:8204/CalculatorImplTimestamp2ways");
-        
+            "CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
+            "http://127.0.0.1:8204/CalculatorImplTimestamp2ways");
+
 //        CalculatorWs calc = calcService.getPort(
 //        	new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
 //		CalculatorWs.class);
@@ -153,19 +153,19 @@ public class CalculatorTest extends Test
         WSS4JInInterceptor wssIn = new WSS4JInInterceptor(inProps);
         endpoint.getInInterceptors().add(wssIn);
 
-        assertEquals(12, calc.multiply(3,4));
+        assertEquals(12, calc.multiply(3, 4));
     }
-    
+
     public void testCalculatorViaWsInterfaceWithUsernameTokenPlainPassword() throws Exception {
-        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplUsernameTokenPlainPassword?wsdl"), 
-        	new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
+        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplUsernameTokenPlainPassword?wsdl"),
+            new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
         assertNotNull(calcService);
 
         // for debugging (ie. TCPMon)
         calcService.addPort(new QName("http://superbiz.org/wsdl",
-		"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
-		"http://127.0.0.1:8204/CalculatorImplUsernameTokenPlainPassword");
-        
+            "CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
+            "http://127.0.0.1:8204/CalculatorImplUsernameTokenPlainPassword");
+
 //        CalculatorWs calc = calcService.getPort(
 //        	new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
 //        	CalculatorWs.class);
@@ -182,6 +182,7 @@ public class CalculatorTest extends Test
         outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
         outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
 
+            @Override
             public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
                 WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
                 pc.setPassword("waterfall");
@@ -191,19 +192,19 @@ public class CalculatorTest extends Test
         WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
         endpoint.getOutInterceptors().add(wssOut);
 
-        assertEquals(10, calc.sum(4,6));
+        assertEquals(10, calc.sum(4, 6));
     }
 
     public void testCalculatorViaWsInterfaceWithUsernameTokenHashedPassword() throws Exception {
-        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplUsernameTokenHashedPassword?wsdl"), 
-        	new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
+        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplUsernameTokenHashedPassword?wsdl"),
+            new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
         assertNotNull(calcService);
 
         // for debugging (ie. TCPMon)
         calcService.addPort(new QName("http://superbiz.org/wsdl",
-		"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
-		"http://127.0.0.1:8204/CalculatorImplUsernameTokenHashedPassword");
-        
+            "CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
+            "http://127.0.0.1:8204/CalculatorImplUsernameTokenHashedPassword");
+
 //        CalculatorWs calc = calcService.getPort(
 //        	new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
 //        	CalculatorWs.class);
@@ -220,6 +221,7 @@ public class CalculatorTest extends Test
         outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
         outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
 
+            @Override
             public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
                 WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
                 pc.setPassword("waterfall");
@@ -229,19 +231,19 @@ public class CalculatorTest extends Test
         WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
         endpoint.getOutInterceptors().add(wssOut);
 
-        assertEquals(10, calc.sum(4,6));
+        assertEquals(10, calc.sum(4, 6));
     }
-    
+
     public void testCalculatorViaWsInterfaceWithUsernameTokenPlainPasswordEncrypt() throws Exception {
-        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplUsernameTokenPlainPasswordEncrypt?wsdl"), 
-        	new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
+        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplUsernameTokenPlainPasswordEncrypt?wsdl"),
+            new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
         assertNotNull(calcService);
 
         // for debugging (ie. TCPMon)
         calcService.addPort(new QName("http://superbiz.org/wsdl",
-		"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
-		"http://127.0.0.1:8204/CalculatorImplUsernameTokenPlainPasswordEncrypt");
-        
+            "CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
+            "http://127.0.0.1:8204/CalculatorImplUsernameTokenPlainPasswordEncrypt");
+
 //        CalculatorWs calc = calcService.getPort(
 //        	new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
 //        	CalculatorWs.class);
@@ -254,11 +256,12 @@ public class CalculatorTest extends Test
 
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN
-        				+ " " + WSHandlerConstants.ENCRYPT);
+            + " " + WSHandlerConstants.ENCRYPT);
         outProps.put(WSHandlerConstants.USER, "jane");
         outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
         outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
 
+            @Override
             public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
                 WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
                 pc.setPassword("waterfall");
@@ -270,24 +273,24 @@ public class CalculatorTest extends Test
         WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
         endpoint.getOutInterceptors().add(wssOut);
 
-        assertEquals(10, calc.sum(4,6));
+        assertEquals(10, calc.sum(4, 6));
     }
-    
+
     public void testCalculatorViaWsInterfaceWithSign() throws Exception {
-        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplSign?wsdl"), 
-        	new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
+        Service calcService = Service.create(new URL("http://127.0.0.1:4204/CalculatorImplSign?wsdl"),
+            new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
         assertNotNull(calcService);
 
         // for debugging (ie. TCPMon)
         calcService.addPort(new QName("http://superbiz.org/wsdl",
-		"CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
-		"http://127.0.0.1:8204/CalculatorImplSign");
-        
+            "CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
+            "http://127.0.0.1:8204/CalculatorImplSign");
+
 //      CalculatorWs calc = calcService.getPort(
 //	new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
 //	CalculatorWs.class);
 
-      CalculatorWs calc = calcService.getPort(CalculatorWs.class);
+        CalculatorWs calc = calcService.getPort(CalculatorWs.class);
 
         Client client = ClientProxy.getClient(calc);
         Endpoint endpoint = client.getEndpoint();
@@ -298,6 +301,7 @@ public class CalculatorTest extends Test
         outProps.put(WSHandlerConstants.USER, "clientalias");
         outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
 
+            @Override
             public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
                 WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
                 pc.setPassword("clientPassword");
@@ -309,8 +313,7 @@ public class CalculatorTest extends Test
         WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
         endpoint.getOutInterceptors().add(wssOut);
 
-        assertEquals(24, calc.multiply(4,6));
+        assertEquals(24, calc.multiply(4, 6));
     }
     //END SNIPPET: webservice
-
 }

Modified: openejb/trunk/openejb3/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CustomPasswordHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CustomPasswordHandler.java?rev=1002369&r1=1002368&r2=1002369&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CustomPasswordHandler.java (original)
+++ openejb/trunk/openejb3/examples/webservice-ws-security/src/test/java/org/superbiz/calculator/CustomPasswordHandler.java Tue Sep 28 21:55:40 2010
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.superbiz.calculator;
 
 import org.apache.ws.security.WSPasswordCallback;
@@ -28,40 +27,40 @@ import javax.security.auth.login.LoginEx
 import java.io.IOException;
 
 public class CustomPasswordHandler implements CallbackHandler {
+
     public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
         WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
-        
-        if(pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN) {
+
+        if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN) {
             // TODO get the password from the users.properties if possible
             pc.setPassword("waterfall");
-            
-        } else if(pc.getUsage() == WSPasswordCallback.DECRYPT) {
+
+        } else if (pc.getUsage() == WSPasswordCallback.DECRYPT) {
             pc.setPassword("serverPassword");
-            
-        } else if(pc.getUsage() == WSPasswordCallback.SIGNATURE) {
+
+        } else if (pc.getUsage() == WSPasswordCallback.SIGNATURE) {
             pc.setPassword("serverPassword");
-            
+
         }
-        
+
         if ((pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN)
-        	|| (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN)) {
-            
-            SecurityService securityService = SystemInstance.get()
-		    .getComponent(SecurityService.class);
-	    Object token = null;
-	    try {
-		securityService.disassociate();
-
-		token = securityService.login(pc.getIdentifer(), pc.getPassword());
-		securityService.associate(token);
-		
-	    } catch (LoginException e) {
-		e.printStackTrace();
-		throw new SecurityException("wrong password");
-	    } finally {
-	    }
-	}
-            
+            || (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN)) {
+
+            SecurityService securityService = SystemInstance.get().getComponent(SecurityService.class);
+            Object token = null;
+            try {
+                securityService.disassociate();
+
+                token = securityService.login(pc.getIdentifer(), pc.getPassword());
+                securityService.associate(token);
+
+            } catch (LoginException e) {
+                e.printStackTrace();
+                throw new SecurityException("wrong password");
+            } finally {
+            }
+        }
+
 
     }
 }

Modified: openejb/trunk/openejb3/itests/openejb-itests-app/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-app/pom.xml?rev=1002369&r1=1002368&r2=1002369&view=diff
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-app/pom.xml (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-app/pom.xml Tue Sep 28 21:55:40 2010
@@ -57,7 +57,7 @@
             <ejbModule>
               <groupId>org.apache.openejb</groupId>
               <artifactId>openejb-itests-interceptor-beans</artifactId>
-            </ejbModule>            
+            </ejbModule>
             <javaModule>
               <groupId>org.apache.openejb</groupId>
               <artifactId>openejb-itests-client</artifactId>
@@ -88,7 +88,7 @@
       <type>ejb</type>
     </dependency>
     <dependency>
-      <groupId>org.apache.openejb</groupId>      
+      <groupId>org.apache.openejb</groupId>
       <artifactId>openejb-itests-client</artifactId>
       <version>${project.version}</version>
     </dependency>

Modified: openejb/trunk/openejb3/itests/openejb-itests-client/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-client/pom.xml?rev=1002369&r1=1002368&r2=1002369&view=diff
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-client/pom.xml (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-client/pom.xml Tue Sep 28 21:55:40 2010
@@ -99,8 +99,8 @@
       <optional>true</optional>
     </dependency>
     <dependency>
-        <groupId>org.apache.activemq</groupId>
-        <artifactId>activemq-ra</artifactId>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-ra</artifactId>
     </dependency>
     <dependency>
       <groupId>junit</groupId>

Modified: openejb/trunk/openejb3/itests/openejb-itests-interceptor-beans/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/openejb-itests-interceptor-beans/pom.xml?rev=1002369&r1=1002368&r2=1002369&view=diff
==============================================================================
--- openejb/trunk/openejb3/itests/openejb-itests-interceptor-beans/pom.xml (original)
+++ openejb/trunk/openejb3/itests/openejb-itests-interceptor-beans/pom.xml Tue Sep 28 21:55:40 2010
@@ -19,7 +19,8 @@
 
 <!-- $Rev$ $Date$ -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.openejb</groupId>

Modified: openejb/trunk/openejb3/itests/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/itests/pom.xml?rev=1002369&r1=1002368&r2=1002369&view=diff
==============================================================================
--- openejb/trunk/openejb3/itests/pom.xml (original)
+++ openejb/trunk/openejb3/itests/pom.xml Tue Sep 28 21:55:40 2010
@@ -24,7 +24,7 @@
     <artifactId>openejb</artifactId>
     <groupId>org.apache.openejb</groupId>
     <version>3.2-SNAPSHOT</version>
-    </parent>
+  </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>itests</artifactId>
   <packaging>pom</packaging>