Package org.apache.wsdl

Source Code of org.apache.wsdl.MessageReuseTest

/*
* Copyright 2004,2005 The Apache Software Foundation.
*
* Licensed 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.wsdl;

import org.apache.axis2.wsdl.WSDLVersionWrapper;
import org.apache.axis2.wsdl.builder.WOMBuilderFactory;

import javax.wsdl.Definition;

public class MessageReuseTest extends AbstractTestCase {

    private WSDLDescription womDescription;

    private Definition wsdl4jDefinition;

    public MessageReuseTest(String arg) {
        super(arg);
    }

    protected void setUp() throws Exception {

        WSDLVersionWrapper wsdlVersionWrapper = null;
        if (null == this.womDescription) {
            String path = getTestResourceFile("BookQuote.wsdl").getAbsolutePath();
            wsdlVersionWrapper =
                    WOMBuilderFactory.getBuilder(org.apache.axis2.wsdl.WSDLConstants.WSDL_1_1)
                            .build(path);
            this.womDescription = wsdlVersionWrapper.getDescription();
        }
        if (null == wsdl4jDefinition) {
            this.wsdl4jDefinition = wsdlVersionWrapper.getDefinition();
        }

    }

    public void testMultipartmessageReuse() throws Exception {

        /*
          This test is written with a wrong conception that the generated messages
          (wrapped style) should be with the message name. It's got be the op name
          Commented until the test is fixed

        */

//        WSDLInterface interface1 = this.womDescription.getInterface(
//                new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote",
//                        "BookQuote"));
//        WSDLOperation operation1 = (WSDLOperation) interface1.getAllOperations()
//                .get("getBookPrice");
//        QName element1 = operation1.getInputMessage().getElementQName();
//        WSDLOperation operation2 = (WSDLOperation) interface1.getAllOperations()
//                .get("getBookPriceNonRobust");
//        QName element2 = operation2.getInputMessage().getElementQName();
//        assertEquals(element1, element2);
//
//        Iterator iterator = womDescription.getTypes().getExtensibilityElements()
//                .iterator();
//        Schema types = null;
//
//
//        int numberOfBookQuote_getBookPrice = 0;
//        while (iterator.hasNext()) {
//            WSDLExtensibilityElement temp = (WSDLExtensibilityElement) iterator.next();
//            if (ExtensionConstants.SCHEMA.equals(temp.getType())) {
//                types = (Schema) temp;
//                NodeList childNodes = types.getElementQName().getChildNodes();
//                for (int i = 0; i < childNodes.getLength(); i++) {
//                    Node item = childNodes.item(i);
//                    if (item instanceof Element) {
//                        Element tempElt = (Element) item;
//                        if ("complexType".equals(tempElt.getLocalName()) &&
//                                "BookQuote_getBookPrice".equals(
//                                        tempElt.getAttribute("name"))) {
//                            numberOfBookQuote_getBookPrice++;
//                        }
//
//                    }
//                }
//            }
//        }
//
//
//        assertEquals(numberOfBookQuote_getBookPrice, 1);



          assertTrue(true);

    }
}
TOP

Related Classes of org.apache.wsdl.MessageReuseTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.