ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1797517 - in /webservices/axiom/trunk: aspects/om-aspects/ aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/util/ aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/ aspects/om-aspects/src/test/java/org/apach...
Date Sat, 03 Jun 2017 16:04:29 GMT
Author: veithen
Date: Sat Jun  3 16:04:28 2017
New Revision: 1797517

URL: http://svn.apache.org/viewvc?rev=1797517&view=rev
Log:
Add an API to extract the fault reason text in a SOAP version independent way.

Added:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/util/LocaleUtil.java
  (with props)
    webservices/axiom/trunk/aspects/om-aspects/src/test/java/org/apache/axiom/om/impl/common/util/
    webservices/axiom/trunk/aspects/om-aspects/src/test/java/org/apache/axiom/om/impl/common/util/LocaleUtilTest.java
  (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultreason/
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultreason/TestGetFaultReasonText.java
  (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonText.java
  (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextCaseSensitivity.java
  (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextWithoutLangAttribute.java
  (with props)
Modified:
    webservices/axiom/trunk/aspects/om-aspects/pom.xml
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultReasonSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultReasonSupport.aj
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultReason.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java

Modified: webservices/axiom/trunk/aspects/om-aspects/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/pom.xml?rev=1797517&r1=1797516&r2=1797517&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/pom.xml (original)
+++ webservices/axiom/trunk/aspects/om-aspects/pom.xml Sat Jun  3 16:04:28 2017
@@ -62,5 +62,10 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.google.truth</groupId>
+            <artifactId>truth</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>

Added: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/util/LocaleUtil.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/util/LocaleUtil.java?rev=1797517&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/util/LocaleUtil.java
(added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/util/LocaleUtil.java
Sat Jun  3 16:04:28 2017
@@ -0,0 +1,43 @@
+/*
+ * 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.axiom.om.impl.common.util;
+
+import java.util.Locale;
+
+public final class LocaleUtil {
+    private LocaleUtil() {}
+
+    public static int getMatchScore(Locale requested, Locale candidate) {
+        if (candidate == null) {
+            return 1;
+        } else if (requested.getLanguage().equals(candidate.getLanguage())) {
+            if (requested.getCountry().equals(candidate.getCountry())) {
+                return 6;
+            } else if (candidate.getCountry().isEmpty()) {
+                return 5;
+            } else {
+                return 4;
+            }
+        } else if (candidate.getLanguage().equals("en")) {
+            return candidate.getCountry().isEmpty() ? 3 : 2;
+        } else {
+            return 0;
+        }
+    }
+}

Propchange: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/util/LocaleUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultReasonSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultReasonSupport.aj?rev=1797517&r1=1797516&r2=1797517&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultReasonSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultReasonSupport.aj
Sat Jun  3 16:04:28 2017
@@ -20,6 +20,7 @@ package org.apache.axiom.soap.impl.mixin
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.axiom.core.CoreNode;
 import org.apache.axiom.om.OMElement;
@@ -50,4 +51,8 @@ public aspect AxiomSOAP11FaultReasonSupp
     public final SOAPFaultText AxiomSOAP11FaultReason.getSOAPFaultText(String language) {
         return null;
     }
+
+    public final String AxiomSOAP11FaultReason.getFaultReasonText(Locale locale) {
+        return getText();
+    }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultReasonSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultReasonSupport.aj?rev=1797517&r1=1797516&r2=1797517&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultReasonSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultReasonSupport.aj
Sat Jun  3 16:04:28 2017
@@ -21,9 +21,11 @@ package org.apache.axiom.soap.impl.mixin
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.axiom.core.CoreNode;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.common.util.LocaleUtil;
 import org.apache.axiom.soap.SOAPFaultText;
 import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultReason;
 
@@ -61,4 +63,19 @@ public aspect AxiomSOAP12FaultReasonSupp
         }
         return null;
     }
+
+    public final String AxiomSOAP12FaultReason.getFaultReasonText(Locale locale) {
+        String text = "";
+        int maxScore = -1;
+        for (Iterator<OMElement> it = getChildElements(); it.hasNext(); ) {
+            SOAPFaultText textNode = (SOAPFaultText)it.next();
+            String lang = textNode.getLang();
+            int score = LocaleUtil.getMatchScore(locale, lang == null ? null : Locale.forLanguageTag(lang));
+            if (score > maxScore) {
+                text = textNode.getText();
+                maxScore = score;
+            }
+        }
+        return text;
+    }
 }

Added: webservices/axiom/trunk/aspects/om-aspects/src/test/java/org/apache/axiom/om/impl/common/util/LocaleUtilTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/test/java/org/apache/axiom/om/impl/common/util/LocaleUtilTest.java?rev=1797517&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/test/java/org/apache/axiom/om/impl/common/util/LocaleUtilTest.java
(added)
+++ webservices/axiom/trunk/aspects/om-aspects/src/test/java/org/apache/axiom/om/impl/common/util/LocaleUtilTest.java
Sat Jun  3 16:04:28 2017
@@ -0,0 +1,43 @@
+/*
+ * 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.axiom.om.impl.common.util;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.util.Locale;
+
+import org.junit.Test;
+
+public class LocaleUtilTest {
+    private static void assertCloserMatch(Locale requested, Locale closer, Locale other)
{
+        assertThat(LocaleUtil.getMatchScore(requested, closer)).isGreaterThan(LocaleUtil.getMatchScore(requested,
other));
+    }
+
+    @Test
+    public void testGetMatchScore() {
+        assertCloserMatch(new Locale("de", "DE"), new Locale("de", "DE"), new Locale("de"));
+        // English is always preferred over other non matching languages
+        assertCloserMatch(new Locale("de"), new Locale("en"), new Locale("fr"));
+        // Prefer locale without country
+        assertCloserMatch(new Locale("fr", "CA"), new Locale("fr"), new Locale("fr", "FR"));
+        assertCloserMatch(new Locale("de"), new Locale("en"), new Locale("en", "US"));
+        // No locale is better than a non matching locale
+        assertCloserMatch(new Locale("de"), null, new Locale("fr"));
+    }
+}

Propchange: webservices/axiom/trunk/aspects/om-aspects/src/test/java/org/apache/axiom/om/impl/common/util/LocaleUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultReason.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultReason.java?rev=1797517&r1=1797516&r2=1797517&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultReason.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/SOAPFaultReason.java
Sat Jun  3 16:04:28 2017
@@ -22,6 +22,7 @@ package org.apache.axiom.soap;
 import org.apache.axiom.om.OMElement;
 
 import java.util.List;
+import java.util.Locale;
 
 public interface SOAPFaultReason extends OMElement {
     void addSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException;
@@ -31,4 +32,16 @@ public interface SOAPFaultReason extends
     List<SOAPFaultText> getAllSoapTexts();
 
     SOAPFaultText getSOAPFaultText(String language);
+
+    /**
+     * Extract the fault reason text for the locale that best matches the given locale. This
method
+     * works for all SOAP versions. Since SOAP 1.1 doesn't support localized fault reasons,
the
+     * locale is effectively ignored in that version. For SOAP 1.2 the method extracts the
text from
+     * the {@link SOAPFaultText} that best matches the given locale, falling back to English.
+     * 
+     * @param locale
+     *            the requested locale
+     * @return the reason text
+     */
+    String getFaultReasonText(Locale locale);
 }

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1797517&r1=1797516&r2=1797517&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
Sat Jun  3 16:04:28 2017
@@ -204,6 +204,7 @@ public class SOAPTestSuiteBuilder extend
             addTest(new org.apache.axiom.ts.soap.faultnode.TestGetFaultNodeValueWithParser(metaFactory,
spec));
             addTest(new org.apache.axiom.ts.soap.faultnode.TestSetFaultNodeValue(metaFactory,
spec));
         }
+        addTest(new org.apache.axiom.ts.soap.faultreason.TestGetFaultReasonText(metaFactory,
spec));
         addTest(new org.apache.axiom.ts.soap.faultrole.TestGetRoleValue(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.faultrole.TestGetRoleValueWithParser(metaFactory,
spec));
         addTest(new org.apache.axiom.ts.soap.faultrole.TestSetRoleValue(metaFactory, spec));
@@ -330,6 +331,9 @@ public class SOAPTestSuiteBuilder extend
         addTest(new org.apache.axiom.ts.soap12.faultreason.TestAddSOAPTextMultiple(metaFactory));
         addTest(new org.apache.axiom.ts.soap12.faultreason.TestAddSOAPTextWithSOAPVersionMismatch(metaFactory));
         addTest(new org.apache.axiom.ts.soap12.faultreason.TestGetAllSoapTextsWithParser(metaFactory));
+        addTest(new org.apache.axiom.ts.soap12.faultreason.TestGetFaultReasonText(metaFactory));
+        addTest(new org.apache.axiom.ts.soap12.faultreason.TestGetFaultReasonTextCaseSensitivity(metaFactory));
+        addTest(new org.apache.axiom.ts.soap12.faultreason.TestGetFaultReasonTextWithoutLangAttribute(metaFactory));
         addTest(new org.apache.axiom.ts.soap12.faultreason.TestGetFirstSOAPText(metaFactory));
         addTest(new org.apache.axiom.ts.soap12.faultreason.TestGetFirstSOAPTextWithParser(metaFactory));
         addTest(new org.apache.axiom.ts.soap12.faultsubcode.TestGetSubCodeNestedWithParser(metaFactory));

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultreason/TestGetFaultReasonText.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultreason/TestGetFaultReasonText.java?rev=1797517&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultreason/TestGetFaultReasonText.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultreason/TestGetFaultReasonText.java
Sat Jun  3 16:04:28 2017
@@ -0,0 +1,42 @@
+/*
+ * 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.axiom.ts.soap.faultreason;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.util.Locale;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.ts.soap.SOAPSampleSet;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SampleBasedSOAPTestCase;
+
+public class TestGetFaultReasonText extends SampleBasedSOAPTestCase {
+    public TestGetFaultReasonText(OMMetaFactory metaFactory, SOAPSpec spec) {
+        super(metaFactory, spec, SOAPSampleSet.SIMPLE_FAULT);
+    }
+
+    @Override
+    protected void runTest(SOAPEnvelope envelope) throws Throwable {
+        SOAPFaultReason reason = envelope.getBody().getFault().getReason();
+        assertThat(reason.getFaultReasonText(Locale.ENGLISH)).isEqualTo("Request execution
failure caused by system error");
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultreason/TestGetFaultReasonText.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonText.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonText.java?rev=1797517&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonText.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonText.java
Sat Jun  3 16:04:28 2017
@@ -0,0 +1,44 @@
+/*
+ * 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.axiom.ts.soap12.faultreason;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.util.Locale;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.ts.soap.SOAPSample;
+import org.apache.axiom.ts.soap.SampleBasedSOAPTestCase;
+
+public class TestGetFaultReasonText extends SampleBasedSOAPTestCase {
+    public TestGetFaultReasonText(OMMetaFactory metaFactory) {
+        super(metaFactory, SOAPSample.SOAP12_FAULT);
+    }
+
+    @Override
+    protected void runTest(SOAPEnvelope envelope) throws Throwable {
+        SOAPFaultReason reason = envelope.getBody().getFault().getReason();
+        assertThat(reason.getFaultReasonText(Locale.GERMAN)).isEqualTo("Senderseitige Zeitüberschreitung");
+        assertThat(reason.getFaultReasonText(Locale.GERMANY)).isEqualTo("Senderseitige Zeitüberschreitung");
+        assertThat(reason.getFaultReasonText(Locale.ENGLISH)).isEqualTo("Sender Timeout");
+        assertThat(reason.getFaultReasonText(Locale.FRENCH)).isEqualTo("Sender Timeout");
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonText.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextCaseSensitivity.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextCaseSensitivity.java?rev=1797517&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextCaseSensitivity.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextCaseSensitivity.java
Sat Jun  3 16:04:28 2017
@@ -0,0 +1,44 @@
+/*
+ * 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.axiom.ts.soap12.faultreason;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.util.Locale;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestGetFaultReasonTextCaseSensitivity extends SOAPTestCase {
+    public TestGetFaultReasonTextCaseSensitivity(OMMetaFactory metaFactory) {
+        super(metaFactory, SOAPSpec.SOAP12);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        SOAPFaultReason reason = soapFactory.createSOAPFaultReason();
+        SOAPFaultText text = soapFactory.createSOAPFaultText(reason);
+        text.setLang("EN-US");
+        text.setText("Some reason");
+        assertThat(reason.getFaultReasonText(Locale.ENGLISH)).isEqualTo("Some reason");
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextCaseSensitivity.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextWithoutLangAttribute.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextWithoutLangAttribute.java?rev=1797517&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextWithoutLangAttribute.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextWithoutLangAttribute.java
Sat Jun  3 16:04:28 2017
@@ -0,0 +1,43 @@
+/*
+ * 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.axiom.ts.soap12.faultreason;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.util.Locale;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestGetFaultReasonTextWithoutLangAttribute extends SOAPTestCase {
+    public TestGetFaultReasonTextWithoutLangAttribute(OMMetaFactory metaFactory) {
+        super(metaFactory, SOAPSpec.SOAP12);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        SOAPFaultReason reason = soapFactory.createSOAPFaultReason();
+        SOAPFaultText text = soapFactory.createSOAPFaultText(reason);
+        text.setText("Some reason");
+        assertThat(reason.getFaultReasonText(Locale.ENGLISH)).isEqualTo("Some reason");
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/faultreason/TestGetFaultReasonTextWithoutLangAttribute.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message