ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1606561 - in /webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap: ./ fault/
Date Sun, 29 Jun 2014 18:44:06 GMT
Author: veithen
Date: Sun Jun 29 18:44:05 2014
New Revision: 1606561

URL: http://svn.apache.org/r1606561
Log:
Use the new SOAPSpec metadata to simplify some test cases.

Added:
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestGetChild.java
  (with props)
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChild.java
  (with props)
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChildVersionMismatch.java
  (with props)
Removed:
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestGetCode.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestGetDetail.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestGetReason.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestGetRole.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetCode.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetDetail.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetReason.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetRole.java
Modified:
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapterFactory.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPFaultChildAdapter.java
    webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java

Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapterFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapterFactory.java?rev=1606561&r1=1606560&r2=1606561&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapterFactory.java
(original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapterFactory.java
Sun Jun 29 18:44:05 2014
@@ -94,6 +94,11 @@ public class SOAPElementTypeAdapterFacto
                     return factory.createSOAPFaultCode((SOAPFault)parent);
                 }
                 
+                @Override
+                public OMElement get(SOAPFault fault) {
+                    return fault.getCode();
+                }
+
                 public void set(SOAPFault fault, OMElement element) {
                     fault.setCode((SOAPFaultCode)element);
                 }
@@ -141,6 +146,11 @@ public class SOAPElementTypeAdapterFacto
                     return factory.createSOAPFaultReason((SOAPFault)parent);
                 }
                 
+                @Override
+                public OMElement get(SOAPFault fault) {
+                    return fault.getReason();
+                }
+
                 public void set(SOAPFault fault, OMElement element) {
                     fault.setReason((SOAPFaultReason)element);
                 }
@@ -168,6 +178,11 @@ public class SOAPElementTypeAdapterFacto
                     return factory.createSOAPFaultNode((SOAPFault)parent);
                 }
                 
+                @Override
+                public OMElement get(SOAPFault fault) {
+                    return fault.getNode();
+                }
+
                 public void set(SOAPFault fault, OMElement element) {
                     fault.setNode((SOAPFaultNode)element);
                 }
@@ -183,6 +198,11 @@ public class SOAPElementTypeAdapterFacto
                     return factory.createSOAPFaultRole((SOAPFault)parent);
                 }
                 
+                @Override
+                public OMElement get(SOAPFault fault) {
+                    return fault.getRole();
+                }
+
                 public void set(SOAPFault fault, OMElement element) {
                     fault.setRole((SOAPFaultRole)element);
                 }
@@ -198,6 +218,11 @@ public class SOAPElementTypeAdapterFacto
                     return factory.createSOAPFaultDetail((SOAPFault)parent);
                 }
                 
+                @Override
+                public OMElement get(SOAPFault fault) {
+                    return fault.getDetail();
+                }
+
                 public void set(SOAPFault fault, OMElement element) {
                     fault.setDetail((SOAPFaultDetail)element);
                 }

Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPFaultChildAdapter.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPFaultChildAdapter.java?rev=1606561&r1=1606560&r2=1606561&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPFaultChildAdapter.java
(original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPFaultChildAdapter.java
Sun Jun 29 18:44:05 2014
@@ -27,5 +27,6 @@ public abstract class SOAPFaultChildAdap
         super(type);
     }
     
+    public abstract OMElement get(SOAPFault fault);
     public abstract void set(SOAPFault fault, OMElement element);
 }

Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1606561&r1=1606560&r2=1606561&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
(original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
Sun Jun 29 18:44:05 2014
@@ -192,20 +192,21 @@ public class SOAPTestSuiteBuilder extend
             addTest(new org.apache.axiom.ts.soap.fault.TestChildOrder(metaFactory, spec,
                     new SOAPFaultChild[] { SOAPFaultChild.CODE, SOAPFaultChild.REASON, SOAPFaultChild.DETAIL,
SOAPFaultChild.REASON }, ss));
         }
-        addTest(new org.apache.axiom.ts.soap.fault.TestGetCode(metaFactory, spec));
+        for (SOAPElementType type : SOAPElementType.FAULT.getChildTypes()) {
+            if (type.getQName(spec) != null) {
+                addTest(new org.apache.axiom.ts.soap.fault.TestGetChild(metaFactory, spec,
(SOAPFaultChild)type));
+                addTest(new org.apache.axiom.ts.soap.fault.TestSetChild(metaFactory, spec,
(SOAPFaultChild)type));
+                if (type.getQName(spec.getAltSpec()) != null) {
+                    addTest(new org.apache.axiom.ts.soap.fault.TestSetChildVersionMismatch(metaFactory,
spec, (SOAPFaultChild)type));
+                }
+            }
+        }
         addTest(new org.apache.axiom.ts.soap.fault.TestGetCodeWithParser(metaFactory, spec));
