<?xml version="1.0" encoding="UTF-8"?>
<!--

    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

    Copyright (c) 1997-2017 Oracle and/or its affiliates. All rights reserved.

    The contents of this file are subject to the terms of either the GNU
    General Public License Version 2 only ("GPL") or the Common Development
    and Distribution License("CDDL") (collectively, the "License").  You
    may not use this file except in compliance with the License.  You can
    obtain a copy of the License at
    https://oss.oracle.com/licenses/CDDL+GPL-1.1
    or LICENSE.txt.  See the License for the specific
    language governing permissions and limitations under the License.

    When distributing the software, include this License Header Notice in each
    file and include the License file at LICENSE.txt.

    GPL Classpath Exception:
    Oracle designates this particular file as subject to the "Classpath"
    exception as provided by Oracle in the GPL Version 2 section of the License
    file that accompanied this code.

    Modifications:
    If applicable, add the following below the License Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyright [year] [name of copyright owner]"

    Contributor(s):
    If you wish your version of this file to be governed by only the CDDL or
    only the GPL Version 2, indicate your decision by adding "[Contributor]
    elects to include this software in this distribution under the [CDDL or GPL
    Version 2] license."  If you don't indicate a single choice of license, a
    recipient has the option to distribute your version of this file under
    either the CDDL, the GPL Version 2 or to extend the choice of license to
    its licensees as provided above.  However, if you add GPL Version 2 code
    and therefore, elected the GPL Version 2 license, then the option applies
    only if the new code is made subject to such option by the copyright
    holder.

-->

