r52259 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52258‎ | r52259 | r52260 >
Date:21:44, 21 June 2009
Author:daniel
Status:deferred
Tags:
Comment:
db unit testing improvements
Modified paths:
  • /trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/BuildConceptAssociationsTest.java (added) (history)
  • /trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/IntegratorAppTestBase.java (modified) (history)
  • /trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/LoadForeignPropertiesTest-tableImport.expected.data+(from+/trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/LoadForeignPropertiesTest.data: (added) (history)
  • /trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/LoadForeignPropertiesTest-tripleImport.expected.data (added) (history)
  • /trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/LoadForeignPropertiesTest.data (deleted) (history)
  • /trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/LoadForeignPropertiesTest.java (modified) (history)

Diff [purge]

Index: trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/LoadForeignPropertiesTest.data
@@ -1,23 +0,0 @@
2 -<?xml version='1.0' encoding='UTF-8'?>
3 -<dataset>
4 - <tripleImport external_authority="acme" external_id="FooBar" property="concept_name" value="FooBar" qualifier="dummy"/>
5 - <tripleImport external_authority="acme" external_id="FooBar" property="firstName" value="Bar" qualifier="dummy"/>
6 - <tripleImport external_authority="acme" external_id="FooBar" property="name" value="Foo" qualifier="dummy"/>
7 - <tripleImport external_authority="acme" external_id="FooBar" property="phone" value="12345" qualifier="dummy"/>
8 -
9 - <tripleImport external_authority="acme" external_id="XyzzyQuux" property="concept_name" value="XyzzyQuux" qualifier="dummy"/>
10 - <tripleImport external_authority="acme" external_id="XyzzyQuux" property="firstName" value="Quux" qualifier="dummy"/>
11 - <tripleImport external_authority="acme" external_id="XyzzyQuux" property="name" value="Xyzzy" qualifier="dummy"/>
12 - <tripleImport external_authority="acme" external_id="XyzzyQuux" property="phone" value="67890" qualifier="dummy"/>
13 -
14 - <tableImport external_authority="acme" external_id="FooBar" property="concept_name" value="FooBar" qualifier="dummy"/>
15 - <tableImport external_authority="acme" external_id="FooBar" property="firstName" value="Bar" qualifier="dummy"/>
16 - <tableImport external_authority="acme" external_id="FooBar" property="name" value="Foo" qualifier="dummy"/>
17 - <tableImport external_authority="acme" external_id="FooBar" property="phone" value="12345" qualifier="dummy"/>
18 -
19 - <tableImport external_authority="acme" external_id="XyzzyQuux" property="concept_name" value="XyzzyQuux" qualifier="dummy"/>
20 - <tableImport external_authority="acme" external_id="XyzzyQuux" property="firstName" value="Quux" qualifier="dummy"/>
21 - <tableImport external_authority="acme" external_id="XyzzyQuux" property="name" value="Xyzzy" qualifier="dummy"/>
22 - <tableImport external_authority="acme" external_id="XyzzyQuux" property="phone" value="67890" qualifier="dummy"/>
23 -</dataset>
24 -
Index: trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/LoadForeignPropertiesTest-tripleImport.expected.data
@@ -0,0 +1,13 @@
 2+<?xml version='1.0' encoding='UTF-8'?>
 3+<dataset>
 4+ <TEST_xx_tripleImport external_authority="acme" external_id="FooBar" property="concept_name" value="FooBar" qualifier="dummy"/>
 5+ <TEST_xx_tripleImport external_authority="acme" external_id="FooBar" property="firstName" value="Bar" qualifier="dummy"/>
 6+ <TEST_xx_tripleImport external_authority="acme" external_id="FooBar" property="name" value="Foo" qualifier="dummy"/>
 7+ <TEST_xx_tripleImport external_authority="acme" external_id="FooBar" property="phone" value="12345" qualifier="dummy"/>
 8+
 9+ <TEST_xx_tripleImport external_authority="acme" external_id="XyzzyQuux" property="concept_name" value="XyzzyQuux" qualifier="dummy"/>
 10+ <TEST_xx_tripleImport external_authority="acme" external_id="XyzzyQuux" property="firstName" value="Quux" qualifier="dummy"/>
 11+ <TEST_xx_tripleImport external_authority="acme" external_id="XyzzyQuux" property="name" value="Xyzzy" qualifier="dummy"/>
 12+ <TEST_xx_tripleImport external_authority="acme" external_id="XyzzyQuux" property="phone" value="67890" qualifier="dummy"/>
 13+</dataset>
 14+
Index: trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/LoadForeignPropertiesTest.java
@@ -20,11 +20,11 @@
2121
2222 //-----------------------------------------------------------------------------------------------------
2323 public void testTableImport() throws Exception {
24 - runApp("tableImport", "external_authority", "external_id", "property", "value", "qualifier");
 24+ runApp("tableImport");
2525 }
2626
2727 public void testTripleImport() throws Exception {
28 - runApp("tripleImport", "external_authority", "external_id", "property", "value", "qualifier");
 28+ runApp("tripleImport");
2929 }
3030
3131 @Override
Index: trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/IntegratorAppTestBase.java
@@ -45,7 +45,7 @@
4646 return app;
4747 }
4848
49 - protected void runApp(String testName, String... orderBy) throws Exception {
 49+ protected void runApp(String testName) throws Exception {
5050 //get source description
5151 FeatureSetSourceDescriptor source = loadSourceDescriptor(testName);
5252
@@ -53,21 +53,8 @@
5454 T app = prepareApp(source, testName);
5555 app.testLaunch();
5656
57 - //build order string
58 - StringBuilder order = new StringBuilder();
59 - for (String by: orderBy) {
60 - if (order.length()>0) order.append(", ");
61 - order.append('"');
62 - order.append(by);
63 - order.append('"');
64 - }
65 -
66 - //get real table name and build query
67 - String tableName = app.getConfiguredDataset().getDbPrefix()+testName;
68 - String sql = "SELECT * FROM \""+tableName+"\" ORDER BY "+order;
69 -
7057 //compare query result to expected data from XML file.
71 - assertTableContent(testName, sql);
 58+ assertTableData(getBaseName()+"-"+testName, app.getConfiguredDataset().getDbPrefix()+testName);
7259 }
7360
7461 }
Index: trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/BuildConceptAssociationsTest.java
@@ -0,0 +1,20 @@
 2+package de.brightbyte.wikiword.integrator;
 3+
 4+
 5+public class BuildConceptAssociationsTest extends IntegratorAppTestBase<BuildConceptAssociations> {
 6+
 7+ public BuildConceptAssociationsTest() {
 8+ super("BildConceptAssociations");
 9+ }
 10+
 11+ //-----------------------------------------------------------------------------------------------------
 12+ public void testTableImport() throws Exception {
 13+ runApp("tableImport");
 14+ }
 15+
 16+ @Override
 17+ protected BuildConceptAssociations createApp() {
 18+ return new BuildConceptAssociations();
 19+ }
 20+
 21+}
