Search in sources :

Example 1 with FixedArray

use of org.apache.type_test.types1.FixedArray in project cxf by apache.

the class AbstractTypeTestClient5 method testMixedArray.

@Test
public void testMixedArray() throws Exception {
    if (!shouldRunTest("MixedArray")) {
        return;
    }
    MixedArray x = new MixedArray();
    x.getArray1().addAll(Arrays.asList("AAA", "BBB", "CCC"));
    x.setArray2(new UnboundedArray());
    x.getArray2().getItem().addAll(Arrays.asList("aaa", "bbb", "ccc"));
    x.getArray3().addAll(Arrays.asList("DDD", "EEE", "FFF"));
    x.setArray4(new FixedArray());
    x.getArray4().getItem().addAll(Arrays.asList(1, 2, 3));
    x.getArray5().addAll(Arrays.asList("GGG", "HHH", "III"));
    x.setArray6(new MixedArray.Array6());
    x.getArray6().getItem().addAll(Arrays.asList("ggg", "hhh", "iii"));
    x.getArray7().addAll(Arrays.asList("JJJ", "KKK", "LLL"));
    x.setArray8(new MixedArray.Array8());
    x.getArray8().getItem().addAll(Arrays.asList(4, 5, 6));
    Array9 array91 = new MixedArray.Array9();
    Array9 array92 = new MixedArray.Array9();
    Array9 array93 = new MixedArray.Array9();
    array91.setItem("MMM");
    array92.setItem("NNN");
    array93.setItem("OOO");
    x.getArray9().addAll(Arrays.asList(array91, array92, array93));
    Array10 array101 = new MixedArray.Array10();
    Array10 array102 = new MixedArray.Array10();
    Array10 array103 = new MixedArray.Array10();
    array101.setItem("PPP");
    array102.setItem("QQQ");
    array103.setItem("RRR");
    x.getArray10().addAll(Arrays.asList(array101, array102, array103));
    x.getArray11().addAll(Arrays.asList("AAA", "BBB", "CCC"));
    MixedArray yOrig = new MixedArray();
    yOrig.getArray1().addAll(Arrays.asList("XXX", "YYY", "ZZZ"));
    yOrig.setArray2(new UnboundedArray());
    yOrig.getArray2().getItem().addAll(Arrays.asList("xxx", "yyy", "zzz"));
    yOrig.getArray3().addAll(Arrays.asList("DDD", "EEE", "FFF"));
    yOrig.setArray4(new FixedArray());
    yOrig.getArray4().getItem().addAll(Arrays.asList(1, 2, 3));
    yOrig.getArray5().addAll(Arrays.asList("GGG", "HHH", "III"));
    yOrig.setArray6(new MixedArray.Array6());
    yOrig.getArray6().getItem().addAll(Arrays.asList("ggg", "hhh", "iii"));
    yOrig.getArray7().addAll(Arrays.asList("JJJ", "KKK", "LLL"));
    yOrig.setArray8(new MixedArray.Array8());
    yOrig.getArray8().getItem().addAll(Arrays.asList(4, 5, 6));
    array91 = new MixedArray.Array9();
    array92 = new MixedArray.Array9();
    array93 = new MixedArray.Array9();
    array91.setItem("MMM");
    array92.setItem("NNN");
    array93.setItem("OOO");
    yOrig.getArray9().addAll(Arrays.asList(array91, array92, array93));
    array101 = new MixedArray.Array10();
    array102 = new MixedArray.Array10();
    array103 = new MixedArray.Array10();
    array101.setItem("PPP");
    array102.setItem("QQQ");
    array103.setItem("RRR");
    yOrig.getArray10().addAll(Arrays.asList(array101, array102, array103));
    yOrig.getArray11().addAll(Arrays.asList("XXX", "YYY", "ZZZ"));
    Holder<MixedArray> y = new Holder<MixedArray>(yOrig);
    Holder<MixedArray> z = new Holder<MixedArray>();
    MixedArray ret;
    if (testDocLiteral) {
        ret = docClient.testMixedArray(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testMixedArray(x, y, z);
    } else {
        ret = rpcClient.testMixedArray(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testMixedArray(): Incorrect value for inout param", equals(x, y.value));
        assertTrue("testMixedArray(): Incorrect value for out param", equals(yOrig, z.value));
        assertTrue("testMixedArray(): Incorrect return value", equals(x, ret));
    }
    // checkstyle complained otherwise...
    assertEmptyCollectionsHandled(x, yOrig);
}
Also used : FixedArray(org.apache.type_test.types1.FixedArray) Array10(org.apache.type_test.types1.MixedArray.Array10) Array9(org.apache.type_test.types1.MixedArray.Array9) MixedArray(org.apache.type_test.types1.MixedArray) Holder(javax.xml.ws.Holder) UnboundedArray(org.apache.type_test.types1.UnboundedArray) Array10(org.apache.type_test.types1.MixedArray.Array10) Array9(org.apache.type_test.types1.MixedArray.Array9) Test(org.junit.Test)

Example 2 with FixedArray

use of org.apache.type_test.types1.FixedArray in project cxf by apache.

the class SOAPDocLitClientTypeTest method testValidationFailureOnServerOut.

@Test
public void testValidationFailureOnServerOut() throws Exception {
    FixedArray x = new FixedArray();
    FixedArray yOrig = new FixedArray();
    x.getItem().addAll(Arrays.asList(24, 42, 2008));
    yOrig.getItem().addAll(Arrays.asList(24, 0, 1));
    Holder<FixedArray> y = new Holder<FixedArray>(yOrig);
    Holder<FixedArray> z = new Holder<FixedArray>();
    try {
        docClient.testFixedArray(x, y, z);
        fail("should have thrown exception");
    } catch (SOAPFaultException ex) {
        assertTrue(ex.getMessage(), ex.getMessage().contains("Marshalling"));
    }
}
Also used : FixedArray(org.apache.type_test.types1.FixedArray) Holder(javax.xml.ws.Holder) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) Test(org.junit.Test)

Example 3 with FixedArray

use of org.apache.type_test.types1.FixedArray in project cxf by apache.

the class AbstractTypeTestClient2 method testFixedArray.

// org.apache.type_test.types1.FixedArray
@Test
public void testFixedArray() throws Exception {
    if (!shouldRunTest("FixedArray")) {
        return;
    }
    FixedArray x = new FixedArray();
    x.getItem().addAll(Arrays.asList(Integer.MIN_VALUE, 0, Integer.MAX_VALUE));
    FixedArray yOrig = new FixedArray();
    yOrig.getItem().addAll(Arrays.asList(-1, 0, 1));
    Holder<FixedArray> y = new Holder<FixedArray>(yOrig);
    Holder<FixedArray> z = new Holder<FixedArray>();
    FixedArray ret;
    if (testDocLiteral) {
        ret = docClient.testFixedArray(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testFixedArray(x, y, z);
    } else {
        ret = rpcClient.testFixedArray(x, y, z);
    }
    if (!perfTestOnly) {
        for (int i = 0; i < 3; i++) {
            assertEquals("testFixedArray(): Incorrect value for inout param", x.getItem().get(i), y.value.getItem().get(i));
            assertEquals("testFixedArray(): Incorrect value for out param", yOrig.getItem().get(i), z.value.getItem().get(i));
            assertEquals("testFixedArray(): Incorrect return value", x.getItem().get(i), ret.getItem().get(i));
        }
    }
}
Also used : FixedArray(org.apache.type_test.types1.FixedArray) Holder(javax.xml.ws.Holder) Test(org.junit.Test)

Aggregations

Holder (javax.xml.ws.Holder)3 FixedArray (org.apache.type_test.types1.FixedArray)3 Test (org.junit.Test)3 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)1 MixedArray (org.apache.type_test.types1.MixedArray)1 Array10 (org.apache.type_test.types1.MixedArray.Array10)1 Array9 (org.apache.type_test.types1.MixedArray.Array9)1 UnboundedArray (org.apache.type_test.types1.UnboundedArray)1