servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r515740 - in /incubator/servicemix/trunk/common/servicemix-soap/src: main/java/org/apache/servicemix/soap/marshalers/SoapReader.java test/java/org/apache/servicemix/soap/marshalers/SoapReaderTest.java
Date Wed, 07 Mar 2007 20:41:49 GMT
Author: gnodet
Date: Wed Mar  7 12:41:48 2007
New Revision: 515740

URL: http://svn.apache.org/viewvc?view=rev&rev=515740
Log:
SM-871: optimize wsdl-first example

Added:
    incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapReaderTest.java
  (with props)
Modified:
    incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java

Modified: incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java?view=diff&rev=515740&r1=515739&r2=515740
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java
(original)
+++ incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapReader.java
Wed Mar  7 12:41:48 2007
@@ -63,7 +63,7 @@
 
 	public SoapMessage read(InputStream is, String contentType)
 			throws Exception {
-		if (contentType != null && contentType.toLowerCase().startsWith(SoapMarshaler.MULTIPART_CONTENT))
{
+		if (contentType != null && startsWithCaseInsensitive(contentType, SoapMarshaler.MULTIPART_CONTENT))
{
 			Session session = Session.getDefaultInstance(new Properties());
             is = new SequenceInputStream(new ByteArrayInputStream(new byte[] { 13, 10 }),
is);
 			MimeMessage mime = new MimeMessage(session, is);
@@ -73,6 +73,10 @@
 			return read(is);
 		}
 	}
+    
+    static boolean startsWithCaseInsensitive(String s1, String s2) {
+        return s1.regionMatches(true, 0, s2, 0, s2.length());
+    }
 
 	public SoapMessage read(InputStream is) throws Exception {
 		if (marshaler.isSoap()) {

Added: incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapReaderTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapReaderTest.java?view=auto&rev=515740
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapReaderTest.java
(added)
+++ incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapReaderTest.java
Wed Mar  7 12:41:48 2007
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.soap.marshalers;
+
+import junit.framework.TestCase;
+
+public class SoapReaderTest extends TestCase {
+
+    public void testStartsWithCaseInsensitive() {
+        assertTrue(SoapReader.startsWithCaseInsensitive("abcdef", "ab"));
+        assertFalse(SoapReader.startsWithCaseInsensitive("abcdef", "abs"));
+        assertFalse(SoapReader.startsWithCaseInsensitive("abcdef", "abS"));
+        assertTrue(SoapReader.startsWithCaseInsensitive("abcdef", "aB"));
+        assertTrue(SoapReader.startsWithCaseInsensitive("aBcdef", "ab"));
+    }
+}

Propchange: incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapReaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapReaderTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapReaderTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message