Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Invalid
-
1.3
-
None
-
None
-
cd /modules/ADB
mvn -e -X package
and watch the fireworks
Description
/** 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++)
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)
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