You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2014/06/23 18:24:45 UTC
svn commit: r1604863 - in /webservices/axiom/trunk:
modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/
modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/
modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/f...
Author: veithen
Date: Mon Jun 23 16:24:45 2014
New Revision: 1604863
URL: http://svn.apache.org/r1604863
Log:
Factored out the Axiom specific methods in SOAPElementType and SOAPFaultChild.
Added:
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapter.java
- copied, changed from r1604862, webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapterFactory.java (with props)
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPFaultChildAdapter.java
- copied, changed from r1604862, webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/AdapterType.java
- copied, changed from r1604862, webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapterFactory.java
Modified:
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAccessor.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAdapterFactory.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpecAdapterFactory.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapter.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapterFactory.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPElementType.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPFaultChild.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPElement.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/resources/META-INF/services/org.apache.axiom.ts.soap.AdapterFactory
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/Adapters.java
webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SOAPSpecAdapter.java
webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SOAPSpecAdapterFactory.java
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAccessor.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAccessor.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAccessor.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAccessor.java Mon Jun 23 16:24:45 2014
@@ -24,6 +24,7 @@ import org.apache.axiom.soap.SOAPHeaderB
* {@link BooleanAttribute} adapter that allows to invoke the getter and setter methods for the
* attribute on a given {@link SOAPHeaderBlock}.
*/
+@AdapterType
public interface BooleanAttributeAccessor {
/**
* Invoke the getter method for this attribute on the given {@link SOAPHeaderBlock}.
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAdapterFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAdapterFactory.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAdapterFactory.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/BooleanAttributeAdapterFactory.java Mon Jun 23 16:24:45 2014
@@ -23,7 +23,7 @@ import org.apache.axiom.soap.SOAPHeaderB
public class BooleanAttributeAdapterFactory implements AdapterFactory<BooleanAttribute> {
public void createAdapters(BooleanAttribute attribute, Adapters adapters) {
if (attribute == BooleanAttribute.MUST_UNDERSTAND) {
- adapters.add(BooleanAttributeAccessor.class, new BooleanAttributeAccessor() {
+ adapters.add(new BooleanAttributeAccessor() {
public boolean getValue(SOAPHeaderBlock headerBlock) {
return headerBlock.getMustUnderstand();
}
@@ -33,7 +33,7 @@ public class BooleanAttributeAdapterFact
}
});
} else if (attribute == BooleanAttribute.RELAY) {
- adapters.add(BooleanAttributeAccessor.class, new BooleanAttributeAccessor() {
+ adapters.add(new BooleanAttributeAccessor() {
public boolean getValue(SOAPHeaderBlock headerBlock) {
return headerBlock.getRelay();
}
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java Mon Jun 23 16:24:45 2014
@@ -25,6 +25,7 @@ import org.apache.axiom.soap.SOAPFactory
* {@link SOAPSpec} adapter that allows to retrieve the {@link SOAPFactory} corresponding to the
* SOAP version from a {@link OMMetaFactory}.
*/
+@AdapterType
public interface FactorySelector {
SOAPFactory getFactory(OMMetaFactory metaFactory);
}
Copied: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapter.java (from r1604862, webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapter.java?p2=webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapter.java&p1=webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java&r1=1604862&r2=1604863&rev=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapter.java Mon Jun 23 16:24:45 2014
@@ -18,13 +18,26 @@
*/
package org.apache.axiom.ts.soap;
-import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.testutils.suite.Dimension;
+import org.apache.axiom.testutils.suite.MatrixTestCase;
-/**
- * {@link SOAPSpec} adapter that allows to retrieve the {@link SOAPFactory} corresponding to the
- * SOAP version from a {@link OMMetaFactory}.
- */
-public interface FactorySelector {
- SOAPFactory getFactory(OMMetaFactory metaFactory);
+@AdapterType
+public abstract class SOAPElementTypeAdapter implements Dimension {
+ private final Class<? extends OMElement> type;
+
+ SOAPElementTypeAdapter(Class<? extends OMElement> type) {
+ this.type = type;
+ }
+
+ public final void addTestParameters(MatrixTestCase testCase) {
+ testCase.addTestParameter("type", type.getSimpleName());
+ }
+
+ public final Class<? extends OMElement> getType() {
+ return type;
+ }
+
+ public abstract OMElement create(SOAPFactory factory);
}
Added: 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=1604863&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapterFactory.java (added)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapterFactory.java Mon Jun 23 16:24:45 2014
@@ -0,0 +1,148 @@
+/*
+ * 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;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.ts.soap.factory.SOAPElementType;
+import org.apache.axiom.ts.soap.factory.SOAPFaultChild;
+
+public class SOAPElementTypeAdapterFactory implements AdapterFactory<SOAPElementType> {
+ public void createAdapters(SOAPElementType type, Adapters adapters) {
+ if (type == SOAPElementType.ENVELOPE) {
+ adapters.add(new SOAPElementTypeAdapter(SOAPEnvelope.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPEnvelope();
+ }
+ });
+ } else if (type == SOAPElementType.HEADER) {
+ adapters.add(new SOAPElementTypeAdapter(SOAPHeader.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPHeader();
+ }
+ });
+ } else if (type == SOAPElementType.BODY) {
+ adapters.add(new SOAPElementTypeAdapter(SOAPBody.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPBody();
+ }
+ });
+ } else if (type == SOAPFaultChild.CODE) {
+ adapters.add(new SOAPFaultChildAdapter(SOAPFaultCode.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultCode();
+ }
+
+ public OMElement create(SOAPFactory factory, SOAPFault parent) {
+ return factory.createSOAPFaultCode(parent);
+ }
+
+ public void set(SOAPFault fault, OMElement element) {
+ fault.setCode((SOAPFaultCode)element);
+ }
+ });
+ } else if (type == SOAPElementType.VALUE) {
+ adapters.add(new SOAPElementTypeAdapter(SOAPFaultValue.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultValue();
+ }
+ });
+ } else if (type == SOAPElementType.SUB_CODE) {
+ adapters.add(new SOAPElementTypeAdapter(SOAPFaultSubCode.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultSubCode();
+ }
+ });
+ } else if (type == SOAPFaultChild.REASON) {
+ adapters.add(new SOAPFaultChildAdapter(SOAPFaultReason.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultReason();
+ }
+
+ public OMElement create(SOAPFactory factory, SOAPFault parent) {
+ return factory.createSOAPFaultReason(parent);
+ }
+
+ public void set(SOAPFault fault, OMElement element) {
+ fault.setReason((SOAPFaultReason)element);
+ }
+ });
+ } else if (type == SOAPElementType.TEXT) {
+ adapters.add(new SOAPElementTypeAdapter(SOAPFaultText.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultText();
+ }
+ });
+ } else if (type == SOAPFaultChild.NODE) {
+ adapters.add(new SOAPFaultChildAdapter(SOAPFaultNode.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultNode();
+ }
+
+ public OMElement create(SOAPFactory factory, SOAPFault parent) {
+ return factory.createSOAPFaultNode(parent);
+ }
+
+ public void set(SOAPFault fault, OMElement element) {
+ fault.setNode((SOAPFaultNode)element);
+ }
+ });
+ } else if (type == SOAPFaultChild.ROLE) {
+ adapters.add(new SOAPFaultChildAdapter(SOAPFaultRole.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultRole();
+ }
+
+ public OMElement create(SOAPFactory factory, SOAPFault parent) {
+ return factory.createSOAPFaultRole(parent);
+ }
+
+ public void set(SOAPFault fault, OMElement element) {
+ fault.setRole((SOAPFaultRole)element);
+ }
+ });
+ } else if (type == SOAPFaultChild.DETAIL) {
+ adapters.add(new SOAPFaultChildAdapter(SOAPFaultDetail.class) {
+ public OMElement create(SOAPFactory factory) {
+ return factory.createSOAPFaultDetail();
+ }
+
+ public OMElement create(SOAPFactory factory, SOAPFault parent) {
+ return factory.createSOAPFaultDetail(parent);
+ }
+
+ public void set(SOAPFault fault, OMElement element) {
+ fault.setDetail((SOAPFaultDetail)element);
+ }
+ });
+ }
+ }
+}
Propchange: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPElementTypeAdapterFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPFaultChildAdapter.java (from r1604862, webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPFaultChildAdapter.java?p2=webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPFaultChildAdapter.java&p1=webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java&r1=1604862&r2=1604863&rev=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/FactorySelector.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPFaultChildAdapter.java Mon Jun 23 16:24:45 2014
@@ -18,13 +18,16 @@
*/
package org.apache.axiom.ts.soap;
-import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
-/**
- * {@link SOAPSpec} adapter that allows to retrieve the {@link SOAPFactory} corresponding to the
- * SOAP version from a {@link OMMetaFactory}.
- */
-public interface FactorySelector {
- SOAPFactory getFactory(OMMetaFactory metaFactory);
+@AdapterType
+public abstract class SOAPFaultChildAdapter extends SOAPElementTypeAdapter {
+ SOAPFaultChildAdapter(Class<? extends OMElement> type) {
+ super(type);
+ }
+
+ public abstract OMElement create(SOAPFactory factory, SOAPFault parent);
+ public abstract void set(SOAPFault fault, OMElement element);
}
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpecAdapterFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpecAdapterFactory.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpecAdapterFactory.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpecAdapterFactory.java Mon Jun 23 16:24:45 2014
@@ -27,14 +27,14 @@ import org.apache.axiom.soap.SOAPVersion
public class SOAPSpecAdapterFactory implements AdapterFactory<SOAPSpec> {
public void createAdapters(SOAPSpec spec, Adapters adapters) {
if (spec == SOAPSpec.SOAP11) {
- adapters.add(FactorySelector.class, new FactorySelector() {
+ adapters.add(new FactorySelector() {
public SOAPFactory getFactory(OMMetaFactory metaFactory) {
return metaFactory.getSOAP11Factory();
}
});
adapters.add(SOAPVersion.class, SOAP11Version.getSingleton());
} else if (spec == SOAPSpec.SOAP12) {
- adapters.add(FactorySelector.class, new FactorySelector() {
+ adapters.add(new FactorySelector() {
public SOAPFactory getFactory(OMMetaFactory metaFactory) {
return metaFactory.getSOAP12Factory();
}
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapter.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapter.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapter.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapter.java Mon Jun 23 16:24:45 2014
@@ -31,6 +31,7 @@ import org.xml.sax.InputSource;
* {@link TestMessage} adapter that adds some Axiom specific methods to retrieve the content of the
* test message.
*/
+@AdapterType
public final class TestMessageAdapter {
private final TestMessage testMessage;
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapterFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapterFactory.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapterFactory.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapterFactory.java Mon Jun 23 16:24:45 2014
@@ -20,6 +20,6 @@ package org.apache.axiom.ts.soap;
public class TestMessageAdapterFactory implements AdapterFactory<TestMessage> {
public void createAdapters(TestMessage testMessage, Adapters adapters) {
- adapters.add(TestMessageAdapter.class, new TestMessageAdapter(testMessage));
+ adapters.add(new TestMessageAdapter(testMessage));
}
}
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPElementType.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPElementType.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPElementType.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPElementType.java Mon Jun 23 16:24:45 2014
@@ -20,128 +20,47 @@ package org.apache.axiom.ts.soap.factory
import javax.xml.namespace.QName;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPFaultSubCode;
-import org.apache.axiom.soap.SOAPFaultText;
-import org.apache.axiom.soap.SOAPFaultValue;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axiom.testutils.suite.Dimension;
-import org.apache.axiom.testutils.suite.MatrixTestCase;
+import org.apache.axiom.ts.soap.Adaptable;
import org.apache.axiom.ts.soap.SOAPSpec;
-public interface SOAPElementType extends Dimension {
- SOAPElementType ENVELOPE = new SOAPElementType() {
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPEnvelope");
- }
-
- public Class getType() {
- return SOAPEnvelope.class;
- }
-
+public abstract class SOAPElementType extends Adaptable {
+ public static final SOAPElementType ENVELOPE = new SOAPElementType() {
public QName getQName(SOAPSpec spec) {
return spec.getEnvelopeQName();
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPEnvelope();
- }
};
- SOAPElementType HEADER = new SOAPElementType() {
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPHeader");
- }
-
- public Class getType() {
- return SOAPHeader.class;
- }
-
+ public static final SOAPElementType HEADER = new SOAPElementType() {
public QName getQName(SOAPSpec spec) {
return spec.getHeaderQName();
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPHeader();
- }
};
- SOAPElementType BODY = new SOAPElementType() {
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPBody");
- }
-
- public Class getType() {
- return SOAPBody.class;
- }
-
+ public static final SOAPElementType BODY = new SOAPElementType() {
public QName getQName(SOAPSpec spec) {
return spec.getBodyQName();
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPBody();
- }
};
- SOAPElementType VALUE = new SOAPElementType() {
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPFaultValue");
- }
-
- public Class getType() {
- return SOAPFaultValue.class;
- }
-
+ public static final SOAPElementType VALUE = new SOAPElementType() {
public QName getQName(SOAPSpec spec) {
return spec.getFaultValueQName();
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPFaultValue();
- }
};
- SOAPElementType SUB_CODE = new SOAPElementType() {
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPFaultSubCode");
- }
-
- public Class getType() {
- return SOAPFaultSubCode.class;
- }
-
+ public static final SOAPElementType SUB_CODE = new SOAPElementType() {
public QName getQName(SOAPSpec spec) {
return spec.getFaultSubCodeQName();
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPFaultSubCode();
- }
};
- SOAPElementType TEXT = new SOAPElementType() {
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPFaultText");
- }
-
- public Class getType() {
- return SOAPFaultText.class;
- }
-
+ public static final SOAPElementType TEXT = new SOAPElementType() {
public QName getQName(SOAPSpec spec) {
return spec.getFaultTextQName();
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPFaultText();
- }
};
- Class getType();
+ SOAPElementType() {}
/**
* Get the qualified name for this element type in the given SOAP version.
@@ -151,7 +70,5 @@ public interface SOAPElementType extends
* @return the element name, or <code>null</code> if the element type doesn't exist in the given
* SOAP version
*/
- QName getQName(SOAPSpec spec);
-
- OMElement create(SOAPFactory factory);
+ public abstract QName getQName(SOAPSpec spec);
}
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPFaultChild.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPFaultChild.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPFaultChild.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/SOAPFaultChild.java Mon Jun 23 16:24:45 2014
@@ -20,27 +20,10 @@ package org.apache.axiom.ts.soap.factory
import javax.xml.namespace.QName;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPFault;
-import org.apache.axiom.soap.SOAPFaultCode;
-import org.apache.axiom.soap.SOAPFaultDetail;
-import org.apache.axiom.soap.SOAPFaultNode;
-import org.apache.axiom.soap.SOAPFaultReason;
-import org.apache.axiom.soap.SOAPFaultRole;
-import org.apache.axiom.testutils.suite.MatrixTestCase;
import org.apache.axiom.ts.soap.SOAPSpec;
-public interface SOAPFaultChild extends SOAPElementType {
- SOAPFaultChild CODE = new SOAPFaultChild() {
- public Class getType() {
- return SOAPFaultCode.class;
- }
-
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPFaultCode");
- }
-
+public abstract class SOAPFaultChild extends SOAPElementType {
+ public static final SOAPFaultChild CODE = new SOAPFaultChild() {
public QName getQName(SOAPSpec spec) {
return spec.getFaultCodeQName();
}
@@ -48,29 +31,9 @@ public interface SOAPFaultChild extends
public int getOrder() {
return 1;
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPFaultCode();
- }
-
- public OMElement create(SOAPFactory factory, SOAPFault parent) {
- return factory.createSOAPFaultCode(parent);
- }
-
- public void set(SOAPFault fault, OMElement element) {
- fault.setCode((SOAPFaultCode)element);
- }
};
- SOAPFaultChild REASON = new SOAPFaultChild() {
- public Class getType() {
- return SOAPFaultReason.class;
- }
-
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPFaultReason");
- }
-
+ public static final SOAPFaultChild REASON = new SOAPFaultChild() {
public QName getQName(SOAPSpec spec) {
return spec.getFaultReasonQName();
}
@@ -78,29 +41,9 @@ public interface SOAPFaultChild extends
public int getOrder() {
return 2;
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPFaultReason();
- }
-
- public OMElement create(SOAPFactory factory, SOAPFault parent) {
- return factory.createSOAPFaultReason(parent);
- }
-
- public void set(SOAPFault fault, OMElement element) {
- fault.setReason((SOAPFaultReason)element);
- }
};
- SOAPFaultChild NODE = new SOAPFaultChild() {
- public Class getType() {
- return SOAPFaultNode.class;
- }
-
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPFaultNode");
- }
-
+ public static final SOAPFaultChild NODE = new SOAPFaultChild() {
public QName getQName(SOAPSpec spec) {
return spec.getFaultNodeQName();
}
@@ -108,29 +51,9 @@ public interface SOAPFaultChild extends
public int getOrder() {
return 3;
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPFaultNode();
- }
-
- public OMElement create(SOAPFactory factory, SOAPFault parent) {
- return factory.createSOAPFaultNode(parent);
- }
-
- public void set(SOAPFault fault, OMElement element) {
- fault.setNode((SOAPFaultNode)element);
- }
};
- SOAPFaultChild ROLE = new SOAPFaultChild() {
- public Class getType() {
- return SOAPFaultRole.class;
- }
-
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPFaultRole");
- }
-
+ public static final SOAPFaultChild ROLE = new SOAPFaultChild() {
public QName getQName(SOAPSpec spec) {
return spec.getFaultRoleQName();
}
@@ -138,29 +61,9 @@ public interface SOAPFaultChild extends
public int getOrder() {
return 4;
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPFaultRole();
- }
-
- public OMElement create(SOAPFactory factory, SOAPFault parent) {
- return factory.createSOAPFaultRole(parent);
- }
-
- public void set(SOAPFault fault, OMElement element) {
- fault.setRole((SOAPFaultRole)element);
- }
};
- SOAPFaultChild DETAIL = new SOAPFaultChild() {
- public Class getType() {
- return SOAPFaultDetail.class;
- }
-
- public void addTestParameters(MatrixTestCase testCase) {
- testCase.addTestParameter("type", "SOAPFaultDetail");
- }
-
+ public static final SOAPFaultChild DETAIL = new SOAPFaultChild() {
public QName getQName(SOAPSpec spec) {
return spec.getFaultDetailQName();
}
@@ -168,21 +71,9 @@ public interface SOAPFaultChild extends
public int getOrder() {
return 5;
}
-
- public OMElement create(SOAPFactory factory) {
- return factory.createSOAPFaultDetail();
- }
-
- public OMElement create(SOAPFactory factory, SOAPFault parent) {
- return factory.createSOAPFaultDetail(parent);
- }
-
- public void set(SOAPFault fault, OMElement element) {
- fault.setDetail((SOAPFaultDetail)element);
- }
};
- int getOrder();
- OMElement create(SOAPFactory factory, SOAPFault parent);
- void set(SOAPFault fault, OMElement element);
+ private SOAPFaultChild() {}
+
+ public abstract int getOrder();
}
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPElement.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPElement.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/factory/TestCreateSOAPElement.java Mon Jun 23 16:24:45 2014
@@ -27,6 +27,7 @@ import org.apache.axiom.om.OMMetaFactory
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAPConstants;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.ts.soap.SOAPElementTypeAdapter;
import org.apache.axiom.ts.soap.SOAPSpec;
import org.apache.axiom.ts.soap.SOAPTestCase;
@@ -42,21 +43,21 @@ public class TestCreateSOAPElement exten
public TestCreateSOAPElement(OMMetaFactory metaFactory, SOAPSpec spec, SOAPElementType type) {
super(metaFactory, spec);
this.type = type;
- type.addTestParameters(this);
+ type.getAdapter(SOAPElementTypeAdapter.class).addTestParameters(this);
}
protected void runTest() throws Throwable {
QName expectedName = type.getQName(spec);
if (expectedName == null) {
try {
- type.create(soapFactory);
+ type.getAdapter(SOAPElementTypeAdapter.class).create(soapFactory);
fail("Expect UnsupportedOperationException");
} catch (UnsupportedOperationException ex) {
// Expected
}
} else {
String expectedPrefix = expectedName.getNamespaceURI().length() == 0 ? "" : SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX;
- OMElement child = type.create(soapFactory);
+ OMElement child = type.getAdapter(SOAPElementTypeAdapter.class).create(soapFactory);
QName actualName = child.getQName();
assertEquals(expectedName, actualName);
assertEquals(expectedPrefix, actualName.getPrefix());
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java Mon Jun 23 16:24:45 2014
@@ -31,6 +31,7 @@ import org.apache.axiom.soap.SOAPFault;
import org.apache.axiom.soap.SOAPFaultCode;
import org.apache.axiom.soap.SOAPFaultReason;
import org.apache.axiom.ts.dimension.serialization.SerializationStrategy;
+import org.apache.axiom.ts.soap.SOAPFaultChildAdapter;
import org.apache.axiom.ts.soap.SOAPSpec;
import org.apache.axiom.ts.soap.SOAPTestCase;
import org.apache.axiom.ts.soap.factory.SOAPFaultChild;
@@ -58,7 +59,7 @@ public class TestChildOrder extends SOAP
if (i>0) {
buffer.append(',');
}
- buffer.append(inputOrder[i].getType().getSimpleName());
+ buffer.append(inputOrder[i].getAdapter(SOAPFaultChildAdapter.class).getType().getSimpleName());
}
addTestParameter("inputOrder", buffer.toString());
serializationStrategy.addTestParameters(this);
@@ -68,8 +69,8 @@ public class TestChildOrder extends SOAP
SOAPFault fault = soapFactory.createSOAPFault();
// Add the elements in the specified order.
for (int i=0; i<inputOrder.length; i++) {
- SOAPFaultChild type = inputOrder[i];
- type.set(fault, type.create(soapFactory));
+ SOAPFaultChildAdapter adapter = inputOrder[i].getAdapter(SOAPFaultChildAdapter.class);
+ adapter.set(fault, adapter.create(soapFactory));
}
// Calculate the order in which we expect to see the children. Note that a given type
// may be added multiple times. Therefore we need to use a Set.
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/resources/META-INF/services/org.apache.axiom.ts.soap.AdapterFactory
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/resources/META-INF/services/org.apache.axiom.ts.soap.AdapterFactory?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/resources/META-INF/services/org.apache.axiom.ts.soap.AdapterFactory (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/resources/META-INF/services/org.apache.axiom.ts.soap.AdapterFactory Mon Jun 23 16:24:45 2014
@@ -17,5 +17,6 @@
# under the License.
#
org.apache.axiom.ts.soap.BooleanAttributeAdapterFactory
+org.apache.axiom.ts.soap.SOAPElementTypeAdapterFactory
org.apache.axiom.ts.soap.SOAPSpecAdapterFactory
org.apache.axiom.ts.soap.TestMessageAdapterFactory
\ No newline at end of file
Copied: webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/AdapterType.java (from r1604862, webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapterFactory.java)
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/AdapterType.java?p2=webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/AdapterType.java&p1=webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapterFactory.java&r1=1604862&r2=1604863&rev=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageAdapterFactory.java (original)
+++ webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/AdapterType.java Mon Jun 23 16:24:45 2014
@@ -18,8 +18,13 @@
*/
package org.apache.axiom.ts.soap;
-public class TestMessageAdapterFactory implements AdapterFactory<TestMessage> {
- public void createAdapters(TestMessage testMessage, Adapters adapters) {
- adapters.add(TestMessageAdapter.class, new TestMessageAdapter(testMessage));
- }
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AdapterType {
+
}
Modified: webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/Adapters.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/Adapters.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/Adapters.java (original)
+++ webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/Adapters.java Mon Jun 23 16:24:45 2014
@@ -19,7 +19,9 @@
package org.apache.axiom.ts.soap;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
public final class Adapters {
private final Map<Class<?>,Object> adapters = new HashMap<Class<?>,Object>();
@@ -29,6 +31,25 @@ public final class Adapters {
adapters.put(type, adapter);
}
+ public void add(Object adapter) {
+ add(adapter, adapter.getClass(), new HashSet<Class<?>>());
+ }
+
+ private void add(Object adapter, Class<?> asType, Set<Class<?>> seen) {
+ if (seen.add(asType)) {
+ if (asType.getAnnotation(AdapterType.class) != null) {
+ adapters.put(asType, adapter);
+ }
+ Class<?> superClass = asType.getSuperclass();
+ if (superClass != null) {
+ add(adapter, superClass, seen);
+ }
+ for (Class<?> iface : asType.getInterfaces()) {
+ add(adapter, iface, seen);
+ }
+ }
+ }
+
<T> T get(Class<T> type) {
return type.cast(adapters.get(type));
}
Modified: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SOAPSpecAdapter.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SOAPSpecAdapter.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SOAPSpecAdapter.java (original)
+++ webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SOAPSpecAdapter.java Mon Jun 23 16:24:45 2014
@@ -18,6 +18,9 @@
*/
package org.apache.axiom.ts.springws;
+import org.apache.axiom.ts.soap.AdapterType;
+
+@AdapterType
public final class SOAPSpecAdapter {
private final String soapVersion;
Modified: webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SOAPSpecAdapterFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SOAPSpecAdapterFactory.java?rev=1604863&r1=1604862&r2=1604863&view=diff
==============================================================================
--- webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SOAPSpecAdapterFactory.java (original)
+++ webservices/axiom/trunk/testsuites/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SOAPSpecAdapterFactory.java Mon Jun 23 16:24:45 2014
@@ -24,6 +24,6 @@ import org.apache.axiom.ts.soap.SOAPSpec
public class SOAPSpecAdapterFactory implements AdapterFactory<SOAPSpec> {
public void createAdapters(SOAPSpec spec, Adapters adapters) {
- adapters.add(SOAPSpecAdapter.class, new SOAPSpecAdapter(spec == SOAPSpec.SOAP11 ? "SOAP_11" : "SOAP_12"));
+ adapters.add(new SOAPSpecAdapter(spec == SOAPSpec.SOAP11 ? "SOAP_11" : "SOAP_12"));
}
}