/** * Execute script line in thread. */ public void run() { try { result = server.execute(scriptLine); } catch (Exception e) { exception = e; } }
/** * Sleep for specified interval continuing to pump logging messages for test * program server. * * @param server test program server * @param millis sleep interval * @throws IOException * @throws InterruptedException */ protected void sleep(TestProgram server, long millis) throws IOException, InterruptedException { sleep(new TestProgram[]{server}, millis); }
/** * Override the location of the Jetspeed Spring assemblies files by pulling in all xml files found in the assembly package. * Make sure to have your unit test copy assemblies into the class path assembly directory like: <blockquote><pre> <resource> <path>assembly</path> <include>*.xml,boot/*.xml</include> <destination>assembly</destination> </resource> </pre></blockquote> */ @Override protected String[] getConfigurations() { return getResourcesFromClasspath("assembly"); }
/** * setup Spring context as part of test setup */ protected void setUp() throws Exception { super.setUp(); String [] configurations = getConfigurations(); if ((configurations != null) && (configurations.length > 0)) { scm = new SpringComponentManager(getBeanDefinitionFilter(), getBootConfigurations(), getConfigurations(), getBaseDir() + "target/test-classes/webapp", getInitProperties(), false); scm.start(); new JetspeedActions(getSupportedPortletModes(), getSupportedWindowStates()); } }
try { initialize(); if (scriptLine.length() > 0) { Subject userSubject = getUserSubject(); if (userSubject != null) { } else { resultLine = execute(scriptLine); } else { exit(); while (!isExit()); terminate(); return null; } catch (Throwable t) {
/** * Initialize server component manager and script context. * * @throws Exception */ public void initialize() throws Exception { // setup jetspeed test component manager JetspeedBeanDefinitionFilter beanDefinitionFilter = new JetspeedBeanDefinitionFilter(getBeanDefinitionFilterCategories()); String [] bootConfigurations = getBootConfigurations(); String [] configurations = getConfigurations(); baseDir = System.getProperty("basedir"); if ((baseDir == null) || (baseDir.length() == 0)) { baseDir = System.getProperty("user.dir"); } String appRoot = baseDir+"/target/test-classes/webapp"; scm = new SpringComponentManager(beanDefinitionFilter, bootConfigurations, configurations, appRoot, false); scm.start(); // create jexl context jexlContext = new MapContext(getContextVars()); }
assertTrue(loader instanceof URLClassLoader); URLClassLoader urlLoader = (URLClassLoader)loader; assertNotNull(urlLoader.getURLs()); for (URL pathURL : urlLoader.getURLs()) { assertTrue(classPath.length() > 0); super.setUp();
/** * Helper to either use a list of categories, comma separated, with <code>getBeanDefinitionFilterCategories</code> or * use a single category key with <code>getBeanDefinitionFilterCategoryKey</code> combined with <code>getFilterFile</code> */ @Override protected JetspeedBeanDefinitionFilter getBeanDefinitionFilter() throws IOException { String categories = getBeanDefinitionFilterCategories(); if (categories == null) return new JetspeedBeanDefinitionFilter(getFilterFile(), getBeanDefinitionFilterCategoryKey()); else return new JetspeedBeanDefinitionFilter(categories); }
for (Map.Entry<String,String> systemProperty : systemProperties.entrySet()) { String propertyName = systemProperty.getKey(); String propertyValue = testProgramSystemPropertyValueFilter(propertyName, index, systemProperty.getValue()); commandAndArgs.add( "-D"+propertyName+"="+propertyValue); for (Map.Entry<String,String> systemProperty : testProgramSystemProperties().entrySet()) { String propertyName = systemProperty.getKey(); String propertyValue = testProgramSystemPropertyValueFilter(propertyName, index, systemProperty.getValue()); commandAndArgs.add( "-D"+propertyName+"="+propertyValue); logProcessLine(line);
/** * @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { jndiDS = new JetspeedTestJNDIComponent(); jndiDS.setup(); super.setUp(); }
poll(); for (String line; ((line = processOutput.readLine()) != null);) { if (!line.startsWith(SCRIPT_RESULT_LINE_PREFIX)) { logProcessLine(line); } else { resultLine = line;
/** * Poll remote test program process for output log messages. * * @throws IOException */ public synchronized void poll() throws IOException { assertNotNull(process); // read messages from process for (String line; (processOutput.ready() && ((line = processOutput.readLine()) != null));) { logProcessLine(line); } }
/** * Join and return script line result. * * @return script line result * @throws Exception throws execution exception */ public String getResult() throws Exception { try { join(); } catch (InterruptedException ie) { } if (exception != null) { throw exception; } return result; } }
public Object run() { try { executeResultLine[0] = execute(executeScriptLine); return null; } catch (Exception e) { return e; } finally { JSSubject.clearSubject(); } } }, null);
/** * @see junit.framework.TestCase#tearDown() */ protected void tearDown() throws Exception { super.tearDown(); jndiDS.tearDown(); }
/** * Sleep for specified interval continuing to pump logging messages for test * program servers. * * @param servers test program servers * @param millis sleep interval * @throws IOException * @throws InterruptedException */ protected void sleep(TestProgram [] servers, long millis) throws IOException, InterruptedException { long slept = 0; while (slept < millis) { // poll servers for logging for (TestProgram server : servers) { server.poll(); } // sleep for interval long sleep = Math.min(millis-slept, LOGGING_PUMP_WAIT); Thread.sleep(sleep); slept += sleep; } }
protected JetspeedBeanDefinitionFilter getBeanDefinitionFilter() throws IOException { String categories = getBeanDefinitionFilterCategories(); return ((categories != null) ? new JetspeedBeanDefinitionFilter(categories) : new JetspeedBeanDefinitionFilter()); }
/** * Sleep for specified interval continuing to pump logging messages for test * program servers. * * @param server0 test program server * @param server1 test program server * @param server2 test program server * @param millis sleep interval * @throws IOException * @throws InterruptedException */ protected void sleep(TestProgram server0, TestProgram server1, TestProgram server2, long millis) throws IOException, InterruptedException { sleep(new TestProgram[]{server0, server1, server2}, millis); }
/** * Sleep for specified interval continuing to pump logging messages for test * program servers. * * @param server0 test program server * @param server1 test program server * @param millis sleep interval * @throws IOException * @throws InterruptedException */ protected void sleep(TestProgram server0, TestProgram server1, long millis) throws IOException, InterruptedException { sleep(new TestProgram[]{server0, server1}, millis); }