diff --git a/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java b/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java index bbd050cc91..2dd8c51622 100644 --- a/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java +++ b/source/java/org/alfresco/repo/web/scripts/BaseWebScriptTest.java @@ -219,6 +219,20 @@ public abstract class BaseWebScriptTest extends TestCase } return BaseWebScriptTest.server; } + + protected static TestWebScriptServer initServer() + { + return getServer(); + } + + protected static TestWebScriptServer initServer(String appendTestConfigLocation) + { + if (BaseWebScriptTest.server == null) + { + BaseWebScriptTest.server = TestWebScriptRepoServer.getTestServer(appendTestConfigLocation); + } + return BaseWebScriptTest.server; + } /** * Is Log Enabled? diff --git a/source/java/org/alfresco/repo/web/scripts/TestWebScriptRepoServer.java b/source/java/org/alfresco/repo/web/scripts/TestWebScriptRepoServer.java index a3a19b066c..e67e8d4968 100644 --- a/source/java/org/alfresco/repo/web/scripts/TestWebScriptRepoServer.java +++ b/source/java/org/alfresco/repo/web/scripts/TestWebScriptRepoServer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2007 Alfresco Software Limited. + * Copyright (C) 2005-2009 Alfresco Software Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -90,6 +90,14 @@ public class TestWebScriptRepoServer extends TestWebScriptServer } } + private final static String[] CONFIG_LOCATIONS = new String[] + { + "classpath:alfresco/application-context.xml", + "classpath:alfresco/webscript-framework-application-context.xml", + "classpath:alfresco/web-scripts-application-context.xml", + "classpath:alfresco/web-scripts-application-context-test.xml" + }; + /** * Retrieve an instance of the TestWebScriptServer * @@ -97,18 +105,22 @@ public class TestWebScriptRepoServer extends TestWebScriptServer */ public static TestWebScriptServer getTestServer() { - String[] CONFIG_LOCATIONS = new String[] - { - "classpath:alfresco/application-context.xml", - "classpath:alfresco/webscript-framework-application-context.xml", - "classpath:alfresco/web-scripts-application-context.xml", - "classpath:alfresco/web-scripts-application-context-test.xml" - }; ApplicationContext context = new ClassPathXmlApplicationContext(CONFIG_LOCATIONS); TestWebScriptServer testServer = (TestWebScriptRepoServer)context.getBean("webscripts.test"); return testServer; } + public static TestWebScriptServer getTestServer(String appendTestConfigLocation) + { + String[] config_locations = new String[CONFIG_LOCATIONS.length+1]; + System.arraycopy(CONFIG_LOCATIONS, 0, config_locations, 0, CONFIG_LOCATIONS.length); + config_locations[CONFIG_LOCATIONS.length] = appendTestConfigLocation; + + ApplicationContext context = new ClassPathXmlApplicationContext(config_locations); + TestWebScriptServer testServer = (TestWebScriptRepoServer)context.getBean("webscripts.test"); + return testServer; + } + /** * Interpret a single command using the BufferedReader passed in for any data needed. * diff --git a/source/java/org/alfresco/repo/web/scripts/wcm/sandbox/AssetTest.java b/source/java/org/alfresco/repo/web/scripts/wcm/sandbox/AssetTest.java index 77bff51a2e..c91b0df1ca 100644 --- a/source/java/org/alfresco/repo/web/scripts/wcm/sandbox/AssetTest.java +++ b/source/java/org/alfresco/repo/web/scripts/wcm/sandbox/AssetTest.java @@ -75,7 +75,9 @@ public class AssetTest extends BaseWebScriptTest { private static final String WEBAPP_YELLOW = "YELLOW"; private static final String WEBAPP_GREEN = "GREEN"; - private static final long SUBMIT_DELAY = 120000L; // 2 minutes - to allow time for async submit workflow to complete + // override jbpm.job.executor idleInterval to 5s (was 1.5m) for WCM unit tests + private static final String SUBMIT_CONFIG_LOCATION = "classpath:wcm/wcm-jbpm-context.xml"; + private static final long SUBMIT_DELAY = 10000L; // (in millis) 10s - to allow time for async submit workflow to complete (as per 5s idleInterval above) private List createdWebProjects = new ArrayList(5); @@ -84,6 +86,8 @@ public class AssetTest extends BaseWebScriptTest { protected void setUp() throws Exception { super.setUp(); + + initServer(SUBMIT_CONFIG_LOCATION); this.authenticationService = (AuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService"); this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");