Search in sources :

Example 91 with Holder

use of javax.xml.ws.Holder in project cxf by apache.

the class ClientServerMiscTest method runDocLitTest.

private void runDocLitTest(DocLitWrappedCodeFirstService port) throws Exception {
    assertEquals("snarf", port.doBug2692("snarf"));
    CXF2411Result<CXF2411SubClass> o = port.doCXF2411();
    assertNotNull(o);
    assertNotNull(o.getContent());
    Object[] ar = o.getContent();
    assertTrue(ar[0] instanceof CXF2411SubClass);
    Foo foo = new Foo();
    foo.setName("blah");
    assertEquals("blah", port.modifyFoo(foo).getName());
    assertEquals("hello", port.outOnly(new Holder<String>(), new Holder<String>()));
    long start = System.currentTimeMillis();
    port.doOneWay();
    assertTrue((System.currentTimeMillis() - start) < 500);
    assertEquals("Hello", port.echoStringNotReallyAsync("Hello"));
    Set<Foo> fooSet = port.getFooSet();
    assertEquals(2, fooSet.size());
    assertEquals("size: 2", port.doFooList(new ArrayList<>(fooSet)));
    assertEquals(24, port.echoIntDifferentWrapperName(24));
    String echoMsg = port.echo("Hello");
    assertEquals("Hello", echoMsg);
    List<String> rev = new ArrayList<>(Arrays.asList(DocLitWrappedCodeFirstServiceImpl.DATA));
    Collections.reverse(rev);
    String s;
    String[] arrayOut = port.arrayOutput();
    assertNotNull(arrayOut);
    assertEquals(3, arrayOut.length);
    for (int x = 0; x < 3; x++) {
        assertEquals(DocLitWrappedCodeFirstServiceImpl.DATA[x], arrayOut[x]);
    }
    List<String> listOut = port.listOutput();
    assertNotNull(listOut);
    assertEquals(3, listOut.size());
    for (int x = 0; x < 3; x++) {
        assertEquals(DocLitWrappedCodeFirstServiceImpl.DATA[x], listOut.get(x));
    }
    s = port.arrayInput(DocLitWrappedCodeFirstServiceImpl.DATA);
    assertEquals("string1string2string3", s);
    s = port.listInput(java.util.Arrays.asList(DocLitWrappedCodeFirstServiceImpl.DATA));
    assertEquals("string1string2string3", s);
    s = port.multiListInput(Arrays.asList(DocLitWrappedCodeFirstServiceImpl.DATA), rev, "Hello", 24);
    assertEquals("string1string2string3string3string2string1Hello24", s);
    s = port.listInput(new ArrayList<>());
    assertEquals("", s);
    s = port.listInput(null);
    assertEquals("", s);
    s = port.multiListInput(Arrays.asList(DocLitWrappedCodeFirstServiceImpl.DATA), rev, null, 24);
    assertEquals("string1string2string3string3string2string1<null>24", s);
    Holder<String> a = new Holder<String>();
    Holder<String> b = new Holder<String>("Hello");
    Holder<String> c = new Holder<String>();
    Holder<String> d = new Holder<String>(" ");
    Holder<String> e = new Holder<String>("world!");
    Holder<String> f = new Holder<String>();
    Holder<String> g = new Holder<String>();
    s = port.multiInOut(a, b, c, d, e, f, g);
    assertEquals("Hello world!", s);
    assertEquals("a", a.value);
    assertEquals("b", b.value);
    assertEquals("c", c.value);
    assertEquals("d", d.value);
    assertEquals("e", e.value);
    assertEquals("f", f.value);
    assertEquals("g", g.value);
    List<Foo> foos = port.listObjectOutput();
    assertEquals(2, foos.size());
    assertEquals("a", foos.get(0).getName());
    assertEquals("b", foos.get(1).getName());
    List<Foo[]> foos2 = port.listObjectArrayOutput();
    assertNotNull(foos2);
    assertEquals(2, foos2.size());
    assertEquals(2, foos2.get(0).length);
    assertEquals(2, foos2.get(1).length);
    int[] ints = port.echoIntArray(new int[] { 1, 2, 3 }, null);
    assertEquals(3, ints.length);
    assertEquals(1, ints[0]);
    if (new ASMHelper().createClassWriter() != null) {
        // doing the type adapter things and such really
        // requires the ASM generated helper classes
        assertEquals("Val", port.createBar("Val").getName());
    }
    testExceptionCases(port);
}
Also used : Foo(org.apache.cxf.systest.jaxws.DocLitWrappedCodeFirstService.Foo) OrderedParamHolder(org.apache.cxf.ordered_param_holder.OrderedParamHolder) Holder(javax.xml.ws.Holder) ArrayList(java.util.ArrayList) ASMHelper(org.apache.cxf.common.util.ASMHelper) CXF2411SubClass(org.apache.cxf.systest.jaxws.DocLitWrappedCodeFirstService.CXF2411SubClass)

Example 92 with Holder

use of javax.xml.ws.Holder in project cxf by apache.

the class ClientServerMiscTest method testOrderedParamHolder.

