| author | xma | 2007-07-06 03:15:23 (EDT) |
|---|---|---|
| committer | xgu | 2007-07-06 03:15:23 (EDT) |
| commit | 0a12ba01833026ce5794af9a4551412aaedfa096 (patch) (side-by-side diff) | |
| tree | 307cae1fd4278963eaf969f8e4f1310985f6e196 | |
| parent | dc43ab7dbde4d6af565429412137b1319418b920 (diff) | |
| download | org.eclipse.datatools.enablement.oda-0a12ba01833026ce5794af9a4551412aaedfa096.zip org.eclipse.datatools.enablement.oda-0a12ba01833026ce5794af9a4551412aaedfa096.tar.gz org.eclipse.datatools.enablement.oda-0a12ba01833026ce5794af9a4551412aaedfa096.tar.bz2 | |
Fix Bugzilla Bug 192871
Incorrect Data Set from XML Data Source in BIRT
6 files changed, 83 insertions, 3 deletions
diff --git a/plugins/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF b/plugins/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF index e86793a..326f678 100644 --- a/plugins/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.datatools.enablement.oda.xml/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %plugin.name Bundle-SymbolicName: org.eclipse.datatools.enablement.oda.xml;singleton:=true -Bundle-Version: 1.0.1.200706151 +Bundle-Version: 1.0.2.200707061 Bundle-ClassPath: . Bundle-Vendor: Eclipse.org Bundle-Localization: plugin diff --git a/tests/org.eclipse.datatools.enablement.oda.xml.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.datatools.enablement.oda.xml.tests/META-INF/MANIFEST.MF index cf7ba7b..c81ec4a 100644 --- a/tests/org.eclipse.datatools.enablement.oda.xml.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.datatools.enablement.oda.xml.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: DTP ODA XML Tests Suite Bundle-SymbolicName: org.eclipse.datatools.enablement.oda.xml.tests;singleton:=true -Bundle-Version: 1.0.0.200706151 +Bundle-Version: 1.0.1.200707061 Bundle-ClassPath: . Bundle-Vendor: Eclipse.org Bundle-Localization: plugin diff --git a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test19.txt b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test19.txt new file mode 100644 index 0000000..19448ea --- a/dev/null +++ b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test19.txt @@ -0,0 +1,5 @@ +ProgramID ProgramName ActivityID ActivityName +1 Prog1 100 Act1 +1 Prog1 101 null +2 null 102 Act3 +2 null 103 Act4 diff --git a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/input/emptyElement.xml b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/input/emptyElement.xml new file mode 100644 index 0000000..90c07aa --- a/dev/null +++ b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/input/emptyElement.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" ?> +<NewDataSet> + <program> + <ProgramID>1</ProgramID> + <ProgramName>Prog1</ProgramName> + <activity> + <ActivityID>100</ActivityID> + <ActivityName>Act1</ActivityName> + </activity> + <activity> + <ActivityID>101</ActivityID> + <ActivityName/> + </activity> + </program> + + <program> + <ProgramID>2</ProgramID> + <ProgramName/> + <activity> + <ActivityID>102</ActivityID> + <ActivityName>Act3</ActivityName> + </activity> + <activity> + <ActivityID>103</ActivityID> + <ActivityName>Act4</ActivityName> + </activity> + </program> +</NewDataSet>
\ No newline at end of file diff --git a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/test/util/TestConstants.java b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/test/util/TestConstants.java index 6ce6e49..8b378be 100644 --- a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/test/util/TestConstants.java +++ b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/test/util/TestConstants.java @@ -32,6 +32,7 @@ public class TestConstants public static final String TEST_RELATIVE_LOCATION = home+"test/org/eclipse/datatools/enablement/oda/xml/input/sample.xml"; public static final String MIXED_FILTER = home+"test/org/eclipse/datatools/enablement/oda/xml/input/TestMixedFilter.xml"; public static final String NESTED_TABLE_ROOT_FILTER = home+"test/org/eclipse/datatools/enablement/oda/xml/input/nestedTableRootFilter.xml"; + public static final String EMPTY_ELEMENT = home+"test/org/eclipse/datatools/enablement/oda/xml/input/emptyElement.xml"; public static final String BOOKSTORE_XML_FILE = home + "test/org/eclipse/datatools/enablement/oda/xml/input/BookStore.xml"; public static final String BOOKSTORE_XSD_FILE = home + "test/org/eclipse/datatools/enablement/oda/xml/input/BookStore.xsd"; @@ -108,6 +109,8 @@ public class TestConstants public static final String SAX_PARSER_TEST17_OUTPUT_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/output/SaxParserTest.test17.txt"; public static final String SAX_PARSER_TEST18_GOLDEN_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test18.txt"; public static final String SAX_PARSER_TEST18_OUTPUT_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/output/SaxParserTest.test18.txt"; + public static final String SAX_PARSER_TEST19_GOLDEN_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test19.txt"; + public static final String SAX_PARSER_TEST19_OUTPUT_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/output/SaxParserTest.test19.txt"; //public static final String SAX_PARSER_TESTLARGE_OUTPUT_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/output/SaxParserTest.testLarge.txt"; diff --git a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/util/SaxParserTest.java b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/util/SaxParserTest.java index ea06552..f53f727 100644 --- a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/util/SaxParserTest.java +++ b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/util/SaxParserTest.java @@ -53,7 +53,8 @@ public class SaxParserTest extends BaseTest + "#-# filter3#:#[//entry/field[@b='time']]#:#{time;String;}" + "#-# filter4#:#[//Book[@type='fiction']]#:#{book.title;String;/Title},{book.author_paul;String;/Author[@type='firstclass']}" + "#-# relativeLocation#:#[//Book]#:#{title;String;//Title}" - + "#-# nestedTableRootFilter#:#[//employee[@type='employeeType1']]#:#{name;STRING;properties/property/@name},{value;STRING;properties/property/@value},{type;STRING;/@type}"; + + "#-# nestedTableRootFilter#:#[//employee[@type='employeeType1']]#:#{name;STRING;properties/property/@name},{value;STRING;properties/property/@value},{type;STRING;/@type}" + + "#-# emptyElement#:#[/NewDataSet/program/activity]#:#{ProgramID;Int;../ProgramID},{ProgramName;String;../ProgramName},{ActivityID;Int;/ActivityID},{ActivityName;String;/ActivityName}"; private RelationInformation ri; @@ -828,4 +829,47 @@ public class SaxParserTest extends BaseTest assertTrue( TestUtil.compareTextFile( new File( TestConstants.SAX_PARSER_TEST18_OUTPUT_XML ), new File( TestConstants.SAX_PARSER_TEST18_GOLDEN_XML ) ) ); } + + /** + * Tests the case when there exist empty elements in the xml file + * + * @throws OdaException + * @throws IOException + */ + public void test19( ) throws OdaException, IOException + { + File file = new File( TestConstants.SAX_PARSER_TEST19_OUTPUT_XML ); + + if ( file.exists( ) ) + file.delete( ); + File path = new File( file.getParent( ) ); + if ( !path.exists( ) ) + path.mkdir( ); + file.createNewFile( ); + FileOutputStream fos = new FileOutputStream( file ); + + ri = new RelationInformation( testString ); + ResultSet rs = new ResultSet( XMLDataInputStreamCreator.getCreator( TestConstants.EMPTY_ELEMENT ) + .createXMLDataInputStream( ), + ri, + "emptyElement", + 0 ); + + for ( int i = 0; i < rs.getMetaData( ).getColumnCount( ); i++ ) + fos.write( ( rs.getMetaData( ).getColumnName( i + 1 ) + "\t\t\t\t\t" ).getBytes( ) ); + fos.write( lineSeparator.getBytes( ) ); + + while ( rs.next( ) ) + { + for ( int i = 0; i < rs.getMetaData( ).getColumnCount( ); i++ ) + fos.write( ( rs.getString( i + 1 ) + "\t\t\t\t\t" ).getBytes( ) ); + fos.write( lineSeparator.getBytes( ) ); + } + assertFalse( rs.next( ) ); + + fos.close( ); + + assertTrue( TestUtil.compareTextFile( new File( TestConstants.SAX_PARSER_TEST19_OUTPUT_XML ), + new File( TestConstants.SAX_PARSER_TEST19_GOLDEN_XML ) ) ); + } } |