<descriptor since="2.0">
  <description>nosei_apt</description>

  <client name="nosei_apt_testSimple" sideEffectFree="true">
  <description>testSimple</description>
  <![CDATA[
        Bar bar = new Bar();
        bar.setAge(33);
        Holder strHolder = new Holder();
        strHolder.value = "fred";

        assertEquals("test", echoPort.echoString("test"));
        assertEquals("Mary & Paul", echoPort.echoString("Mary & Paul"));
        assertEquals(bar.getAge(), echoPort.echoBar(bar).getAge());
        assertEquals(33L, echoPort.echoLong(33L));
  ]]></client>

  <client name="nosei_apt_testExceptions" sideEffectFree="true">
  <description>testExceptions</description>
  <![CDATA[
        try {
            echoPort.echoString("Exception1");
            fail();
        } catch (Exception1_Exception e){
            Exception1 ex = e.getFaultInfo();
            assertEquals("my exception1", ex.getFaultString());
            assertTrue(ex.isValid());
            assertEquals("my exception1 Message", ex.getMessage());
        }
  ]]></client>


  <client name="nosei_apt_testFault1" sideEffectFree="true">
  <description>Fault1</description>
  <![CDATA[
        try {
            echoPort.echoString("Fault1");
            fail();
         } catch (Fault1 e) {
            FooException ex = e.getFaultInfo();
            assertEquals("fault1", e.getMessage());
            assertEquals(44F, ex.getVarFloat());
            assertEquals(33, ex.getVarInt());
            assertEquals("foo", ex.getVarString());
        }
  ]]></client>

  <client name="nosei_apt_testWSDLBarException" sideEffectFree="true">
  <description>WSDLBarException</description>
  <![CDATA[
        try {
            echoPort.echoString("WSDLBarException");
            fail();
        } catch (WSDLBarException e){
            Bar ex = e.getFaultInfo();
            assertEquals("my barException", e.getMessage());
            assertEquals(33, ex.getAge());
        }
  ]]></client>

  <client name="nosei_apt_testFault2" sideEffectFree="true">
  <description>Fault2</description>
  <![CDATA[
        try {
            echoPort.echoString("Fault2");
            fail();
        } catch (Fault2_Exception e){
            assertEquals("my fault2", e.getMessage());
            Fault2 fault2 = e.getFaultInfo();
            assertEquals(33, fault2.getAge());
        }
  ]]></client>

  <client name="nosei_apt_testInterrupted" sideEffectFree="true">
  <description>Interrupted</description>
  <![CDATA[
        try {
            echoPort.echoString("Interrupted");
            fail();
        } catch (InterruptedException_Exception e){
            assertEquals("bummer", e.getMessage());
            fromjava.nosei_apt.client.InterruptedException ie = e.getFaultInfo();
            assertEquals("bummer", ie.getMessage());
        }
  ]]></client>

  <client name="nosei_apt_testHolder" sideEffectFree="true">
  <description>testHolder</description>
  <![CDATA[
        Holder strHolder = new Holder();
        strHolder.value = "fred";

        assertEquals("tmp", echoPort.outString("tmp", 44, strHolder));
        assertEquals("tmp44", strHolder.value);
        strHolder.value = "fred";

        assertEquals("tmp", echoPort.inOutString("tmp", strHolder, 44));
        assertEquals("fredfred", strHolder.value);

        Holder longHolder = new Holder();
        assertEquals(33, echoPort.outLong(33, "tmp", longHolder));

        assertEquals(345L, longHolder.value);
        assertEquals(44, echoPort.inOutLong(44, longHolder, "tmp"));
        assertEquals(690L, longHolder.value);
  ]]></client>

  <client name="nosei_apt_testHeaders" sideEffectFree="true">
  <description>testHeaders</description>
  <![CDATA[
        EchoInHeader echoInHeader = new EchoInHeader();
        echoInHeader.setArg0(33);
        echoInHeader.setArg2("fred");
        EchoInHeaderResponse echoInHeaderResp = echoPort.echoInHeader(echoInHeader, 34L);
        assertEquals(34L, echoInHeaderResp.getReturn());

        EchoInOutHeader echoInOutHeader = new EchoInOutHeader();
        echoInOutHeader.setArg0(33);
        Holder longHolder = new Holder(new Long(44));
        echoInOutHeader.setArg2("fred");
        EchoInOutHeaderResponse echoInOutHeaderResp = echoPort.echoInOutHeader(echoInOutHeader, longHolder);
        assertEquals("fred88", echoInOutHeaderResp.getReturn());
        assertEquals(88L, longHolder.value);

        EchoOutHeader echoOutHeader = new EchoOutHeader();
        echoOutHeader.setArg0(33);
        longHolder = new Holder();
        echoOutHeader.setArg2("fred");
//        Holder<EchoOutHeaderResponse> echoOutHeaderResp = new Holder<EchoOutHeaderResponse>();
//        echoPort.echoOutHeader(echoOutHeader, echoOutHeaderResp, longHolder);
//        assertTrue(echoOutHeaderResp.value.getReturn().equals("fred33"));
        EchoOutHeaderResponse response = echoPort.echoOutHeader(echoOutHeader, longHolder);
        assertEquals("fred33", response.getReturn());
        assertEquals(33L, longHolder.value);

  ]]></client>

  <client name="nosei_apt_testArray1" sideEffectFree="true">
  <description>testArray1</description>
  <![CDATA[
        List strArray = new ArrayList();
        strArray.add("Mary");
        strArray.add("Paul");

        List returnArray = echoPort.echoStringArray(strArray);
        assertEquals(strArray.size(), returnArray.size());
        assertEquals(strArray.get(0), returnArray.get(0));
        assertEquals(strArray.get(1), returnArray.get(1));

  ]]></client>

  <client name="nosei_apt_testArray2" sideEffectFree="true">
  <description>testArray2</description>
  <![CDATA[
        Bar bar = new Bar();
        bar.setAge(33); 
        Bar bar2 = new Bar();
        bar2.setAge(44);
        List barArray = new ArrayList();
        barArray.add(bar);
        barArray.add(bar2);
        List resultArray = echoPort.echoBarArray(barArray);
        assertEquals(2, resultArray.size());
        assertEquals(bar.getAge(), ((Bar) resultArray.get(0)).getAge());
        assertEquals(bar2.getAge(), ((Bar) resultArray.get(1)).getAge());
  ]]></client>

  <client name="nosei_apt_testOneway" >
  <description>testOneway</description>
  <![CDATA[
        echoPort.oneway();
        Thread.sleep(1000);   // so that oneway method is invoked on endpoint
        assertTrue(echoPort.verifyOneway());
  ]]></client>

  <client name="nosei_apt_testVoid" sideEffectFree="true">
  <description>testVoid</description>
  <![CDATA[
        echoPort.voidTest();
  ]]></client>

  <client name="nosei_apt_testOverloaded" sideEffectFree="true">
  <description>testOverloaded</description>
  <![CDATA[
        assertEquals("fred", echoPort.overloadedOperation("fred"));
        Req req = new Req();
        req.setArg0("earnie");
        req.setArg1(" & bert");
        assertEquals("earnie & bert", echoPort.overloadedOperation2(req).getReturn());
        assertEquals("huey, duey and luey", echoPort.overloadedOperation3("huey", ", duey", " and luey"));
        assertEquals("1 2 3 4", echoPort.overloadedOperation4("1", "2", "3", "4"));
  ]]></client>

  <client name="nosei_apt_testHeader" sideEffectFree="true">
  <description>testHeader</description>
  <![CDATA[
        Holder intHolder = new Holder();
        EchoIntHeaderResult result = new EchoIntHeaderResult();
        result.setArg0(33);
        Holder respHolder = new Holder();
        echoPort.echoIntHeaderResult(result, respHolder, intHolder);
        assertEquals(66, intHolder.value);
  ]]></client>

  <service basedir="./server">
  </service>

</descriptor>
