<commit_before>package org.sagebionetworks.workflow;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

/**
 * @author deflaux
 * 
 */
public class ScriptProcessorTest {

	static WorkflowTemplatedConfiguration config;

	/**
	 * 
	 */
	@BeforeClass
	public static void setUpClass() {
		config = new WorkflowTemplatedConfigurationImpl();
		config.reloadConfiguration();
	}
	
	/**
	 * @throws Exception
	 */
	@Test
	public void testShellScript() throws Exception {
		ScriptResult scriptResult = ScriptProcessor.runScript(config,
				"./src/test/resources/stdoutKeepAlive.sh", null);
		assertNotNull(scriptResult);
		assertTrue(0 <= scriptResult.getStdout().indexOf("I am doing real work"));
		assertTrue(0 <= scriptResult.getStderr().indexOf("Can't locate object method \"bad\" via package \"syntax\""));
	}

	/**
	 * @throws Exception
	 */
	@Ignore // these don't work on bamboo right now
	@Test
	public void testRScriptThatSucceeds() throws Exception {
		ScriptResult scriptResult = ScriptProcessor.runScript(config,
				"./src/test/resources/simpleScriptThatSucceeds.r", null);
		assertNotNull(scriptResult);
		assertTrue(0 <= scriptResult.getStdout().indexOf("Hello World! This should succeed."));
		assertTrue(0 <= scriptResult.getStderr().indexOf("and here's some stderr"));
	}

	/**
	 * @throws Exception
	 */
	@Ignore // these don't work on bamboo right now
	@Test(expected=UnrecoverableException.class)
	public void testRScriptThatFails() throws Exception {
		ScriptProcessor.runScript(config,
				"./src/test/resources/simpleScriptThatFails.r", null);
	}
	
}<commit_msg>reenabling tests PLFM-1048 "get rscript tests working on bamboo"<commit_after>package org.sagebionetworks.workflow;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.junit.BeforeClass;
import org.junit.Test;

/**
 * @author deflaux
 * 
 */
public class ScriptProcessorTest {

	static WorkflowTemplatedConfiguration config;

	/**
	 * 
	 */
	@BeforeClass
	public static void setUpClass() {
		config = new WorkflowTemplatedConfigurationImpl();
		config.reloadConfiguration();
	}
	
	/**
	 * @throws Exception
	 */
	@Test
	public void testShellScript() throws Exception {
		ScriptResult scriptResult = ScriptProcessor.runScript(config,
				"./src/test/resources/stdoutKeepAlive.sh", null);
		assertNotNull(scriptResult);
		assertTrue(0 <= scriptResult.getStdout().indexOf("I am doing real work"));
		assertTrue(0 <= scriptResult.getStderr().indexOf("Can't locate object method \"bad\" via package \"syntax\""));
	}

	/**
	 * @throws Exception
	 */
	@Test
	public void testRScriptThatSucceeds() throws Exception {
		ScriptResult scriptResult = ScriptProcessor.runScript(config,
				"./src/test/resources/simpleScriptThatSucceeds.r", null);
		assertNotNull(scriptResult);
		assertTrue(0 <= scriptResult.getStdout().indexOf("Hello World! This should succeed."));
		assertTrue(0 <= scriptResult.getStderr().indexOf("and here's some stderr"));
	}

	/**
	 * @throws Exception
	 */
	@Test(expected=UnrecoverableException.class)
	public void testRScriptThatFails() throws Exception {
		ScriptProcessor.runScript(config,
				"./src/test/resources/simpleScriptThatFails.r", null);
	}
	
}
{'fraction_non_alphanumeric': 0.12710843373493977, 'fraction_numerical': 0.0036144578313253013, 'mean_word_length': 4.805944055944056, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2147869', 'n_tokens_mistral': 1056, 'n_tokens_neox': 975, 'n_words': 214}