complexdatatypescomplexdatatypessoap11test.java

来自「开源的axis2框架的源码。用于开发WEBSERVER」· Java 代码 · 共 610 行 · 第 1/2 页

JAVA
610
字号
/*
 * 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.
 */

/**
 * ComplexDataTypesComplexDataTypesSOAP11Test.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis2 version: SNAPSHOT May 30, 2007 (11:56:02 EDT)
 */
package org.apache.axis2.rpc.complex;

import org.apache.axiom.attachments.ByteArrayDataSource;
import org.apache.axiom.attachments.utils.IOUtils;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.integration.UtilServerBasedTestCase;
import org.apache.axis2.integration.UtilServer;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.engine.AxisConfiguration;
import org.tempuri.complex.data.arrays.xsd.ArrayOfArrayOfstring;
import org.tempuri.complex.data.arrays.xsd.ArrayOfNullableOfdateTime;
import org.tempuri.complex.data.arrays.xsd.ArrayOfNullableOfdecimal;
import org.tempuri.complex.data.arrays.xsd.ArrayOfPerson;
import org.tempuri.complex.data.arrays.xsd.ArrayOfanyType;
import org.tempuri.complex.data.arrays.xsd.ArrayOfint;
import org.tempuri.complex.data.arrays.xsd.ArrayOfshort;
import org.tempuri.complex.data.arrays.xsd.ArrayOfstring;
import org.tempuri.complex.data.xsd.*;

import javax.activation.DataHandler;
import javax.xml.namespace.QName;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Calendar;
import java.util.Arrays;
import java.rmi.RemoteException;

import junit.framework.TestCase;
import junit.framework.Test;
import junit.framework.TestSuite;



public class ComplexDataTypesComplexDataTypesSOAP11Test extends UtilServerBasedTestCase {

 protected EndpointReference targetEPR;
    protected QName serviceName = new QName("ComplexDataTypes");

    protected AxisConfiguration axisConfiguration;

    protected boolean finish = false;
    org.tempuri.complex.ComplexDataTypesComplexDataTypesSOAP11Port_httpStub stub;

    public ComplexDataTypesComplexDataTypesSOAP11Test() {
        super(ComplexDataTypesComplexDataTypesSOAP11Test.class.getName());
    }

    public ComplexDataTypesComplexDataTypesSOAP11Test(String testName) {
        super(testName);
    }

    public static Test suite() {
        return getTestSetup(new TestSuite(ComplexDataTypesComplexDataTypesSOAP11Test.class));
    }


    protected void setUp() throws Exception {
        String className = "org.tempuri.complex.ComplexDataTypes";
        UtilServer.start();
        AxisService   service = AxisService.createService(
                className, UtilServer.getConfigurationContext().getAxisConfiguration());
        service.setElementFormDefault(true);
        service.setName("ComplexDataTypes");
        service.setClassLoader(Thread.currentThread().getContextClassLoader());

        UtilServer.deployService(service);
         targetEPR =
                new EndpointReference("http://127.0.0.1:"
                        + (UtilServer.TESTING_PORT)
                        + "/axis2/services/ComplexDataTypes");
        stub  = new org.tempuri.complex.ComplexDataTypesComplexDataTypesSOAP11Port_httpStub(null,targetEPR.getAddress());
    }

    protected void tearDown() throws Exception {
        UtilServer.unDeployService(serviceName);
        UtilServer.unDeployClientService();
    }

    public void testretArrayInt1D() throws java.lang.Exception {


        assertNull(stub.retArrayInt1D(null));
        stub._getServiceClient().cleanupTransport();
        assertNotNull(stub.retArrayInt1D(new ArrayOfint()));
        stub._getServiceClient().cleanupTransport();
        ArrayOfint input = new ArrayOfint();
        input.set_int(new int[]{0, 1, 2});
        ArrayOfint ret = stub.retArrayInt1D(input);
        stub._getServiceClient().cleanupTransport();
        assertNotNull(ret);
        assertNotNull(ret.get_int());
        assertEquals(ret.get_int().length, 3);
    }

    /**
     * Auto generated test method
     */
    public void testretStructSNSAS() throws java.lang.Exception {
        assertNull(stub.retStructSNSAS(null));
        assertNotNull(stub.retStructSNSAS(new Group()));
        Group input = new Group();
        input.setName("xyz");
        input.setMembers(new ArrayOfPerson());
        assertNotNull(stub.retStructSNSAS(input));
    }

    /**
     * Auto generated test method
     */
    public void testretArrayDateTime1D() throws java.lang.Exception {

        assertNull(stub.retArrayDateTime1D(null));

        assertNotNull(stub.retArrayDateTime1D(new ArrayOfNullableOfdateTime()));

        ArrayOfNullableOfdateTime input = new ArrayOfNullableOfdateTime();
        input.setDateTime(new Calendar[]{Calendar.getInstance(), Calendar.getInstance()});
        assertNotNull(stub.retArrayDateTime1D(input));
    }

