Search in sources :

Example 1 with UnboundedArray

use of org.apache.type_test.types1.UnboundedArray 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 UnboundedArray

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

the class AbstractTypeTestClient2 method testNestedArray.

// org.apache.type_test.types1.NestedArray
@Test
public void testNestedArray() throws Exception {
    if (!shouldRunTest("NestedArray")) {
        return;
    }
    String[][] xs = { { "AAA", "BBB", "CCC" }, { "aaa", "bbb", "ccc" }, { "a_a_a", "b_b_b", "c_c_c" } };
    String[][] ys = { { "XXX", "YYY", "ZZZ" }, { "xxx", "yyy", "zzz" }, { "x_x_x", "y_y_y", "z_z_z" } };
    NestedArray x = new NestedArray();
    NestedArray yOrig = new NestedArray();
    List<UnboundedArray> xList = x.getSubarray();
    List<UnboundedArray> yList = yOrig.getSubarray();
    for (int i = 0; i < 3; i++) {
        UnboundedArray xx = new UnboundedArray();
        xx.getItem().addAll(Arrays.asList(xs[i]));
        xList.add(xx);
        UnboundedArray yy = new UnboundedArray();
        yy.getItem().addAll(Arrays.asList(ys[i]));
        yList.add(yy);
    }
    Holder<NestedArray> y = new Holder<NestedArray>(yOrig);
    Holder<NestedArray> z = new Holder<NestedArray>();
    NestedArray ret;
    if (testDocLiteral) {
        ret = docClient.testNestedArray(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testNestedArray(x, y, z);
    } else {
        ret = rpcClient.testNestedArray(x, y, z);
    }
    if (!perfTestOnly) {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                assertEquals("testNestedArray(): Incorrect value for inout param", x.getSubarray().get(i).getItem().get(j), y.value.getSubarray().get(i).getItem().get(j));
                assertEquals("testNestedArray(): Incorrect value for out param", yOrig.getSubarray().get(i).getItem().get(j), z.value.getSubarray().get(i).getItem().get(j));
                assertEquals("testNestedArray(): Incorrect return value", x.getSubarray().get(i).getItem().get(j), ret.getSubarray().get(i).getItem().get(j));
            }
        }
    }
}
Also used : NestedArray(org.apache.type_test.types1.NestedArray) Holder(javax.xml.ws.Holder) UnboundedArray(org.apache.type_test.types1.UnboundedArray) Test(org.junit.Test)

Example 3 with UnboundedArray

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

the class AbstractTypeTestClient4 method testInheritanceUnboundedArrayDerivedChoice.

