Author: barrettj Date: Mon Apr 26 18:51:19 2010 New Revision: 938189 URL: http://svn.apache.org/viewvc?rev=938189&view=rev Log: Add toString method to feature annots and modify DBC toString to include the WebService Feature list.
Added: axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/builder/PortCompositeTests.java Modified: axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/AddressingAnnot.java axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MTOMAnnot.java axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/RespectBindingAnnot.java Modified: axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/AddressingAnnot.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/AddressingAnnot.java?rev=938189&r1=938188&r2=938189&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/AddressingAnnot.java (original) +++ axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/AddressingAnnot.java Mon Apr 26 18:51:19 2010 @@ -57,4 +57,17 @@ public class AddressingAnnot implements return Addressing.class; } + public String toString() { + String string = null; + try { + string = "@" + getClass().getName() + + "(enabled=" + enabled + + ", required=" + required + + ", responses=" + responses + + ")"; + } catch (Throwable t) { + string = super.toString() + ": caught exception in toString(): " + t; + } + return string; + } } Modified: axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java?rev=938189&r1=938188&r2=938189&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java (original) +++ axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderComposite.java Mon Apr 26 18:51:19 2010 @@ -924,6 +924,17 @@ public class DescriptionBuilderComposite FieldDescriptionComposite fdc = fdcIter.next(); sb.append(fdc.toString()); } + + if (features != null && !features.isEmpty()) { + sb.append(newLine); + sb.append(newLine); + sb.append("WebService Feature Objects (as annotations):"); + sb.append(newLine); + for (Annotation annotation : features) { + sb.append(annotation.toString()); + sb.append(newLine); + } + } if(portCompositeList != null && Modified: axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MTOMAnnot.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MTOMAnnot.java?rev=938189&r1=938188&r2=938189&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MTOMAnnot.java (original) +++ axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MTOMAnnot.java Mon Apr 26 18:51:19 2010 @@ -46,4 +46,17 @@ public class MTOMAnnot implements MTOM { public Class<? extends Annotation> annotationType() { return MTOM.class; } + + public String toString() { + String string = null; + try { + string = "@" + getClass().getName() + + "(enabled=" + enabled + + ", threshold=" + threshold + + ")"; + } catch (Throwable t) { + string = super.toString() + ": caught exception in toString(): " + t; + } + return string; + } } Modified: axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/RespectBindingAnnot.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/RespectBindingAnnot.java?rev=938189&r1=938188&r2=938189&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/RespectBindingAnnot.java (original) +++ axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/RespectBindingAnnot.java Mon Apr 26 18:51:19 2010 @@ -37,5 +37,17 @@ public class RespectBindingAnnot impleme public Class<? extends Annotation> annotationType() { return RespectBinding.class; } + + public String toString() { + String string = null; + try { + string = "@" + getClass().getName() + + "(enabled=" + enabled + + ")"; + } catch (Throwable t) { + string = super.toString() + ": caught exception in toString(): " + t; + } + return string; + } } Added: axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/builder/PortCompositeTests.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/builder/PortCompositeTests.java?rev=938189&view=auto ============================================================================== --- axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/builder/PortCompositeTests.java (added) +++ axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/builder/PortCompositeTests.java Mon Apr 26 18:51:19 2010 @@ -0,0 +1,56 @@ +/* + * 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.List; + +import junit.framework.TestCase; + +/** + * + */ +public class PortCompositeTests extends TestCase { + + /** + * Validate that the toString method of the superclass DBC is called by the + * PortComposite. The WebService Features are output in the superclass, so verify + * that information is in the returned string. + */ + public void testBasicPortComposite_toString() { + DescriptionBuilderComposite dbc = new DescriptionBuilderComposite(); + List<Annotation> wsFeatureList = new ArrayList<Annotation>(); + wsFeatureList.add(new AddressingAnnot()); + wsFeatureList.add(new MTOMAnnot()); + wsFeatureList.add(new RespectBindingAnnot()); + + PortComposite pc = new PortComposite(dbc); + pc.setWebServiceFeatures(wsFeatureList); + + String string = pc.toString(); + + assertNotNull(string); + assertTrue("Does not contain Features", string.contains("WebService Feature Objects (as annotations):")); + assertTrue("Does not contain AddressingAnnot", string.contains("AddressingAnnot")); + assertTrue("Does not contain MTOMAnnot", string.contains("MTOMAnnot")); + assertTrue("Does not contain RespectBindingAnnot", string.contains("RespectBindingAnnot")); + } + +}