    /**
     * Auto generated test method
     */
    public void testretArrayString2D() throws java.lang.Exception {

        assertNull(stub.retArrayString2D(null));
        assertNotNull(stub.retArrayString2D(new ArrayOfArrayOfstring()));

        ArrayOfArrayOfstring input = new ArrayOfArrayOfstring();
        ArrayOfstring a2 = new ArrayOfstring();
        ArrayOfstring a1 = new ArrayOfstring();
        a1.setString(new String[]{"foo", "bar"});
        input.setArrayOfstring(new ArrayOfstring[]{a1, a2});
        assertNotNull(stub.retArrayString2D(input));
    }

    /**
     * Auto generated test method
     */
    public void testretArrayDecimal1D() throws java.lang.Exception {

        assertNull(stub.retArrayDecimal1D(null));
        assertNotNull(stub.retArrayDecimal1D(new ArrayOfNullableOfdecimal()));

        ArrayOfNullableOfdecimal input = new ArrayOfNullableOfdecimal();
        input.setDecimal(new BigDecimal[]{new BigDecimal(1), new BigDecimal(2)});
        assertNotNull(stub.retArrayDecimal1D(input));
    }

    /**
     * Auto generated test method
     */
    public void testretStructSNSA() throws java.lang.Exception {

        assertNull(stub.retStructSNSA(null));
        assertNotNull(stub.retStructSNSA(new Employee()));
        Employee input = new Employee();
        input.setJobID(34);
        input.setBaseDetails(new Person());
        input.setNumbers(new ArrayOfshort());
        input.setHireDate(Calendar.getInstance());
        assertNotNull(stub.retStructSNSA(input));
    }

    /**
     * Auto generated test method
     */
    public void testretArrayAnyType1D() throws java.lang.Exception {

        assertNull(stub.retArrayAnyType1D(null));
        assertNotNull(stub.retArrayAnyType1D(new ArrayOfanyType()));

        ArrayOfanyType input = new ArrayOfanyType();

        OMFactory factory = OMAbstractFactory.getOMFactory();
        // lets create the namespace object of the Article element
        OMNamespace ns = factory.createOMNamespace("http://www.serverside.com/articles/introducingAxiom", "article");
        // now create the Article element with the above namespace
        OMElement articleElement = factory.createOMElement("Article", ns);

        input.setAnyType(new OMElement[]{articleElement});
        assertNotNull(stub.retArrayAnyType1D(input));
    }

    /**
     * Auto generated test method
     */
    public void testretDerivedClass2() throws java.lang.Exception {

        assertNull(stub.retDerivedClass2(null));
        assertNotNull(stub.retDerivedClass2(new Table()));

        Table input = new Table();
        input.setSeatingCapacity(50);
        input.setColor("sdfsd");
        input.setPrice(45);
        assertNotNull(stub.retDerivedClass2(input));
    }

    /**
     * Auto generated test method
     */
    public void testretStructSN() throws java.lang.Exception {

        assertNull(stub.retStructSN(null));
        assertNotNull(stub.retStructSN(new Person()));

        Person input = new Person();
        input.setAge(23);
        input.setID(345);
        input.setMale(false);
        input.setName("Why?");
        assertNotNull(stub.retStructSN(input));
    }

    /**
     * Auto generated test method
     */
    public void testretArray1DSN() throws java.lang.Exception {

        assertNull(stub.retArray1DSN(null));
        assertNotNull(stub.retArray1DSN(new ArrayOfPerson()));

        ArrayOfPerson input = new ArrayOfPerson();
        Person p1 = new Person();
        p1.setAge(34);
        p1.setID(2345);
        p1.setMale(true);
        p1.setName("HJHJH");
        input.setPerson(new Person[]{p1});
        assertNotNull(stub.retArray1DSN(input));
    }

    /**
     * Auto generated test method
     */
    public void testretDerivedClass() throws java.lang.Exception {


        assertNull(stub.retDerivedClass(null));
        assertNotNull(stub.retDerivedClass(new Furniture()));

        Furniture input = new Furniture();
        input.setColor("white");
        input.setPrice(67);
        assertNotNull(stub.retDerivedClass(input));
        assertTrue(input instanceof Furniture);

        input = new Table();
        input.setColor("black");
        input.setPrice(89);
        ((Table) input).setSeatingCapacity(100);
        assertTrue(input instanceof Table);
    }

// TODO: We need to figure out how to deal with ENUM's. Please don't remove this section.    
//    /**
//     * Auto generated test method
//     */
    public void testretEnumInt() throws java.lang.Exception {


        assertNull(stub.retEnumInt(null));
        String input = "";
        assertNotNull(stub.retEnumInt(new String()));
    }

// TODO: We need to figure out how to deal with ENUM's. Please don't remove this section.
//    /**
//     * Auto generated test method
//     */
//    public void testretEnumString() throws java.lang.Exception {
//
//        org.tempuri.complex.xsd.ComplexDataTypesComplexDataTypesSOAP11Port_httpStub stub =
//                new org.tempuri.complex.xsd.ComplexDataTypesComplexDataTypesSOAP11Port_httpStub();
//

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?