servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r681308 - in /servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap: handlers/security/WSSecurityHandlerTest.java marshalers/SoapMessageMarshalerTest.java
Date Thu, 31 Jul 2008 09:29:26 GMT
Author: gnodet
Date: Thu Jul 31 02:29:25 2008
New Revision: 681308

URL: http://svn.apache.org/viewvc?rev=681308&view=rev
Log:
SM-1442: Allow ServiceMix to build using the ibm jdk

Modified:
    servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/handlers/security/WSSecurityHandlerTest.java
    servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapMessageMarshalerTest.java

Modified: servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/handlers/security/WSSecurityHandlerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/handlers/security/WSSecurityHandlerTest.java?rev=681308&r1=681307&r2=681308&view=diff
==============================================================================
--- servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/handlers/security/WSSecurityHandlerTest.java
(original)
+++ servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/handlers/security/WSSecurityHandlerTest.java
Thu Jul 31 02:29:25 2008
@@ -43,7 +43,6 @@
 import org.apache.ws.security.handler.WSHandlerConstants;
 import org.apache.ws.security.handler.WSHandlerResult;
 import org.springframework.core.io.ClassPathResource;
-import sun.security.x509.X500Name;
 
 public class WSSecurityHandlerTest extends TestCase {
 
@@ -129,8 +128,7 @@
         assertNotNull(engResult);
         Principal principal = engResult.getPrincipal();
         assertNotNull(principal);
-        assertTrue(principal instanceof X500Name);
-        assertEquals("CN=myAlias", ((X500Name) principal).getName());
+        assertEquals("CN=myAlias", principal.getName());
         assertNotNull(ctx.getInMessage().getSubject());
         assertNotNull(ctx.getInMessage().getSubject().getPrincipals());
         assertTrue(ctx.getInMessage().getSubject().getPrincipals().size() > 0);
@@ -164,8 +162,7 @@
         assertNotNull(engResult);
         Principal principal = engResult.getPrincipal();
         assertNotNull(principal);
-        assertTrue(principal instanceof X500Name);
-        assertEquals("CN=myAlias", ((X500Name) principal).getName());
+        assertEquals("CN=myAlias", principal.getName());
         assertNotNull(ctx.getInMessage().getSubject());
         assertNotNull(ctx.getInMessage().getSubject().getPrincipals());
         assertTrue(ctx.getInMessage().getSubject().getPrincipals().size() > 0);

Modified: servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapMessageMarshalerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapMessageMarshalerTest.java?rev=681308&r1=681307&r2=681308&view=diff
==============================================================================
--- servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapMessageMarshalerTest.java
(original)
+++ servicemix/components/shared-libraries/trunk/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapMessageMarshalerTest.java
Thu Jul 31 02:29:25 2008
@@ -144,11 +144,7 @@
 		assertNotNull(msg.getSource());
 		
 		Iterator headers = msg.getHeaders().values().iterator();
-		assertTrue(headers.hasNext());
-		assertNotNull(headers.next());
-		assertTrue(headers.hasNext());
-        checkServiceNameNamespace((DocumentFragment) headers.next());
-		assertFalse(headers.hasNext());
+        checkHeadersForServiceName(headers);
 
         Node node2 = sourceTransformer.toDOMNode(msg.getSource()); 
         checkUserIdNamespace(node2);
@@ -197,12 +193,8 @@
         checkUserIdNamespace(sourceTransformer.toDOMNode(msg2.getSource()));
 		assertTrue(msg2.hasHeaders());
 		Iterator headers = msg2.getHeaders().values().iterator();
-		assertTrue(headers.hasNext());
-		assertNotNull(headers.next());
-		assertTrue(headers.hasNext());
-        checkServiceNameNamespace((DocumentFragment) headers.next());
-		assertFalse(headers.hasNext());
-	}
+        checkHeadersForServiceName(headers);
+    }
 
     public void testReadNonSoapMessageWithAttachmentsAndNoSource()  throws Exception {
         Session session = Session.getDefaultInstance(new Properties(), null);
@@ -231,8 +223,25 @@
         writer.write(baos);
         log.info(baos.toString());
     }
-  
-	protected void checkUserIdNamespace(Node node) throws Exception {
+
+    private void checkHeadersForServiceName(Iterator headers) throws Exception {
+        CachedXPathAPI cachedXPathAPI = new CachedXPathAPI();
+        boolean foundServiceNameNode = false;
+        int headerCount = 0;
+        while (headers.hasNext()) {
+            headerCount++;
+            DocumentFragment df = (DocumentFragment)headers.next();
+            Element root = (Element)(cachedXPathAPI.selectNodeIterator(df, "//*[local-name()
= 'ServiceName']").nextNode());
+            if (root != null) {
+                foundServiceNameNode = true;
+                checkServiceNameNamespace(df);
+            }
+        }
+        assertTrue(foundServiceNameNode);
+        assertEquals(headerCount, 2);
+    }
+
+    protected void checkUserIdNamespace(Node node) throws Exception {
         CachedXPathAPI cachedXPathAPI = new CachedXPathAPI(); 
         NodeIterator iterator = cachedXPathAPI.selectNodeIterator(node, "//*[local-name()
= 'userId']"); 
         Element root = (Element) iterator.nextNode(); 



Mime
View raw message