Package org.tempuri.innerparticalextension

Examples of org.tempuri.innerparticalextension.TestElement


import java.io.ByteArrayInputStream;

public class TestInnerParticleExtension extends TestCase {

    public void testTestElement(){
        TestElement testElement = new TestElement();

        ChildElement_type0 childElement_type0[] = new ChildElement_type0[2];
        childElement_type0[0] = new ChildElement_type0();
        childElement_type0[0].setTestAttribute("Test Attribute");

        ParentTypeChoice[] parentTypeChoices = new ParentTypeChoice[2];
        parentTypeChoices[0] = new ParentTypeChoice();
        parentTypeChoices[0].setParam1("param1");
        parentTypeChoices[1] = new ParentTypeChoice();
        parentTypeChoices[1].setParam2("param2");

        childElement_type0[0].setParentTypeChoice(parentTypeChoices);

        childElement_type0[1] = new ChildElement_type0();
        childElement_type0[1].setTestAttribute("Test Attribute");

        parentTypeChoices = new ParentTypeChoice[2];
        parentTypeChoices[0] = new ParentTypeChoice();
        parentTypeChoices[0].setParam1("param1");
        parentTypeChoices[1] = new ParentTypeChoice();
        parentTypeChoices[1].setParam2("param2");

        childElement_type0[1].setParentTypeChoice(parentTypeChoices);

        testElement.setChildElement(childElement_type0);

        try {
            OMElement omElement = testElement.getOMElement(TestElement.MY_QNAME, OMAbstractFactory.getOMFactory());
            String omElementString = omElement.toStringWithConsume();
            System.out.println("OM Element string ==> " + omElementString);
            XMLStreamReader xmlReader =
                    StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
            TestElement result = TestElement.Factory.parse(xmlReader);
            assertEquals(result.getChildElement()[0].getTestAttribute(),"Test Attribute");
            assertEquals(result.getChildElement()[1].getTestAttribute(),"Test Attribute");

            assertEquals(result.getChildElement()[0].getParentTypeChoice()[0].getParam1(),"param1");
            assertEquals(result.getChildElement()[0].getParentTypeChoice()[1].getParam2(),"param2");
            assertEquals(result.getChildElement()[1].getParentTypeChoice()[0].getParam1(),"param1");
            assertEquals(result.getChildElement()[1].getParentTypeChoice()[1].getParam2(),"param2");

        } catch (ADBException e) {
            fail();
        } catch (XMLStreamException e) {
            fail();
View Full Code Here

TOP

Related Classes of org.tempuri.innerparticalextension.TestElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.