-        addTest(new org.apache.axiom.ts.soap.fault.TestGetDetail(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.fault.TestGetDetailWithParser(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.fault.TestGetException(metaFactory, spec));
-        addTest(new org.apache.axiom.ts.soap.fault.TestGetReason(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.fault.TestGetReasonWithParser(metaFactory, spec));
-        addTest(new org.apache.axiom.ts.soap.fault.TestGetRole(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.fault.TestGetRoleWithParser(metaFactory, spec));
-        addTest(new org.apache.axiom.ts.soap.fault.TestSetCode(metaFactory, spec));
-        addTest(new org.apache.axiom.ts.soap.fault.TestSetDetail(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.fault.TestSetException(metaFactory, spec));
-        addTest(new org.apache.axiom.ts.soap.fault.TestSetReason(metaFactory, spec));
-        addTest(new org.apache.axiom.ts.soap.fault.TestSetRole(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.fault.TestWrongParent1(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.fault.TestWrongParent2(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.fault.TestWrongParent3(metaFactory, spec));

Added: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestGetChild.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestGetChild.java?rev=1606561&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestGetChild.java
(added)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestGetChild.java
Sun Jun 29 18:44:05 2014
@@ -0,0 +1,47 @@
+/*
+ * 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.fault;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.ts.soap.SOAPElementType;
+import org.apache.axiom.ts.soap.SOAPFaultChild;
+import org.apache.axiom.ts.soap.SOAPFaultChildAdapter;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestGetChild extends SOAPTestCase {
+    private final SOAPFaultChild type;
+
+    public TestGetChild(OMMetaFactory metaFactory, SOAPSpec spec, SOAPFaultChild type) {
+        super(metaFactory, spec);
+        this.type = type;
+        type.getAdapter(SOAPFaultChildAdapter.class).addTestParameters(this);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        SOAPFaultChildAdapter adapter = type.getAdapter(SOAPFaultChildAdapter.class);
+        SOAPFault fault = soapFactory.createSOAPFault();
+        assertNull(adapter.get(fault));
+        OMElement child = adapter.create(soapFactory, SOAPElementType.FAULT, fault);
+        assertSame(child, adapter.get(fault));
+    }
+}

Propchange: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestGetChild.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChild.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChild.java?rev=1606561&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChild.java
(added)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChild.java
Sun Jun 29 18:44:05 2014
@@ -0,0 +1,47 @@
+/*
+ * 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.fault;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.ts.soap.SOAPFaultChild;
+import org.apache.axiom.ts.soap.SOAPFaultChildAdapter;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestSetChild extends SOAPTestCase {
+    private final SOAPFaultChild type;
+
+    public TestSetChild(OMMetaFactory metaFactory, SOAPSpec spec, SOAPFaultChild type) {
+        super(metaFactory, spec);
+        this.type = type;
+        type.getAdapter(SOAPFaultChildAdapter.class).addTestParameters(this);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        SOAPFaultChildAdapter adapter = type.getAdapter(SOAPFaultChildAdapter.class);
+        SOAPFault fault = soapFactory.createSOAPFault();
+        OMElement child = adapter.create(soapFactory);
+        adapter.set(fault, child);
+        assertSame(child, adapter.get(fault));
+        assertSame(child, fault.getFirstOMChild());
+    }
+}

Propchange: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChild.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChildVersionMismatch.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChildVersionMismatch.java?rev=1606561&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChildVersionMismatch.java
(added)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChildVersionMismatch.java
Sun Jun 29 18:44:05 2014
@@ -0,0 +1,51 @@
+/*
+ * 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.fault;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.ts.soap.SOAPFaultChild;
+import org.apache.axiom.ts.soap.SOAPFaultChildAdapter;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestSetChildVersionMismatch extends SOAPTestCase {
+    private final SOAPFaultChild type;
+
+    public TestSetChildVersionMismatch(OMMetaFactory metaFactory, SOAPSpec spec, SOAPFaultChild
type) {
+        super(metaFactory, spec);
+        this.type = type;
+        type.getAdapter(SOAPFaultChildAdapter.class).addTestParameters(this);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        SOAPFaultChildAdapter adapter = type.getAdapter(SOAPFaultChildAdapter.class);
+        SOAPFault fault = soapFactory.createSOAPFault();
+        OMElement child = adapter.create(altSoapFactory);
+        try {
+            adapter.set(fault, child);
+            fail("Expected SOAPProcessingException");
+        } catch (SOAPProcessingException ex) {
+            // Expected
+        }
+    }
+}

Propchange: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestSetChildVersionMismatch.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message