diff --git a/examples/mini-service/pom.xml b/examples/mini-service/pom.xml index 70dbf5ae6555e7b4c7945c6b5989e9b8825dee03..b3df50c7a634b7d45ba96999ca1cf4b2f89670c2 100644 --- a/examples/mini-service/pom.xml +++ b/examples/mini-service/pom.xml @@ -311,11 +311,11 @@ + smoke-test - org.apache.maven.plugins maven-surefire-plugin @@ -330,11 +330,11 @@ + integration-test - org.apache.maven.plugins maven-surefire-plugin @@ -348,6 +348,7 @@ + refresh-db @@ -357,6 +358,7 @@ maven-antrun-plugin + diff --git a/examples/mini-service/src/main/resources/applicationContext.xml b/examples/mini-service/src/main/resources/applicationContext.xml index 12344234abd7a94acd81df8a8670a74898aac996..46105873c7c6f803fa3efb9938e0e63c18a8f8d2 100644 --- a/examples/mini-service/src/main/resources/applicationContext.xml +++ b/examples/mini-service/src/main/resources/applicationContext.xml @@ -32,6 +32,7 @@ + @@ -44,7 +45,7 @@ classpath*:/application.local.properties - file:/var/mini-service/application.server.properties + @@ -70,6 +71,7 @@ + @@ -79,16 +81,13 @@ classpath*:/application.properties - - classpath*:/application.local.properties classpath*:/application.test.properties - - classpath*:/application.test-local.properties - - + + + @@ -97,16 +96,49 @@ + - + + - - - + + + + + + + + + + + classpath*:/application.properties + + classpath*:/application.local.properties + + classpath*:/application.functional.properties + + classpath*:/application.functional-local.properties + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/mini-service/src/main/webapp/WEB-INF/web.xml b/examples/mini-service/src/main/webapp/WEB-INF/web.xml index ca56de6a46b663808746440e4c03ab3a88553120..08f3c8770b92959ef25d2c8822b22188baae5753 100644 --- a/examples/mini-service/src/main/webapp/WEB-INF/web.xml +++ b/examples/mini-service/src/main/webapp/WEB-INF/web.xml @@ -15,9 +15,9 @@ - + - spring.profiles.active + spring.profiles.default production diff --git a/examples/mini-service/src/test/functional/org/springside/examples/miniservice/functional/BaseFunctionalTestCase.java b/examples/mini-service/src/test/functional/org/springside/examples/miniservice/functional/BaseFunctionalTestCase.java index 97db4917e08c1f450b1dd8f14ed5f3cc6b68150b..2b12cdf77b50da236db89df5123ceadfe66a03e6 100644 --- a/examples/mini-service/src/test/functional/org/springside/examples/miniservice/functional/BaseFunctionalTestCase.java +++ b/examples/mini-service/src/test/functional/org/springside/examples/miniservice/functional/BaseFunctionalTestCase.java @@ -30,8 +30,9 @@ public class BaseFunctionalTestCase { protected static SimpleDriverDataSource dataSource; - protected static PropertiesLoader propertiesLoader = new PropertiesLoader( - "classpath:/application.functional.properties", "classpath:/application.functional-local.properties"); + protected static PropertiesLoader propertiesLoader = new PropertiesLoader("classpath:/application.properties", + "classpath:/application.local.properties", "classpath:/application.functional.properties", + "classpath:/application.functional-local.properties"); private static Logger logger = LoggerFactory.getLogger(BaseFunctionalTestCase.class); @@ -54,8 +55,10 @@ public class BaseFunctionalTestCase { */ protected static void startJettyOnce() throws Exception { if (jettyServer == null) { - jettyServer = JettyFactory.createServer(new URL(baseUrl).getPort(), Start.CONTEXT, - "src/test/resources/web.xml"); + //设定Spring的profile + System.setProperty("spring.profiles.active", "functional"); + + jettyServer = JettyFactory.createServer(new URL(baseUrl).getPort(), Start.CONTEXT); jettyServer.start(); logger.info("Jetty Server started"); diff --git a/examples/mini-service/src/test/resources/application.functional.properties b/examples/mini-service/src/test/resources/application.functional.properties index 9fed68a29ba223a7bdf0f07bf5ff958228832c25..6fc8bd23c07fe616a40b3047c695462fef63adef 100644 --- a/examples/mini-service/src/test/resources/application.functional.properties +++ b/examples/mini-service/src/test/resources/application.functional.properties @@ -1,8 +1,2 @@ baseUrl=http://localhost:8084/mini-service -embedded=true - -jdbc.driver=org.h2.Driver -jdbc.url=jdbc:h2:mem:mini-service4;DB_CLOSE_DELAY=-1 -jdbc.username=sa -jdbc.password= - +embedded=true \ No newline at end of file diff --git a/examples/mini-service/src/test/resources/web.xml b/examples/mini-service/src/test/resources/web.xml deleted file mode 100644 index 182c1c95a835114a5a23a95c7d7c1eedc2590024..0000000000000000000000000000000000000000 --- a/examples/mini-service/src/test/resources/web.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - mini-service - - - - contextConfigLocation - - classpath*:/applicationContext.xml - classpath*:/applicationContext-rs-server.xml - classpath*:/applicationContext-ws-server.xml - - - - - - spring.profiles.active - test - - - - - org.springframework.web.context.ContextLoaderListener - - - - - CXFServlet - org.apache.cxf.transport.servlet.CXFServlet - - - CXFServlet - /ws/* - - - - - JerseyServlet - com.sun.jersey.spi.spring.container.servlet.SpringServlet - - - com.sun.jersey.api.json.POJOMappingFeature - true - - - - JerseyServlet - /rs/* - - diff --git a/examples/mini-web/pom.xml b/examples/mini-web/pom.xml index 9464d95f90d397527f556466ecd5782a4381e0e2..d99e14f1bac8fc31f5297efcd70b45fb9c2e681d 100644 --- a/examples/mini-web/pom.xml +++ b/examples/mini-web/pom.xml @@ -319,11 +319,11 @@ + smoke-test - org.apache.maven.plugins maven-surefire-plugin @@ -341,12 +341,12 @@ - + + integration-test - org.apache.maven.plugins maven-surefire-plugin @@ -363,7 +363,8 @@ - + + refresh-db @@ -373,7 +374,8 @@ maven-antrun-plugin - + + diff --git a/examples/mini-web/src/main/resources/applicationContext.xml b/examples/mini-web/src/main/resources/applicationContext.xml index 6723e1fe4ba034ee9695d76d474326a5f4f90244..37065f6757a763d4ff35690d0b9cfc9d6ac31170 100644 --- a/examples/mini-web/src/main/resources/applicationContext.xml +++ b/examples/mini-web/src/main/resources/applicationContext.xml @@ -48,8 +48,9 @@ - - + + + @@ -60,32 +61,35 @@ classpath*:/application.local.properties - file:/var/mini-web/application.server.properties + - - - + + + - + - + + - + + + @@ -93,18 +97,15 @@ classpath*:/application.properties - - classpath*:/application.local.properties classpath*:/application.test.properties - - classpath*:/application.test-local.properties - - + + + @@ -115,13 +116,45 @@ - + + + + + + + + + + + + + classpath*:/application.properties + + classpath*:/application.local.properties + + classpath*:/application.functional.properties + + classpath*:/application.functional-local.properties + + + + + + + + + + + + - - + + + + \ No newline at end of file diff --git a/examples/mini-web/src/main/webapp/WEB-INF/web.xml b/examples/mini-web/src/main/webapp/WEB-INF/web.xml index 7108740ee34d16977031815d7afb86d0c481307d..5e0ba12db79f73fef763912f045addfe8ad0c77e 100644 --- a/examples/mini-web/src/main/webapp/WEB-INF/web.xml +++ b/examples/mini-web/src/main/webapp/WEB-INF/web.xml @@ -15,9 +15,9 @@ - + - spring.profiles.active + spring.profiles.default production diff --git a/examples/mini-web/src/test/functional/org/springside/examples/miniweb/functional/BaseFunctionalTestCase.java b/examples/mini-web/src/test/functional/org/springside/examples/miniweb/functional/BaseFunctionalTestCase.java index 4f5a08e96e0124a96c8fb9aab025f8ca7497594f..01ff78be9cbb74da1915223bb52e35525a9aa798 100644 --- a/examples/mini-web/src/test/functional/org/springside/examples/miniweb/functional/BaseFunctionalTestCase.java +++ b/examples/mini-web/src/test/functional/org/springside/examples/miniweb/functional/BaseFunctionalTestCase.java @@ -39,8 +39,9 @@ public class BaseFunctionalTestCase { protected static Selenium2 s; - protected static PropertiesLoader propertiesLoader = new PropertiesLoader( - "classpath:/application.functional.properties", "classpath:/application.functional-local.properties"); + protected static PropertiesLoader propertiesLoader = new PropertiesLoader("classpath:/application.properties", + "classpath:/application.local.properties", "classpath:/application.functional.properties", + "classpath:/application.functional-local.properties"); private static Logger logger = LoggerFactory.getLogger(BaseFunctionalTestCase.class); @@ -72,8 +73,10 @@ public class BaseFunctionalTestCase { */ protected static void startJettyOnce() throws Exception { if (jettyServer == null) { - jettyServer = JettyFactory.createServer(new URL(baseUrl).getPort(), Start.CONTEXT, - "src/test/resources/web.xml"); + //设定Spring的profile + System.setProperty("spring.profiles.active", "functional"); + + jettyServer = JettyFactory.createServer(new URL(baseUrl).getPort(), Start.CONTEXT); jettyServer.start(); logger.info("Jetty Server started"); diff --git a/examples/mini-web/src/test/resources/application.functional.properties b/examples/mini-web/src/test/resources/application.functional.properties index 121d31d84afd1b090e7043c6b65de43b494fda9c..75a8ef312bfa2f3cf99a234ca76b75c756bde0dc 100644 --- a/examples/mini-web/src/test/resources/application.functional.properties +++ b/examples/mini-web/src/test/resources/application.functional.properties @@ -1,10 +1,5 @@ baseUrl=http://localhost:8082/mini-web embedded=true - -jdbc.driver=org.h2.Driver -jdbc.url=jdbc:h2:mem:mini-web4;DB_CLOSE_DELAY=-1 -jdbc.username=sa -jdbc.password= - #selenium settings, options include firefox,ie,chrome,remote:localhost:4444:firefox -selenium.driver=firefox \ No newline at end of file +selenium.driver=firefox + diff --git a/examples/mini-web/src/test/resources/web.xml b/examples/mini-web/src/test/resources/web.xml deleted file mode 100644 index ad9d953bba734865b12c15758133246a85c897d3..0000000000000000000000000000000000000000 --- a/examples/mini-web/src/test/resources/web.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - mini-web - - - - contextConfigLocation - - classpath*:/applicationContext.xml - classpath*:/applicationContext-shiro.xml - - - - - - spring.profiles.active - test - - - - - - encodingFilter - org.springframework.web.filter.CharacterEncodingFilter - - encoding - UTF-8 - - - forceEncoding - true - - - - encodingFilter - /* - - - - - openEntityManagerInViewFilter - org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter - - - openEntityManagerInViewFilter - /* - - - - - shiroFilter - org.springframework.web.filter.DelegatingFilterProxy - - - shiroFilter - /* - - - - - sitemeshFilter - com.opensymphony.sitemesh.webapp.SiteMeshFilter - - - sitemeshFilter - /* - - - - - springServlet - org.springframework.web.servlet.DispatcherServlet - - contextConfigLocation - /WEB-INF/spring-mvc.xml - - 1 - - - - springServlet - / - - - - - org.springframework.web.context.ContextLoaderListener - - - - - 20 - - - - - java.lang.Throwable - /WEB-INF/views/error/500.jsp - - - 500 - /WEB-INF/views/error/500.jsp - - - 404 - /WEB-INF/views/error/404.jsp - - diff --git a/examples/showcase/pom.xml b/examples/showcase/pom.xml index 7372f98562f9679b02c5683595fb12f90d37c7ab..02e69e48580746fb6d1f90c32820516d5fe4c09d 100644 --- a/examples/showcase/pom.xml +++ b/examples/showcase/pom.xml @@ -476,11 +476,11 @@ + smoke-test - org.apache.maven.plugins maven-surefire-plugin @@ -499,11 +499,11 @@ + integration-test - org.apache.maven.plugins maven-surefire-plugin @@ -521,6 +521,7 @@ + refresh-db @@ -530,6 +531,7 @@ maven-antrun-plugin + diff --git a/examples/showcase/src/main/resources/applicationContext.xml b/examples/showcase/src/main/resources/applicationContext.xml index 85e9c1b127ba0bb5b52ab3786245200817c4c50b..71ca6571cdf09f1cdad5c9604f3ac9751987e819 100644 --- a/examples/showcase/src/main/resources/applicationContext.xml +++ b/examples/showcase/src/main/resources/applicationContext.xml @@ -58,6 +58,7 @@ + @@ -70,7 +71,7 @@ classpath*:/application.local.properties - file:/opt/springside/showcase/application.server.properties + @@ -94,6 +95,7 @@ + @@ -103,17 +105,13 @@ classpath*:/application.properties - - classpath*:/application.local.properties classpath*:/application.test.properties - - classpath*:/application.test-local.properties - + @@ -129,23 +127,66 @@ - + - + + - - - + + + + + + + + + + classpath*:/application.properties + + classpath*:/application.local.properties + + classpath*:/application.functional.properties + + classpath*:/application.functional-local.properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/showcase/src/main/webapp/WEB-INF/web.xml b/examples/showcase/src/main/webapp/WEB-INF/web.xml index fedba54a467a8c8356d602b2610e01090b7b29db..615ace4d4adeec685dc8a9048dbeb0aa9c715b3b 100644 --- a/examples/showcase/src/main/webapp/WEB-INF/web.xml +++ b/examples/showcase/src/main/webapp/WEB-INF/web.xml @@ -14,9 +14,9 @@ - + - spring.profiles.active + spring.profiles.default production 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 91cac1f07773b4f5d313fe90c826e90eb669a027..5c10e00bdb13d6fa3f9bffee504bb377ef4faacc 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 @@ -28,8 +28,9 @@ public class BaseFunctionalTestCase { protected static SimpleDriverDataSource dataSource; - protected static PropertiesLoader propertiesLoader = new PropertiesLoader( - "classpath:/application.functional.properties", "classpath:/application.functional-local.properties"); + protected static PropertiesLoader propertiesLoader = new PropertiesLoader("classpath:/application.properties", + "classpath:/application.local.properties", "classpath:/application.functional.properties", + "classpath:/application.functional-local.properties"); private static Logger logger = LoggerFactory.getLogger(BaseFunctionalTestCase.class); @@ -52,8 +53,10 @@ public class BaseFunctionalTestCase { */ protected static void startJettyOnce() throws Exception { if (jettyServer == null) { - jettyServer = JettyFactory.createServer(new URL(baseUrl).getPort(), Start.CONTEXT, - "src/test/resources/web.xml"); + //设定Spring的profile + System.setProperty("spring.profiles.active", "functional"); + + jettyServer = JettyFactory.createServer(new URL(baseUrl).getPort(), Start.CONTEXT); jettyServer.start(); logger.info("Jetty Server started"); diff --git a/examples/showcase/src/test/resources/application.functional.properties b/examples/showcase/src/test/resources/application.functional.properties index 1f526ddaa75302a7a42b32c47970b8bb9a3261d6..f0ac6a274e4f6840c1bf0850acfc1eebeae86f3a 100644 --- a/examples/showcase/src/test/resources/application.functional.properties +++ b/examples/showcase/src/test/resources/application.functional.properties @@ -1,11 +1,6 @@ baseUrl=http://localhost:8083/showcase embedded=true - -jdbc.driver=org.h2.Driver -jdbc.url=jdbc:h2:mem:showcase4;DB_CLOSE_DELAY=-1 -jdbc.username=sa -jdbc.password= - #selenium settings, options include firefox,ie,chrome,htmlunit,remote:localhost:4444:firefox selenium.driver=firefox + diff --git a/examples/showcase/src/test/resources/web.xml b/examples/showcase/src/test/resources/web.xml deleted file mode 100644 index 2f3c4ddfae0a1743e78281168ddc84ad94405cca..0000000000000000000000000000000000000000 --- a/examples/showcase/src/test/resources/web.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - showcase - - - - contextConfigLocation - - classpath*:/applicationContext.xml - classpath*:/applicationContext-showcases.xml - - - - - - spring.profiles.active - test - - - - - org.springframework.web.context.ContextLoaderListener - - - - - springServlet - org.springframework.web.servlet.DispatcherServlet - - contextConfigLocation - /WEB-INF/spring-mvc.xml - - 1 - - - springServlet - / - - - - - JerseyServlet - com.sun.jersey.spi.spring.container.servlet.SpringServlet - - - com.sun.jersey.api.json.POJOMappingFeature - true - - - - JerseyServlet - /rs/* - - - - - StaticContentServlet - org.springside.examples.showcase.web.StaticContentServlet - - - StaticContentServlet - /static-content - - - - RemoteContentServlet - org.springside.examples.showcase.web.RemoteContentServlet - - - RemoteContentServlet - /remote-content - - - - - - encodingFilter - org.springframework.web.filter.CharacterEncodingFilter - - encoding - UTF-8 - - - forceEncoding - true - - - - encodingFilter - /* - REQUEST - FORWARD - - - - - openEntityManagerInViewFilter - org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter - - - openEntityManagerInViewFilter - /* - - - - - shiroFilter - org.springframework.web.filter.DelegatingFilterProxy - - - shiroFilter - /* - REQUEST - FORWARD - - - - - cacheControlHeaderFilter - org.springside.examples.showcase.web.CacheControlHeaderFilter - - - cacheControlHeaderFilter - /static/* - - - - sitemeshFilter - com.opensymphony.sitemesh.webapp.SiteMeshFilter - - - sitemeshFilter - /* - - - - - java.lang.Throwable - /WEB-INF/views/error/500.jsp - - - 500 - /WEB-INF/views/error/500.jsp - - diff --git a/modules/core/src/main/java/org/springside/modules/test/functional/JettyFactory.java b/modules/core/src/main/java/org/springside/modules/test/functional/JettyFactory.java index 893b0631a21127bfdd4a803c52f953b3e63bf1fe..297e911cd7184846962c4c947e0eaf627911348e 100644 --- a/modules/core/src/main/java/org/springside/modules/test/functional/JettyFactory.java +++ b/modules/core/src/main/java/org/springside/modules/test/functional/JettyFactory.java @@ -31,13 +31,4 @@ public class JettyFactory { return server; } - - /** - * 创建Jetty Server,以 以src/main/webapp为Web应用目录并重新制定web.xml路径。 - */ - public static Server createServer(int port, String contextPath, String webxmlPath) { - Server server = createServer(port, contextPath); - ((WebAppContext) server.getHandler()).setDescriptor(webxmlPath); - return server; - } } diff --git a/modules/core/src/test/java/org/springside/modules/test/functional/JettyFactoryTest.java b/modules/core/src/test/java/org/springside/modules/test/functional/JettyFactoryTest.java index 3901ba789e1c536014f370742e45da9f782b354c..41c8c1681074960c3042a154c9bccff4551cfe30 100644 --- a/modules/core/src/test/java/org/springside/modules/test/functional/JettyFactoryTest.java +++ b/modules/core/src/test/java/org/springside/modules/test/functional/JettyFactoryTest.java @@ -19,7 +19,7 @@ public class JettyFactoryTest { @Test public void createTestServer() { - Server server = JettyFactory.createServer(1978, "core", "src/test/resources/web.xml"); + Server server = JettyFactory.createServer(1978, "core"); assertEquals(1978, server.getConnectors()[0].getPort()); assertEquals("core", ((WebAppContext) server.getHandler()).getContextPath());