@Test
public void testInheritanceUnboundedArrayDerivedChoice() throws Exception {
    if (!shouldRunTest("InheritanceUnboundedArrayDerivedChoice")) {
        return;
    }
    DerivedChoiceBaseArray x = new DerivedChoiceBaseArray();
    // Base
    x.getItem().addAll(Arrays.asList("AAA", "BBB", "CCC"));
    // Derived
    x.setVarStringExt("DerivedChoice-x");
    x.setAttrStringExt("DerivedAttr-x");
    DerivedChoiceBaseArray yOrig = new DerivedChoiceBaseArray();
    // Base
    yOrig.getItem().addAll(Arrays.asList("XXX", "YYY", "ZZZ"));
    // Derived
    yOrig.setVarFloatExt(1.414f);
    yOrig.setAttrStringExt("DerivedAttr-y");
    Holder<UnboundedArray> y = new Holder<UnboundedArray>(yOrig);
    Holder<UnboundedArray> z = new Holder<UnboundedArray>();
    UnboundedArray ret;
    if (testDocLiteral) {
        ret = docClient.testUnboundedArray(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testUnboundedArray(x, y, z);
    } else {
        ret = rpcClient.testUnboundedArray(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testInheritanceUnboundedArrayDerivedChoice(): Incorrect value for inout param", equals(x, (DerivedChoiceBaseArray) y.value));
        assertTrue("testInheritanceUnboundedArrayDerivedChoice(): Incorrect value for out param", equals(yOrig, (DerivedChoiceBaseArray) z.value));
        assertTrue("testInheritanceUnboundedArrayDerivedChoice(): Incorrect return value", equals(x, (DerivedChoiceBaseArray) ret));
    }
}
Also used : Holder(javax.xml.ws.Holder) DerivedChoiceBaseArray(org.apache.type_test.types1.DerivedChoiceBaseArray) UnboundedArray(org.apache.type_test.types1.UnboundedArray) Test(org.junit.Test)

Example 4 with UnboundedArray

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

the class AbstractTypeTestClient5 method assertEmptyCollectionsHandled.

/**
 * @param x
 * @param yOrig
 */
private void assertEmptyCollectionsHandled(MixedArray x, MixedArray yOrig) {
    Holder<MixedArray> y;
    Holder<MixedArray> z;
    MixedArray ret;
    // empty collections. may be tested only for sequences, i.e., for lists array1, array2, array5, array6,
    // array9 and array11.
    // array3, array4, array7, array8 and array10 must have 3 elements
    // empty them
    x.getArray1().clear();
    x.setArray2(new UnboundedArray());
    x.getArray5().clear();
    x.setArray6(new MixedArray.Array6());
    x.getArray9().clear();
    x.getArray11().clear();
    // empty them
    yOrig.getArray1().clear();
    yOrig.setArray2(new UnboundedArray());
    yOrig.getArray5().clear();
    yOrig.setArray6(new MixedArray.Array6());
    yOrig.getArray9().clear();
    yOrig.getArray11().clear();
    y = new Holder<MixedArray>(yOrig);
    z = new Holder<MixedArray>();
    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));
    }
}
Also used : MixedArray(org.apache.type_test.types1.MixedArray) UnboundedArray(org.apache.type_test.types1.UnboundedArray)

Example 5 with UnboundedArray

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

the class AbstractTypeTestClient2 method testUnboundedArray.

@Test
public void testUnboundedArray() throws Exception {
    if (!shouldRunTest("UnboundedArray")) {
        return;
    }
    UnboundedArray x = new UnboundedArray();
    x.getItem().addAll(Arrays.asList("AAA", "BBB", "CCC"));
    UnboundedArray yOrig = new UnboundedArray();
    yOrig.getItem().addAll(Arrays.asList("XXX", "YYY", "ZZZ"));
    Holder<UnboundedArray> y = new Holder<UnboundedArray>(yOrig);
    Holder<UnboundedArray> z = new Holder<UnboundedArray>();
    UnboundedArray ret;
    if (testDocLiteral) {
        ret = docClient.testUnboundedArray(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testUnboundedArray(x, y, z);
    } else {
        ret = rpcClient.testUnboundedArray(x, y, z);
    }
    if (!perfTestOnly) {
        for (int i = 0; i < 3; i++) {
            assertTrue("testUnboundedArray(): Incorrect value for inout param", equals(x, y.value));
            assertTrue("testUnboundedArray(): Incorrect value for out param", equals(yOrig, z.value));
            assertTrue("testUnboundedArray(): Incorrect return value", equals(x, ret));
        }
    }
}
Also used : Holder(javax.xml.ws.Holder) UnboundedArray(org.apache.type_test.types1.UnboundedArray) Test(org.junit.Test)

Aggregations

UnboundedArray (org.apache.type_test.types1.UnboundedArray)5 Holder (javax.xml.ws.Holder)4 Test (org.junit.Test)4 MixedArray (org.apache.type_test.types1.MixedArray)2 DerivedChoiceBaseArray (org.apache.type_test.types1.DerivedChoiceBaseArray)1 FixedArray (org.apache.type_test.types1.FixedArray)1 Array10 (org.apache.type_test.types1.MixedArray.Array10)1 Array9 (org.apache.type_test.types1.MixedArray.Array9)1 NestedArray (org.apache.type_test.types1.NestedArray)1