From 45e42e24e7286283f63991f2cb23a2d586f819fa Mon Sep 17 00:00:00 2001 From: Calvin Date: Sun, 20 Jan 2013 18:06:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E7=9A=84SQL=E5=88=86=E7=B1=BB=E5=9E=8B=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=B9=E8=BF=9C=E7=A8=8B=E7=9A=84=E7=9C=9F?= =?UTF-8?q?=E5=AE=9E=E6=95=B0=E6=8D=AE=E5=BA=93=E6=89=A7=E8=A1=8Cfunctiona?= =?UTF-8?q?l=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/quickstart/pom.xml | 3 +-- .../quickstart/src/main/resources/applicationContext.xml | 4 ++-- .../quickstart/functional/BaseFunctionalTestCase.java | 4 +++- .../src/test/resources/application.functional.properties | 1 + .../src/test/resources/data/{ => h2}/cleanup-data.sql | 0 .../src/test/resources/data/{ => h2}/import-data.sql | 0 examples/showcase/pom.xml | 2 +- examples/showcase/src/main/resources/applicationContext.xml | 6 +++--- .../showcase/functional/BaseFunctionalTestCase.java | 4 +++- .../src/test/resources/application.functional.properties | 1 + .../src/test/resources/data/{ => h2}/cleanup-data.sql | 0 .../src/test/resources/data/{ => h2}/import-data.sql | 0 12 files changed, 15 insertions(+), 10 deletions(-) rename examples/quickstart/src/test/resources/data/{ => h2}/cleanup-data.sql (100%) rename examples/quickstart/src/test/resources/data/{ => h2}/import-data.sql (100%) rename examples/showcase/src/test/resources/data/{ => h2}/cleanup-data.sql (100%) rename examples/showcase/src/test/resources/data/{ => h2}/import-data.sql (100%) diff --git a/examples/quickstart/pom.xml b/examples/quickstart/pom.xml index c17f6af5..a3939eb4 100644 --- a/examples/quickstart/pom.xml +++ b/examples/quickstart/pom.xml @@ -664,7 +664,6 @@ refresh-db - org.apache.maven.plugins @@ -676,7 +675,7 @@ - + diff --git a/examples/quickstart/src/main/resources/applicationContext.xml b/examples/quickstart/src/main/resources/applicationContext.xml index b23fff61..3735665f 100644 --- a/examples/quickstart/src/main/resources/applicationContext.xml +++ b/examples/quickstart/src/main/resources/applicationContext.xml @@ -115,7 +115,7 @@ - + @@ -136,7 +136,7 @@ - + \ No newline at end of file diff --git a/examples/quickstart/src/test/functional/org/springside/examples/quickstart/functional/BaseFunctionalTestCase.java b/examples/quickstart/src/test/functional/org/springside/examples/quickstart/functional/BaseFunctionalTestCase.java index bbdf1781..20fdf2ec 100644 --- a/examples/quickstart/src/test/functional/org/springside/examples/quickstart/functional/BaseFunctionalTestCase.java +++ b/examples/quickstart/src/test/functional/org/springside/examples/quickstart/functional/BaseFunctionalTestCase.java @@ -87,6 +87,8 @@ public class BaseFunctionalTestCase { * 载入测试数据. */ protected static void reloadSampleData() throws Exception { - DataFixtures.executeScript(dataSource, "classpath:data/cleanup-data.sql", "classpath:data/import-data.sql"); + String dbType = propertiesLoader.getProperty("db.type", "h2"); + DataFixtures.executeScript(dataSource, "classpath:data/" + dbType + "cleanup-data.sql", "classpath:data/" + + dbType + "import-data.sql"); } } \ No newline at end of file diff --git a/examples/quickstart/src/test/resources/application.functional.properties b/examples/quickstart/src/test/resources/application.functional.properties index 9b2905ba..05f9cc01 100644 --- a/examples/quickstart/src/test/resources/application.functional.properties +++ b/examples/quickstart/src/test/resources/application.functional.properties @@ -5,6 +5,7 @@ embeddedForLocal=true selenium.driver=firefox #(optional)override jdbc url for functional test +db.type=h2 jdbc.driver=org.h2.Driver jdbc.url=jdbc:h2:file:~/.h2/quickstart-test;AUTO_SERVER=TRUE jdbc.username=sa diff --git a/examples/quickstart/src/test/resources/data/cleanup-data.sql b/examples/quickstart/src/test/resources/data/h2/cleanup-data.sql similarity index 100% rename from examples/quickstart/src/test/resources/data/cleanup-data.sql rename to examples/quickstart/src/test/resources/data/h2/cleanup-data.sql diff --git a/examples/quickstart/src/test/resources/data/import-data.sql b/examples/quickstart/src/test/resources/data/h2/import-data.sql similarity index 100% rename from examples/quickstart/src/test/resources/data/import-data.sql rename to examples/quickstart/src/test/resources/data/h2/import-data.sql diff --git a/examples/showcase/pom.xml b/examples/showcase/pom.xml index b6558f76..1bba2785 100644 --- a/examples/showcase/pom.xml +++ b/examples/showcase/pom.xml @@ -548,7 +548,7 @@ - + diff --git a/examples/showcase/src/main/resources/applicationContext.xml b/examples/showcase/src/main/resources/applicationContext.xml index 183c6001..6082d5b6 100644 --- a/examples/showcase/src/main/resources/applicationContext.xml +++ b/examples/showcase/src/main/resources/applicationContext.xml @@ -153,11 +153,11 @@ - + - + @@ -186,7 +186,7 @@ - + diff --git a/examples/showcase/src/test/functional/org/springside/examples/showcase/functional/BaseFunctionalTestCase.java b/examples/showcase/src/test/functional/org/springside/examples/showcase/functional/BaseFunctionalTestCase.java index c27301eb..3e00161a 100644 --- a/examples/showcase/src/test/functional/org/springside/examples/showcase/functional/BaseFunctionalTestCase.java +++ b/examples/showcase/src/test/functional/org/springside/examples/showcase/functional/BaseFunctionalTestCase.java @@ -81,6 +81,8 @@ public class BaseFunctionalTestCase { * 载入默认数据. */ protected static void reloadSampleData() throws Exception { - DataFixtures.executeScript(dataSource, "classpath:data/cleanup-data.sql", "classpath:data/import-data.sql"); + String dbType = propertiesLoader.getProperty("db.type", "h2"); + DataFixtures.executeScript(dataSource, "classpath:data/" + dbType + "cleanup-data.sql", "classpath:data/" + + dbType + "import-data.sql"); } } diff --git a/examples/showcase/src/test/resources/application.functional.properties b/examples/showcase/src/test/resources/application.functional.properties index c81675ff..86d0b8eb 100644 --- a/examples/showcase/src/test/resources/application.functional.properties +++ b/examples/showcase/src/test/resources/application.functional.properties @@ -5,6 +5,7 @@ embeddedForLocal=true selenium.driver=firefox #(optional)override jdbc url for functional test +db.type=h2 jdbc.driver=org.h2.Driver jdbc.url=jdbc:h2:file:~/.h2/showcase4-test;AUTO_SERVER=TRUE jdbc.username=sa diff --git a/examples/showcase/src/test/resources/data/cleanup-data.sql b/examples/showcase/src/test/resources/data/h2/cleanup-data.sql similarity index 100% rename from examples/showcase/src/test/resources/data/cleanup-data.sql rename to examples/showcase/src/test/resources/data/h2/cleanup-data.sql diff --git a/examples/showcase/src/test/resources/data/import-data.sql b/examples/showcase/src/test/resources/data/h2/import-data.sql similarity index 100% rename from examples/showcase/src/test/resources/data/import-data.sql rename to examples/showcase/src/test/resources/data/h2/import-data.sql -- GitLab