Search in sources :

Example 1 with CXF2411SubClass

use of org.apache.cxf.systest.jaxws.DocLitWrappedCodeFirstService.CXF2411SubClass 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)

Aggregations

ArrayList (java.util.ArrayList)1 Holder (javax.xml.ws.Holder)1 ASMHelper (org.apache.cxf.common.util.ASMHelper)1 OrderedParamHolder (org.apache.cxf.ordered_param_holder.OrderedParamHolder)1 CXF2411SubClass (org.apache.cxf.systest.jaxws.DocLitWrappedCodeFirstService.CXF2411SubClass)1 Foo (org.apache.cxf.systest.jaxws.DocLitWrappedCodeFirstService.Foo)1