@Test
public void testOrderedParamHolder() throws Exception {
    OrderedParamHolder_Service service = new OrderedParamHolder_Service();
    OrderedParamHolder port = service.getOrderedParamHolderSOAP();
    updateAddressPort(port, PORT);
    try {
        Holder<ComplexStruct> part3 = new Holder<ComplexStruct>();
        part3.value = new ComplexStruct();
        part3.value.setElem1("elem1");
        part3.value.setElem2("elem2");
        part3.value.setElem3(0);
        Holder<Integer> part2 = new Holder<Integer>();
        part2.value = 0;
        Holder<String> part1 = new Holder<String>();
        part1.value = "part1";
        port.orderedParamHolder(part3, part2, part1);
        assertNotNull(part3.value);
        assertEquals("check value", "return elem1", part3.value.getElem1());
        assertEquals("check value", "return elem2", part3.value.getElem2());
        assertEquals("check value", 1, part3.value.getElem3());
        assertNotNull(part2.value);
        assertEquals("check value", 1, part2.value.intValue());
        assertNotNull(part1.value);
        assertEquals("check value", "return part1", part1.value);
    } catch (UndeclaredThrowableException ex) {
        throw (Exception) ex.getCause();
    }
}
Also used : BigInteger(java.math.BigInteger) OrderedParamHolder_Service(org.apache.cxf.ordered_param_holder.OrderedParamHolder_Service) OrderedParamHolder(org.apache.cxf.ordered_param_holder.OrderedParamHolder) OrderedParamHolder(org.apache.cxf.ordered_param_holder.OrderedParamHolder) Holder(javax.xml.ws.Holder) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) ComplexStruct(org.apache.cxf.ordered_param_holder.ComplexStruct) JaxbElementTest(org.apache.cxf.jaxb_element_test.JaxbElementTest) Test(org.junit.Test)

Example 93 with Holder

use of javax.xml.ws.Holder in project cxf by apache.

the class ClientServerXMLTest method verifyOutHeader.

public void verifyOutHeader(HeaderTester proxy) throws Exception {
    OutHeader me = new OutHeader();
    me.setRequestType("OutHeaderRequest");
    Holder<OutHeaderResponse> outHeaderHolder = new Holder<OutHeaderResponse>();
    Holder<SOAPHeaderData> soapHeaderHolder = new Holder<SOAPHeaderData>();
    proxy.outHeader(me, outHeaderHolder, soapHeaderHolder);
    assertNotNull(outHeaderHolder.value);
    assertNotNull(soapHeaderHolder.value);
    assertEquals("check out value", "requestType=OutHeaderRequest", outHeaderHolder.value.getResponseType());
    assertEquals("check out value", "message=outMessage", soapHeaderHolder.value.getMessage());
    assertEquals("check out value", "orginator=outOriginator", soapHeaderHolder.value.getOriginator());
}
Also used : SOAPHeaderData(org.apache.headers.types.SOAPHeaderData) OutHeaderResponse(org.apache.headers.types.OutHeaderResponse) Holder(javax.xml.ws.Holder) OutHeader(org.apache.headers.types.OutHeader)

Example 94 with Holder

use of javax.xml.ws.Holder in project tomee by apache.

the class CalculatorTest method outParams.

@Test
public void outParams() throws Exception {
    final Service calculatorService = Service.create(new URL("http://localhost:" + port + "/webservice-holder/Calculator?wsdl"), new QName("http://superbiz.org/wsdl", "CalculatorService"));
    assertNotNull(calculatorService);
    final CalculatorWs calculator = calculatorService.getPort(CalculatorWs.class);
    final Holder<Integer> sum = new Holder<Integer>();
    final Holder<Integer> multiply = new Holder<Integer>();
    calculator.sumAndMultiply(4, 6, sum, multiply);
    assertEquals(10, (int) sum.value);
    assertEquals(24, (int) multiply.value);
}
Also used : QName(javax.xml.namespace.QName) Holder(javax.xml.ws.Holder) Service(javax.xml.ws.Service) URL(java.net.URL) Test(org.junit.Test)

Example 95 with Holder

use of javax.xml.ws.Holder in project cxf by apache.

the class AbstractHeaderServiceDocLitTest method verifyInOutHeaderParts.

protected void verifyInOutHeaderParts(HeaderTester ht) {
    getLogger().debug("Client: calling inoutHeader");
    InoutHeaderT inoutHeader = new InoutHeaderT();
    inoutHeader.setRequestType(HeaderTesterUtil.INOUT_REQUEST_TYPE_IN);
    HeaderInfo headerInfo = new HeaderInfo();
    headerInfo.setMessage(HeaderTesterUtil.INOUT_MESSAGE_IN);
    headerInfo.setOriginator(HeaderTesterUtil.INOUT_ORIGINATOR_IN);
    Holder<HeaderInfo> holder = new Holder<HeaderInfo>();
    holder.value = headerInfo;
    InoutHeaderResponseT inoutHeaderResponse = ht.inoutHeader(inoutHeader, holder);
    assertEquals(HeaderTesterUtil.INOUT_REQUEST_TYPE_OUT, inoutHeaderResponse.getResponseType());
    assertNotSame(HeaderTesterUtil.INOUT_REQUEST_TYPE_OUT, inoutHeader.getRequestType());
    assertEquals(HeaderTesterUtil.INOUT_MESSAGE_OUT, holder.value.getMessage());
    assertEquals(HeaderTesterUtil.INOUT_ORIGINATOR_OUT, holder.value.getOriginator());
}
Also used : HeaderInfo(org.apache.headers.coloc.types.HeaderInfo) Holder(javax.xml.ws.Holder) InoutHeaderResponseT(org.apache.headers.coloc.types.InoutHeaderResponseT) InoutHeaderT(org.apache.headers.coloc.types.InoutHeaderT)

Aggregations

Holder (javax.xml.ws.Holder)328 Test (org.junit.Test)204 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)77 Test (org.testng.annotations.Test)53 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)48 BigInteger (java.math.BigInteger)44 SelectorQualifiedGetOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.SelectorQualifiedGetOptionsType)33 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)29 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)29 QName (javax.xml.namespace.QName)29 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)24 ObjectListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectListType)23 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)23 URL (java.net.URL)23 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)21 LogfileTestTailer (com.evolveum.midpoint.test.util.LogfileTestTailer)21 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)21 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)19 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)16 GenericObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.GenericObjectType)15