001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */package org.apache.cxf.aegis.integration;
019:
020: import javax.xml.namespace.QName;
021:
022: import org.w3c.dom.Node;
023:
024: import org.apache.cxf.aegis.AbstractAegisTest;
025: import org.apache.cxf.aegis.services.ArrayService;
026: import org.apache.cxf.aegis.services.BeanService;
027: import org.junit.Before;
028: import org.junit.Test;
029:
030: /**
031: * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
032: * @since Feb 21, 2004
033: */
034: public class WrappedTest extends AbstractAegisTest {
035: @Before
036: public void setUp() throws Exception {
037: super .setUp();
038: createService(BeanService.class, "BeanService", null);
039: createService(ArrayService.class, "Array", new QName(
040: "urn:Array", "Array"));
041: }
042:
043: @Test
044: public void testBeanService() throws Exception {
045: Node response = invoke("BeanService", "bean11.xml");
046:
047: addNamespace("sb", "http://services.aegis.cxf.apache.org");
048: assertValid("/s:Envelope/s:Body/sb:getSimpleBeanResponse",
049: response);
050: assertValid("//sb:getSimpleBeanResponse/sb:return", response);
051: assertValid(
052: "//sb:getSimpleBeanResponse/sb:return/sb:howdy[text()=\"howdy\"]",
053: response);
054: assertValid(
055: "//sb:getSimpleBeanResponse/sb:return/sb:bleh[text()=\"bleh\"]",
056: response);
057: }
058:
059: @Test
060: public void testBeanServiceWSDL() throws Exception {
061: Node doc = getWSDLDocument("BeanService");
062:
063: assertValid("/wsdl:definitions/wsdl:types", doc);
064: assertValid("/wsdl:definitions/wsdl:types/xsd:schema", doc);
065: assertValid(
066: "/wsdl:definitions/wsdl:types/"
067: + "xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']",
068: doc);
069: assertValid(
070: "//xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']/"
071: + "xsd:element[@name='getSubmitBean']", doc);
072: assertValid(
073: "//xsd:complexType[@name='getSubmitBean']/xsd:sequence"
074: + "/xsd:element[@name='bleh'][@type='string'][@minOccurs='0']",
075: doc);
076: assertValid(
077: "//xsd:complexType[@name='getSubmitBean']/xsd:sequence"
078: + "/xsd:element[@name='bean'][@type='SimpleBean'][@minOccurs='0']",
079: doc);
080:
081: assertValid(
082: "/wsdl:definitions/wsdl:types"
083: + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']",
084: doc);
085: assertValid(
086: "/wsdl:definitions/wsdl:types"
087: + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
088: + "/xsd:complexType[@name=\"SimpleBean\"]", doc);
089: assertValid(
090: "/wsdl:definitions/wsdl:types"
091: + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
092: + "/xsd:complexType[@name=\"SimpleBean\"]/xsd:sequence/xsd:element"
093: + "[@name=\"bleh\"][@minOccurs='0']", doc);
094: assertValid(
095: "/wsdl:definitions/wsdl:types"
096: + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
097: + "/xsd:complexType[@name=\"SimpleBean\"]/xsd:sequence/xsd:element"
098: + "[@name=\"howdy\"][@minOccurs='0']", doc);
099: assertValid(
100: "/wsdl:definitions/wsdl:types"
101: + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
102: + "/xsd:complexType[@name=\"SimpleBean\"]/xsd:sequence/xsd:element"
103: + "[@type=\"string\"]", doc);
104: }
105:
106: // public void testGetArray()
107: // throws Exception
108: // {
109: // Document response = invokeService("Array",
110: // "/org/codehaus/xfire/message/wrapped/GetStringArray11.xml");
111: //
112: // addNamespace("a", "urn:Array");
113: // addNamespace("sb", "http://test.java.xfire.codehaus.org");
114: // assertValid("//a:getStringArrayResponse", response);
115: // assertValid("//a:getStringArrayResponse/a:out/a:string", response);
116: // }
117: //
118: // public void testArrayService()
119: // throws Exception
120: // {
121: // Document response = invokeService("Array",
122: // "/org/codehaus/xfire/message/wrapped/SubmitStringArray11.xml");
123: //
124: // addNamespace("a", "urn:Array");
125: // addNamespace("sb", "http://test.java.xfire.codehaus.org");
126: // assertValid("//a:SubmitStringArrayResponse", response);
127: // assertValid("//a:SubmitStringArrayResponse/a:out[text()='true']",
128: // response);
129: // }
130: //
131: // public void testArrayServiceNoWhitespace()
132: // throws Exception
133: // {
134: // Document response = invokeService("Array",
135: // "/org/codehaus/xfire/message/wrapped/SubmitStringArray11NoWS.xml");
136: //
137: // addNamespace("a", "urn:Array");
138: // addNamespace("sb", "http://test.java.xfire.codehaus.org");
139: // assertValid("//a:SubmitStringArrayResponse", response);
140: // assertValid("//a:SubmitStringArrayResponse/a:out[text()='true']",
141: // response);
142: // }
143: //
144: // public void testArrayServiceWSDL()
145: // throws Exception
146: // {
147: // Document doc = getWSDLDocument("Array");
148: //
149: // addNamespace("wsdl", WSDLWriter.WSDL11_NS);
150: // addNamespace("wsdlsoap", WSDLWriter.WSDL11_SOAP_NS);
151: // addNamespace("xsd", SoapConstants.XSD);
152: //
153: // assertValid("/wsdl:definitions/wsdl:types", doc);
154: // assertValid("/wsdl:definitions/wsdl:types/xsd:schema", doc);
155: // assertValid("/wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='urn:Array']",
156: // doc);
157: // assertValid("//xsd:schema[@targetNamespace='urn:Array']/xsd:element[@name='SubmitBeanArray']",
158: // doc);
159: // assertValid(
160: // "//xsd:element[@name='SubmitStringArray']/xsd:complexType/xsd:sequence/xsd:element"
161: // + "[@name='array'][@type='tns:ArrayOfString']",
162: // doc);
163: // assertValid(
164: // "//xsd:element[@name='SubmitBeanArray']/xsd:complexType/xsd:sequence/xsd:element"
165: // + "[@name='array'][@type='ns1:ArrayOfSimpleBean']",
166: // doc);
167: // }
168: }
|