axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Created: (AXIS-2841) ADBXMLStreamReaderTest.java has faulty test for testComplexObjectArrayScenarioWithNulls
Date Thu, 03 Mar 2011 20:55:37 GMT
ADBXMLStreamReaderTest.java has faulty test for testComplexObjectArrayScenarioWithNulls
---------------------------------------------------------------------------------------

                 Key: AXIS-2841
                 URL: https://issues.apache.org/jira/browse/AXIS-2841
             Project: Axis
          Issue Type: Bug
          Components: Basic Architecture
    Affects Versions: 1.3
         Environment: cd /modules/ADB 
mvn -e -X package 
and watch the fireworks

            Reporter: Martin Gainty
            Priority: Minor
             Fix For: 1.3


    /** complex array scenario with nulls in between */
    public void testComplexObjectArrayScenarioWithNulls()
    {
        System.out.println("*************************testComplexObjectArrayScenarioWithNulls**************************");
        try
        {
            String expectedXML =
                    "<ns1:TestComplexStringArrayScenario xmlns:ns1=\"http://testComplexStringArrayScenario.org\">"
+
                            "<AdditionalDependent>" +
                            	"<Name>FooTwo</Name>" +
                            	"<Age>25</Age>" +
                            	"<Sex>Male</Sex>" +
                            "</AdditionalDependent>" +
                            "<AdditionalDependent>" +
                            	"<Name>FooTwo</Name>" +
                            	"<Age>25</Age>" +
                            	"<Sex>Male</Sex>" +
                            "</AdditionalDependent>" +
                            "<AdditionalDependent>" +
                            	"<Name>FooTwo</Name>" +
                            	"<Age>25</Age>" +
                            	"<Sex>Male</Sex>" +
                            "</AdditionalDependent>" +
                            "<AdditionalDependent xsi:nil=\"true\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+
                            "</AdditionalDependent>" +
                            "<Bar>Some More Text</Bar>" +
                            "</ns1:TestComplexStringArrayScenario>";

			System.out.println("testComplexObjectArrayScenarioWithNulls expectedXML="+expectedXML);
            ArrayList propertyList = new ArrayList();

			System.out.println("before ADBBean[] adbBeans = new ADBBean[4]");
            ADBBean[] adbBeans = new ADBBean[4];
            System.out.println("adbBeans="+adbBeans);

            for (int i = 0; i < 4; i++)
            {
				System.out.println("before adbBeans[i] = new DummyADBBean()");
                adbBeans[i] = new DummyADBBean();
                System.out.println("adbBeans[i]="+adbBeans[i]);
            }

            adbBeans[3] = null;

			System.out.println("before for (int i = 0; i < adbBeans.length; i++) ");
            for (int i = 0; i < adbBeans.length; i++)
            {
				QName qname1=new QName("AdditionalDependent");
				System.out.println("before propertyList.add(new QName(AdditionalDependent where qname1="+qname1);
//!!!!!!!!!!!!!!This is the change to add the adbBean to propertyList!!!!!!!!!!!!
                propertyList.add(qname1);
                System.out.println("propertyList after add of qname1="+propertyList);
                propertyList.add(adbBeans[i]);
                System.out.println("propertyList after add of adbBeans[i]="+adbBeans[i]);
            }
            propertyList.add("Bar");
            System.out.println("propertyList after add(Bar)="+propertyList);
            propertyList.add("Some More Text");
            System.out.println("propertyList after add(Some More Text)="+propertyList);
	    QName qname1=new QName("http://testComplexStringArrayScenario.org", "TestComplexStringArrayScenario","ns1");
			System.out.println("qname1="+qname1);
			Object[] objects=propertyList.toArray();
			System.out.println("objects="+objects);
	    System.out.println("before XMLStreamReader pullParser = new ADBXMLStreamReaderImpl(new
QName(");
            XMLStreamReader pullParser = new ADBXMLStreamReaderImpl(
				qname1,
				objects, null);
	  System.out.println("before 		String actualXML = getStringXML(pullParser) where pullParser="+pullParser);
            String actualXML = getStringXML(pullParser);

	System.out.println("testComplexObjectArrayScenarioWithNulls before assertXMLEqual(newDocument(expectedXML),
newDocument(actualXML)) expectedXML="+expectedXML);
	System.out.println(" actualXML="+actualXML);
        assertXMLEqual(newDocument(expectedXML), newDocument(actualXML));
        }
        catch (ParserConfigurationException e)
        {
            System.out.println("ParserConfigurationException Error has occurred " + e.getMessage());
        }
        catch (SAXException e)
        {
            System.out.println("SAXException Error has occurred " + e.getMessage());
        }
        catch (IOException e)
        {
            System.out.println("IOException Error has occurred " + e.getMessage());
        }
        catch (Exception e)
        {
            System.out.println("Exception Error has occurred " + e);
        }
    }

//this is the output 
*************************testComplexObjectArrayScenarioWithNulls**************************
testComplexObjectArrayScenarioWithNulls expectedXML=<ns1:TestComplexStringArrayScenario
xmlns:ns1="http://testComplexStringArrayScenario.org"><AdditionalDependent><Name>FooTwo</Name><Age>25</Age><Sex>Male</Sex></AdditionalDependent><AdditionalDependent><Name>FooTwo</Name><Age>25</Age><Sex>Male</Sex></AdditionalDependent><AdditionalDependent><Name>FooTwo</Name><Age>25</Age><Sex>Male</Sex></AdditionalDependent><AdditionalDependent
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></AdditionalDependent><Bar>Some
More Text</Bar></ns1:TestComplexStringArrayScenario>

before ADBBean[] adbBeans = new ADBBean[4]
adbBeans=[Lorg.apache.axis2.databinding.ADBBean;@1125127

before adbBeans[i] = new DummyADBBean()
adbBeans[i]=org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@15e83f9

before adbBeans[i] = new DummyADBBean()
adbBeans[i]=org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@2a5330

before adbBeans[i] = new DummyADBBean()
adbBeans[i]=org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@bb7465

before adbBeans[i] = new DummyADBBean()
adbBeans[i]=org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@d6c16c

before for (int i = 0; i < adbBeans.length; i++) 

before propertyList.add(new QName(AdditionalDependent where qname1=AdditionalDependent

propertyList after add of qname1=[AdditionalDependent]

propertyList after add of adbBeans[i]=org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@15e83f9

before propertyList.add(new QName(AdditionalDependent where qname1=AdditionalDependent

propertyList after add of qname1=[AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@15e83f9,
AdditionalDependent]

propertyList after add of adbBeans[i]=org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@2a5330

before propertyList.add(new QName(AdditionalDependent where qname1=AdditionalDependent

propertyList after add of qname1=[AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@15e83f9,
AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@2a5330,
AdditionalDependent]

propertyList after add of adbBeans[i]=org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@bb7465

before propertyList.add(new QName(AdditionalDependent where qname1=AdditionalDependent
propertyList after add of qname1=[AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@15e83f9,
AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@2a5330,
AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@bb7465,
AdditionalDependent]

propertyList after add of adbBeans[i]=null

propertyList after add(Bar)=[AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@15e83f9,
AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@2a5330,
AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@bb7465,
AdditionalDependent, null, Bar]

propertyList after add(Some More Text)=[AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@15e83f9,
AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@2a5330,
AdditionalDependent, org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderTest$DummyADBBean@bb7465,
AdditionalDependent, null, Bar, Some More Text]

qname1={http://testComplexStringArrayScenario.org}TestComplexStringArrayScenario

objects=[Ljava.lang.Object;@134bed0

before XMLStreamReader pullParser = new ADBXMLStreamReaderImpl(new QName(

before 		String actualXML = getStringXML(pullParser) where 
pullParser=org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl@1db4f6f
testComplexObjectArrayScenarioWithNulls before assertXMLEqual(newDocument(expectedXML), newDocument(actualXML))


expectedXML=<ns1:TestComplexStringArrayScenario xmlns:ns1="http://testComplexStringArrayScenario.org"><AdditionalDependent><Name>FooTwo</Name><Age>25</Age><Sex>Male</Sex></AdditionalDependent><AdditionalDependent><Name>FooTwo</Name><Age>25</Age><Sex>Male</Sex></AdditionalDependent><AdditionalDependent><Name>FooTwo</Name><Age>25</Age><Sex>Male</Sex></AdditionalDependent><AdditionalDependent
xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></AdditionalDependent><Bar>Some
More Text</Bar></ns1:TestComplexStringArrayScenario>

  actualXML=<ns1:TestComplexStringArrayScenario xmlns:ns1="http://testComplexStringArrayScenario.org"><AdditionalDependent><Name>FooTwo</Name><Age>25</Age><Sex>Male</Sex></AdditionalDependent><AdditionalDependent><Name>FooTwo</Name><Age>25</Age><Sex>Male</Sex></AdditionalDependent><AdditionalDependent><Name>FooTwo</Name><Age>25</Age><Sex>Male</Sex></AdditionalDependent><AdditionalDependent
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>                
    <Bar>Some More Text</Bar></ns1:TestComplexStringArrayScenario>

notice that once the propertyList.add(adbBeans[i]) for each qname of AdditionalDependent the
actualXML=expectedXML and the assert 
assertXMLEqual(newDocument(expectedXML), newDocument(actualXML));
returns true

this needs to be corrected for ALL of the testCases in ADBXMLStreamReaderTest.java

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message