Property changes on: trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/BuildConceptAssociationsTest.java
___________________________________________________________________
Name: svn:mergeinfo
122 +
Index: trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/LoadForeignPropertiesTest-tableImport.expected.data
@@ -0,0 +1,13 @@
 2+<?xml version='1.0' encoding='UTF-8'?>
 3+<dataset>
 4+ <TEST_xx_tableImport external_authority="acme" external_id="FooBar" property="concept_name" value="FooBar" qualifier="dummy"/>
 5+ <TEST_xx_tableImport external_authority="acme" external_id="FooBar" property="firstName" value="Bar" qualifier="dummy"/>
 6+ <TEST_xx_tableImport external_authority="acme" external_id="FooBar" property="name" value="Foo" qualifier="dummy"/>
 7+ <TEST_xx_tableImport external_authority="acme" external_id="FooBar" property="phone" value="12345" qualifier="dummy"/>
 8+
 9+ <TEST_xx_tableImport external_authority="acme" external_id="XyzzyQuux" property="concept_name" value="XyzzyQuux" qualifier="dummy"/>
 10+ <TEST_xx_tableImport external_authority="acme" external_id="XyzzyQuux" property="firstName" value="Quux" qualifier="dummy"/>
 11+ <TEST_xx_tableImport external_authority="acme" external_id="XyzzyQuux" property="name" value="Xyzzy" qualifier="dummy"/>
 12+ <TEST_xx_tableImport external_authority="acme" external_id="XyzzyQuux" property="phone" value="67890" qualifier="dummy"/>
 13+</dataset>
 14+
Property changes on: trunk/WikiWord/WikiWordIntegrator/src/test/java/de/brightbyte/wikiword/integrator/LoadForeignPropertiesTest-tableImport.expected.data
___________________________________________________________________
Name: svn:mergeinfo
115 +

Status & tagging log