Author: barrettj
Date: Mon Mar 15 20:39:31 2010
New Revision: 923426
URL: http://svn.apache.org/viewvc?rev=923426&view=rev
Log:
Support for client-side WebServiceFeature settings to be configured via DBC.
Associated TDD test.
Added:
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/builder/WebServiceFeatureTests.java
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java?rev=923426&r1=923425&r2=923426&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MDQConstants.java
Mon Mar 15 20:39:31 2010
@@ -58,6 +58,11 @@ public class MDQConstants {
public static final String HANDLER_CHAIN_DECLARING_CLASS =
"HANDLER_CHAIN_DECLARING_CLASS";
public static final String SEI_MTOM_ENABLEMENT_MAP =
"org.apache.axis2.jaxws.description.builder.SEI_MTOM_ENABLEMENT_MAP";
+ // Note that this property is ONLY used on the client-side, not the server
side.
+ // Value is Map<String, List<java.lang.annotation.Annotation>> where
+ // String: SEI Class name (i.e. the port name)
+ // Annotation: The list of WebServiceFeatures expressed as the
corresponding Annotation related to that Port
+ public static final String SEI_FEATURES_MAP =
"org.apache.axis2.jaxws.description.build.SEI_FEATURES_MAP";
public static final String BINDING_PROPS_MAP =
"org.apache.axis2.jaxws.description.builder.BINDING_PROPS_MAP";
//Represent SOAP/JMS Bindings
Added:
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/builder/WebServiceFeatureTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/builder/WebServiceFeatureTests.java?rev=923426&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/builder/WebServiceFeatureTests.java
(added)
+++
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/builder/WebServiceFeatureTests.java
Mon Mar 15 20:39:31 2010
@@ -0,0 +1,79 @@
+/*
+ * 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.axis2.jaxws.description.builder;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Validate setting WebServiceFeatures on client-side DBC objects.
+ */
+public class WebServiceFeatureTests extends TestCase {
+
+ public void testSetFeaturePropertyOnDBC() {
+ DescriptionBuilderComposite sparseComposite = new
DescriptionBuilderComposite();
+ sparseComposite.getProperties().put(MDQConstants.SEI_FEATURES_MAP,
null);
+ assertNull("Property could not be retreived",
+
sparseComposite.getProperties().get(MDQConstants.SEI_FEATURES_MAP));
+ }
+
+ public void testSetFeatureValueOnDBC() {
+ DescriptionBuilderComposite sparseComposite = new
DescriptionBuilderComposite();
+ Map<String, List<Annotation>> map = new HashMap();
+
+ ArrayList<Annotation> wsFeatures1 = new ArrayList<Annotation>();
+ Annotation seiFeature1 = new MTOMAnnot();
+ wsFeatures1.add(seiFeature1);
+ Annotation seiFeature2 = new RespectBindingAnnot();
+ wsFeatures1.add(seiFeature2);
+ Annotation seiFeature3 = new AddressingAnnot();
+ wsFeatures1.add(seiFeature3);
+ map.put("sei1", wsFeatures1);
+
+ ArrayList<Annotation> wsFeatures2 = new ArrayList<Annotation>();
+ Annotation sei2Feature1 = new RespectBindingAnnot();
+ wsFeatures2.add(sei2Feature1);
+ map.put("sei2", wsFeatures2);
+
+ sparseComposite.getProperties().put(MDQConstants.SEI_FEATURES_MAP,
map);
+
+ // Validate we got back out what we put in
+
+ Map<String, List<Annotation>> checkMap = (Map<String,
List<Annotation>>)
+ sparseComposite.getProperties().get(MDQConstants.SEI_FEATURES_MAP);
+
+ assertTrue(checkMap.containsKey("sei1"));
+ assertTrue(checkMap.containsKey("sei2"));
+
+ ArrayList<Annotation> checkSEI1 = (ArrayList<Annotation>)
checkMap.get("sei1");
+ assertEquals("Wrong number of WS Features", 3, checkSEI1.size());
+ assertTrue(checkSEI1.contains(seiFeature1));
+ assertTrue(checkSEI1.contains(seiFeature2));
+ assertTrue(checkSEI1.contains(seiFeature3));
+
+ ArrayList<Annotation> checkSEI2 = (ArrayList<Annotation>)
checkMap.get("sei2");
+ assertEquals("Wrong number of WS Features", 1, checkSEI2.size());
+ }
+}