diff options
Diffstat (limited to 'rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp')
7 files changed, 0 insertions, 1336 deletions
diff --git a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/JAXBTestsPlugin.java b/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/JAXBTestsPlugin.java deleted file mode 100644 index cab2d150c..000000000 --- a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/JAXBTestsPlugin.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 University of Illinois All rights reserved. This program - * and the accompanying materials are made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Albert L. Rossi - design and implementation - ******************************************************************************/ -package org.eclipse.ptp.rm.jaxb.tests; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; - -import org.eclipse.core.resources.ISaveContext; -import org.eclipse.core.resources.ISaveParticipant; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.ptp.core.Preferences; -import org.eclipse.ptp.rm.core.RMCorePlugin; -import org.eclipse.ptp.rm.jaxb.core.JAXBRMConstants; -import org.eclipse.ptp.rm.jaxb.core.messages.Messages; -import org.eclipse.ptp.rm.jaxb.core.utils.JAXBInitializationUtils; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.xml.sax.SAXException; - -public class JAXBTestsPlugin extends Plugin { - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.ptp.rm.jaxb.tests"; //$NON-NLS-1$ - - // The shared instance - private static JAXBTestsPlugin fPlugin; - - /** - * The constructor - */ - public JAXBTestsPlugin() { - fPlugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - ResourcesPlugin.getWorkspace().addSaveParticipant(getUniqueIdentifier(), new ISaveParticipant() { - public void doneSaving(ISaveContext saveContext) { - // Nothing - } - - public void prepareToSave(ISaveContext saveContext) throws CoreException { - // Nothing - } - - public void rollback(ISaveContext saveContext) { - // Nothing - } - - public void saving(ISaveContext saveContext) throws CoreException { - Preferences.savePreferences(getUniqueIdentifier()); - } - }); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - try { - Preferences.savePreferences(getUniqueIdentifier()); - ResourcesPlugin.getWorkspace().removeSaveParticipant(getUniqueIdentifier()); - } finally { - super.stop(context); - fPlugin = null; - } - } - - /** - * Raise core exception. - * - * @param message - * @return - */ - public static CoreException coreErrorException(String message) { - return new CoreException(new Status(IStatus.ERROR, RMCorePlugin.getDefault().getBundle().getSymbolicName(), message)); - } - - /** - * Raise core exception. - * - * @param message - * @param t - * @return - */ - public static CoreException coreErrorException(String message, Throwable t) { - return new CoreException(new Status(IStatus.ERROR, RMCorePlugin.getDefault().getBundle().getSymbolicName(), message, t)); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static JAXBTestsPlugin getDefault() { - return fPlugin; - } - - public static JAXBTestsPlugin getfPlugin() { - return fPlugin; - } - - public static URL getResource(String resource) throws IOException { - URL url = null; - if (getDefault() != null) { - Bundle bundle = getDefault().getBundle(); - url = FileLocator.find(bundle, new Path(JAXBRMConstants.PATH_SEP + resource), null); - } else { - url = new File(resource).toURL(); - } - return url; - } - - /** - * Generate a unique identifier - * - * @return unique identifier string - */ - public static String getUniqueIdentifier() { - if (getDefault() == null) { - return PLUGIN_ID; - } - return getDefault().getBundle().getSymbolicName(); - } - - public static URL getURL(String name) throws IOException { - URL instance = JAXBTestsPlugin.getResource(name); - if (instance == null) { - File f = new File(name); - if (f.exists() && f.isFile()) { - instance = f.toURL(); - } else { - throw new FileNotFoundException(name); - } - } - return instance; - } - - /** - * Create log entry from an IStatus - * - * @param status - */ - public static void log(IStatus status) { - getDefault().getLog().log(status); - } - - /** - * Create log entry from a string - * - * @param msg - */ - public static void log(String msg) { - log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, msg, null)); - } - - /** - * Create log entry from a Throwable - * - * @param e - */ - public static void log(Throwable e) { - log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, Messages.JAXBCorePlugin_Exception_InternalError, e)); - } - - public static void validate(String xml) throws SAXException, IOException, URISyntaxException { - JAXBInitializationUtils.validate(getURL(xml)); - } -} diff --git a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/ManagedFilesTest.java b/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/ManagedFilesTest.java deleted file mode 100644 index a0130f159..000000000 --- a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/ManagedFilesTest.java +++ /dev/null @@ -1,180 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 University of Illinois All rights reserved. This program - * and the accompanying materials are made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Albert L. Rossi - design and implementation - ******************************************************************************/ - -package org.eclipse.ptp.rm.jaxb.tests; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import junit.framework.TestCase; - -import org.eclipse.ptp.remote.core.RemoteServicesDelegate; -import org.eclipse.ptp.rm.jaxb.core.JAXBRMConstants; -import org.eclipse.ptp.rm.jaxb.core.data.AttributeType; -import org.eclipse.ptp.rm.jaxb.core.data.ControlType; -import org.eclipse.ptp.rm.jaxb.core.data.ManagedFileType; -import org.eclipse.ptp.rm.jaxb.core.data.ManagedFilesType; -import org.eclipse.ptp.rm.jaxb.core.data.PropertyType; -import org.eclipse.ptp.rm.jaxb.core.data.ResourceManagerData; -import org.eclipse.ptp.rm.jaxb.core.data.ScriptType; -import org.eclipse.ptp.rm.jaxb.core.runnable.ManagedFilesJob; -import org.eclipse.ptp.rm.jaxb.core.runnable.ScriptHandler; -import org.eclipse.ptp.rm.jaxb.core.utils.JAXBInitializationUtils; -import org.eclipse.ptp.rm.jaxb.core.variables.RMVariableMap; - -public class ManagedFilesTest extends TestCase { - - private static final String xml = JAXBRMConstants.DATA + "test-pbs.xml"; //$NON-NLS-1$ - private static ControlType controlData; - private static Map<String, Object> env; - private static Map<String, String> live; - private static boolean verbose = false; - - private RemoteServicesDelegate delegate; - private RMVariableMap rmVarMap; - - @Override - public void setUp() { - try { - JAXBTestsPlugin.validate(xml); - ResourceManagerData rmdata = JAXBInitializationUtils.initializeRMData(JAXBTestsPlugin.getURL(xml)); - controlData = rmdata.getControlData(); - rmVarMap = new RMVariableMap(); - JAXBInitializationUtils.initializeMap(rmdata, rmVarMap); - env = rmVarMap.getVariables(); - live = new HashMap<String, String>(); - live.put("FOO_VAR_1", "FOO_VALUE_1"); //$NON-NLS-1$ //$NON-NLS-2$ - live.put("FOO_VAR_2", "FOO_VALUE_2"); //$NON-NLS-1$ //$NON-NLS-2$ - live.put("FOO_VAR_3", "FOO_VALUE_3"); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (Throwable t) { - t.printStackTrace(); - assertNotNull(t); - } - setTestValues(); - if (getName().equals("testManagedFiles")) {//$NON-NLS-1$ - initializeConnections(); - } - } - - @Override - public void tearDown() { - controlData = null; - } - - public void testManagedFiles() { - composeScript(); - if (verbose) { - PropertyType contents = (PropertyType) env.get(JAXBRMConstants.SCRIPT); - if (contents != null) { - System.out.println(contents.getValue()); - } - } - ManagedFilesType files = controlData.getManagedFiles(); - files = maybeAddManagedFileForScript(files); - assertNotNull(files); - try { - ManagedFilesJob job = new ManagedFilesJob(null, files, delegate, rmVarMap); - job.schedule(); - try { - job.join(); - } catch (InterruptedException t) { - t.printStackTrace(); - } - } catch (Throwable t) { - t.printStackTrace(); - assertNotNull(t); - } - } - - private void composeScript() { - ScriptType script = controlData.getScript(); - assertNotNull(script); - ScriptHandler job = new ScriptHandler(null, script, rmVarMap, live); - job.schedule(); - try { - job.join(); - } catch (InterruptedException t) { - t.printStackTrace(); - } - - PropertyType contents = (PropertyType) env.get(JAXBRMConstants.SCRIPT); - assertNotNull(contents); - } - - private void initializeConnections() { - delegate = new RemoteServicesDelegate(null, null); - } - - private ManagedFilesType maybeAddManagedFileForScript(ManagedFilesType files) { - PropertyType scriptVar = (PropertyType) rmVarMap.get(JAXBRMConstants.SCRIPT); - PropertyType scriptPathVar = (PropertyType) rmVarMap.get(JAXBRMConstants.SCRIPT_PATH); - if (scriptVar != null || scriptPathVar != null) { - if (files == null) { - files = new ManagedFilesType(); - files.setFileStagingLocation(JAXBRMConstants.ECLIPSESETTINGS); - } - List<ManagedFileType> fileList = files.getFile(); - ManagedFileType scriptFile = null; - if (!fileList.isEmpty()) { - for (ManagedFileType f : fileList) { - if (f.getName().equals(JAXBRMConstants.SCRIPT_FILE)) { - scriptFile = f; - break; - } - } - } - if (scriptFile == null) { - scriptFile = new ManagedFileType(); - scriptFile.setName(JAXBRMConstants.SCRIPT_FILE); - fileList.add(scriptFile); - } - scriptFile.setResolveContents(false); - scriptFile.setUniqueIdPrefix(true); - if (scriptPathVar != null) { - scriptFile.setPath(String.valueOf(scriptPathVar.getValue())); - scriptFile.setDeleteAfterUse(false); - } else { - scriptFile.setContents(JAXBRMConstants.OPENVRM + JAXBRMConstants.SCRIPT + JAXBRMConstants.PD - + JAXBRMConstants.VALUE + JAXBRMConstants.CLOSV); - scriptFile.setDeleteAfterUse(true); - } - } - return files; - } - - private void putValue(String name, String value) { - PropertyType p = new PropertyType(); - p.setName(name); - p.setValue(value); - env.put(name, p); - } - - private void setTestValues() { - for (String key : env.keySet()) { - Object target = env.get(key); - String value = key + "_TEST_VALUE"; //$NON-NLS-1$ - if (target instanceof PropertyType) { - ((PropertyType) target).setValue(value); - } else if (target instanceof AttributeType) { - ((AttributeType) target).setValue(value); - } - } - putValue(JAXBRMConstants.CONTROL_USER_VAR, "fooUser"); //$NON-NLS-1$ - putValue(JAXBRMConstants.CONTROL_ADDRESS_VAR, "abe.ncsa.uiuc.edu"); //$NON-NLS-1$ - putValue(JAXBRMConstants.DIRECTORY, "/u/ncsa/arossi/test"); //$NON-NLS-1$ - putValue(JAXBRMConstants.MPI_CMD, "mpiexec"); //$NON-NLS-1$ - putValue(JAXBRMConstants.MPI_ARGS, "-np 8"); //$NON-NLS-1$ - putValue(JAXBRMConstants.EXEC_PATH, "/u/ncsa/arossi/test/foo"); //$NON-NLS-1$ - if (verbose) { - RMDataTest.print(rmVarMap); - } - } -} diff --git a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/Messages.java b/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/Messages.java deleted file mode 100644 index a1864e348..000000000 --- a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/Messages.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 University of Illinois All rights reserved. This program - * and the accompanying materials are made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Albert L. Rossi - design and implementation - ******************************************************************************/ - -package org.eclipse.ptp.rm.jaxb.tests; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.ptp.rm.jaxb.tests.messages"; //$NON-NLS-1$ - public static String RMVariableTest_1; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/RMDataTest.java b/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/RMDataTest.java deleted file mode 100644 index d9d4b3ee4..000000000 --- a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/RMDataTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 University of Illinois All rights reserved. This program - * and the accompanying materials are made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Albert L. Rossi - design and implementation - ******************************************************************************/ - -package org.eclipse.ptp.rm.jaxb.tests; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import junit.framework.TestCase; - -import org.eclipse.ptp.rm.jaxb.core.JAXBRMConstants; -import org.eclipse.ptp.rm.jaxb.core.data.AttributeType; -import org.eclipse.ptp.rm.jaxb.core.data.CommandType; -import org.eclipse.ptp.rm.jaxb.core.data.PropertyType; -import org.eclipse.ptp.rm.jaxb.core.data.ResourceManagerData; -import org.eclipse.ptp.rm.jaxb.core.utils.JAXBInitializationUtils; -import org.eclipse.ptp.rm.jaxb.core.variables.RMVariableMap; - -public class RMDataTest extends TestCase { - - private static final String rmxml = JAXBRMConstants.DATA + "test-pbs.xml"; //$NON-NLS-1$ - private static final String tokxml = JAXBRMConstants.DATA + "tokenizer-examples.xml"; //$NON-NLS-1$ - - @Override - public void setUp() { - - } - - @Override - public void tearDown() { - - } - - public void testJAXBRMInstantiation() { - ResourceManagerData rmdata = null; - try { - JAXBTestsPlugin.validate(rmxml); - rmdata = JAXBInitializationUtils.initializeRMData(JAXBTestsPlugin.getURL(rmxml)); - if (rmdata != null) { - RMVariableMap map = new RMVariableMap(); - JAXBInitializationUtils.initializeMap(rmdata, map); - print(map); - String exp = map.getString(null, "${rm:stagein#description}"); //$NON-NLS-1$ - System.out.println(exp); - assertEquals(Messages.RMVariableTest_1, exp); - } - } catch (Throwable t) { - t.printStackTrace(); - assert (t != null); - } - } - - public void testJAXBTokenizerInstantiation() { - ResourceManagerData rmdata = null; - try { - JAXBTestsPlugin.validate(tokxml); - rmdata = JAXBInitializationUtils.initializeRMData(JAXBTestsPlugin.getURL(tokxml)); - if (rmdata != null) { - List<CommandType> cmds = rmdata.getControlData().getStartUpCommand(); - for (CommandType cmd : cmds) { - System.out.println(cmd.getName()); - } - } - } catch (Throwable t) { - t.printStackTrace(); - assert (t != null); - } - } - - static void print(RMVariableMap map) { - StringBuffer buffer = new StringBuffer(); - for (Iterator<Map.Entry<String, Object>> i = map.getVariables().entrySet().iterator(); i.hasNext();) { - Map.Entry<String, Object> e = i.next(); - Object o = e.getValue(); - if (o instanceof AttributeType) { - AttributeType ja = (AttributeType) o; - buffer.append(JAXBRMConstants.LT).append(ja.getName()).append(JAXBRMConstants.GTLT).append(ja.getType()) - .append(JAXBRMConstants.GTLT).append(ja.getDefault()).append(JAXBRMConstants.GTLT).append(ja.getChoice()) - .append(JAXBRMConstants.GTLT).append(ja.getMax()).append(JAXBRMConstants.GTLT).append(ja.getMin()) - .append(JAXBRMConstants.GTLT).append(ja.getValidator()).append(JAXBRMConstants.GTLT) - .append(ja.getDescription()).append(JAXBRMConstants.GTLT).append(ja.getTooltip()).append(ja.getValue()) - .append(JAXBRMConstants.GT).append(JAXBRMConstants.LINE_SEP); - } else if (o instanceof PropertyType) { - PropertyType p = (PropertyType) o; - buffer.append(JAXBRMConstants.LT).append(p.getName()).append(JAXBRMConstants.GTLT).append(p.getValue()) - .append(JAXBRMConstants.GT).append(JAXBRMConstants.LINE_SEP); - } else { - buffer.append(JAXBRMConstants.LT).append(e.getKey()).append(JAXBRMConstants.GTLT).append(e.getValue()) - .append(JAXBRMConstants.GT).append(JAXBRMConstants.LINE_SEP); - } - } - System.out.println(buffer); - } - -} diff --git a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/RMLaunchTest.java b/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/RMLaunchTest.java deleted file mode 100644 index 9794fb61f..000000000 --- a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/RMLaunchTest.java +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 University of Illinois All rights reserved. This program - * and the accompanying materials are made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Albert L. Rossi - design and implementation - ******************************************************************************/ - -package org.eclipse.ptp.rm.jaxb.tests; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchDelegate; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.IStreamListener; -import org.eclipse.debug.core.model.IStreamMonitor; -import org.eclipse.ptp.core.IPTPLaunchConfigurationConstants; -import org.eclipse.ptp.core.PTPCorePlugin; -import org.eclipse.ptp.remote.core.IRemoteConnection; -import org.eclipse.ptp.remote.core.IRemoteConnectionManager; -import org.eclipse.ptp.remote.core.IRemoteServices; -import org.eclipse.ptp.remote.core.PTPRemoteCorePlugin; -import org.eclipse.ptp.rm.jaxb.core.JAXBRMConstants; -import org.eclipse.ptp.rm.jaxb.core.data.PropertyType; -import org.eclipse.ptp.rm.jaxb.core.rm.JAXBResourceManager; -import org.eclipse.ptp.rm.jaxb.core.rm.JAXBResourceManagerConfiguration; -import org.eclipse.ptp.rm.jaxb.core.rm.JAXBResourceManagerControl; -import org.eclipse.ptp.rm.jaxb.core.rm.JAXBResourceManagerMonitor; -import org.eclipse.ptp.rm.jaxb.core.variables.RMVariableMap; -import org.eclipse.ptp.rmsystem.AbstractResourceManagerConfiguration; -import org.eclipse.ptp.rmsystem.IJobStatus; -import org.eclipse.ptp.rmsystem.ResourceManagerServiceProvider; - -public class RMLaunchTest extends TestCase { - - private class TestLaunchConfiguration implements ILaunchConfiguration { - - private final Map<String, Object> store = new TreeMap<String, Object>(); - - public boolean contentsEqual(ILaunchConfiguration configuration) { - return false; - } - - public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException { - return null; - } - - public void delete() throws CoreException { - } - - public boolean exists() { - return false; - } - - @SuppressWarnings("rawtypes") - public Object getAdapter(Class adapter) { - return null; - } - - public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException { - Boolean value = (Boolean) store.get(attributeName); - if (value == null) { - value = defaultValue; - } - return value; - } - - public int getAttribute(String attributeName, int defaultValue) throws CoreException { - Integer value = (Integer) store.get(attributeName); - if (value == null) { - value = defaultValue; - } - return value; - } - - @SuppressWarnings("rawtypes") - public List getAttribute(String attributeName, List defaultValue) throws CoreException { - List value = (List) store.get(attributeName); - if (value == null) { - value = defaultValue; - } - return value; - } - - @SuppressWarnings("rawtypes") - public Map getAttribute(String attributeName, Map defaultValue) throws CoreException { - Map value = (Map) store.get(attributeName); - if (value == null) { - value = defaultValue; - } - return value; - } - - @SuppressWarnings("rawtypes") - public Set getAttribute(String attributeName, Set defaultValue) throws CoreException { - Set value = (Set) store.get(attributeName); - if (value == null) { - value = defaultValue; - } - return value; - } - - public String getAttribute(String attributeName, String defaultValue) throws CoreException { - String value = (String) store.get(attributeName); - if (value == null) { - value = defaultValue; - } - return value; - } - - @SuppressWarnings("rawtypes") - public Map getAttributes() throws CoreException { - return store; - } - - public String getCategory() throws CoreException { - return null; - } - - public IFile getFile() { - return null; - } - - public IPath getLocation() { - return null; - } - - public IResource[] getMappedResources() throws CoreException { - return null; - } - - public String getMemento() throws CoreException { - return null; - } - - @SuppressWarnings("rawtypes") - public Set getModes() throws CoreException { - return null; - } - - public String getName() { - return null; - } - - @SuppressWarnings("rawtypes") - public ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException { - return null; - } - - public ILaunchConfigurationType getType() throws CoreException { - return null; - } - - public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException { - return null; - } - - public boolean hasAttribute(String attributeName) throws CoreException { - return false; - } - - public boolean isLocal() { - return false; - } - - public boolean isMigrationCandidate() throws CoreException { - return false; - } - - public boolean isReadOnly() { - return false; - } - - public boolean isWorkingCopy() { - return false; - } - - public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException { - return null; - } - - public ILaunch launch(String mode, IProgressMonitor monitor, boolean build) throws CoreException { - return null; - } - - public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException { - return null; - } - - public void migrate() throws CoreException { - - } - - public boolean supportsMode(String mode) throws CoreException { - return false; - } - } - - private static final String xml = JAXBRMConstants.DATA + "test-pbs.xml"; //$NON-NLS-1$ - private JAXBResourceManagerConfiguration rmConfig; - private JAXBResourceManager rm; - private ILaunchConfiguration launchConfig; - - @Override - public void setUp() { - /* - * You will need to copy all the executables in the - * org.eclipse.ptp.rm.jaxb.tests/data directory to you home; it seems - * the JUnit plugin runner does not actually execute in the directory - * indicated by the Run Configuration. - */ - } - - @Override - public void tearDown() { - } - - public void testResourceManager() { - try { - emulateConfigureWizard(); - rm = new JAXBResourceManager(rmConfig, new JAXBResourceManagerControl(rmConfig), new JAXBResourceManagerMonitor( - rmConfig)); - PTPCorePlugin.getDefault().getModelManager().addResourceManager(rm); - rm.start(new NullProgressMonitor()); - try { - Thread.sleep(2000); - } catch (InterruptedException ignored) { - } - emulateLaunchTab(); - String jobId = rm.submitJob(launchConfig, ILaunchManager.RUN_MODE, new NullProgressMonitor()); - System.out.println("SUBMITTED: " + jobId); //$NON-NLS-1$ - IJobStatus status = rm.getJobStatus(jobId); - System.out.println("STATUS: " + status.getState()); //$NON-NLS-1$ - if (status != null) { - status.getStreamsProxy().getOutputStreamMonitor().addListener(new IStreamListener() { - public void streamAppended(String text, IStreamMonitor monitor) { - System.out.println(text); - } - }); - } - rm.stop(); - } catch (Throwable t) { - t.printStackTrace(); - assertNotNull(t); - } - } - - /* - * We do here what is done through the wizard. - */ - private void emulateConfigureWizard() throws Throwable { - rmConfig = new JAXBResourceManagerConfiguration(AbstractResourceManagerConfiguration.BASE, - new ResourceManagerServiceProvider()); - // JAXBRMConfigurationSelectionWizardPage - rmConfig.setRMConfigurationURL(JAXBTestsPlugin.getURL(xml)); - // JAXBRMControlConfigurationWizardPage - rmConfig.getResourceManagerData(); - // use remote = local - IRemoteServices localServices = PTPRemoteCorePlugin.getDefault().getDefaultServices(); - assert (localServices != null); - IRemoteConnectionManager localConnectionManager = localServices.getConnectionManager(); - assert (localConnectionManager != null); - IRemoteConnection localConnection = localConnectionManager.getConnection(JAXBRMConstants.ZEROSTR); - assert (localConnection != null); - rmConfig.setRemoteServicesId(localServices.getId()); - rmConfig.setConnectionName(localConnection.getName()); - } - - @SuppressWarnings("unchecked") - private void emulateLaunchTab() throws Throwable { - launchConfig = new TestLaunchConfiguration(); - Map<Object, Object> env = launchConfig.getAttributes(); - Map<String, String> live = new HashMap<String, String>(); - live.put("FOO_VAR_1", "FOO_VALUE_1"); //$NON-NLS-1$ //$NON-NLS-2$ - live.put("FOO_VAR_2", "FOO_VALUE_2"); //$NON-NLS-1$ //$NON-NLS-2$ - live.put("FOO_VAR_3", "FOO_VALUE_3"); //$NON-NLS-1$ //$NON-NLS-2$ - env.put(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, live); - env.put(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true); - env.put(IPTPLaunchConfigurationConstants.ATTR_WORKING_DIR, "/u/ncsa/arossi/test"); //$NON-NLS-1$ - env.put(IPTPLaunchConfigurationConstants.ATTR_EXECUTABLE_PATH, "/u/ncsa/arossi/test/foo"); //$NON-NLS-1$ - env.put(IPTPLaunchConfigurationConstants.ATTR_ARGUMENTS, "-v -f /u/ncsa/arossi/test/data"); //$NON-NLS-1$ - env.put("Job_Name", "TestRMLaunch"); //$NON-NLS-1$ //$NON-NLS-2$ - env.put("Resource_List.nodes", "1:ppn=8"); //$NON-NLS-1$ //$NON-NLS-2$ - env.put("Resource_List.walltime", "00:10:00"); //$NON-NLS-1$ //$NON-NLS-2$ - env.put("export_all", true); //$NON-NLS-1$ - env.put(JAXBRMConstants.MPI_CMD, "mpiexec"); //$NON-NLS-1$ - env.put(JAXBRMConstants.MPI_ARGS, "-machinefile $PBS_NODEFILE -np 8"); //$NON-NLS-1$ - RMVariableMap rmVarMap = rm.getJAXBConfiguration().getRMVariableMap(); - PropertyType queues = (PropertyType) rmVarMap.getVariables().get("available_queues"); //$NON-NLS-1$ - if (queues != null) { - List<String> q = (List<String>) queues.getValue(); - env.put("destination", q.get(0)); //$NON-NLS-1$ - } - env.put("directory", "/Users/arossi"); //$NON-NLS-1$//$NON-NLS-2$ - } -} diff --git a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/StreamParserTest.java b/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/StreamParserTest.java deleted file mode 100644 index e5e116097..000000000 --- a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/StreamParserTest.java +++ /dev/null @@ -1,518 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 University of Illinois All rights reserved. This program - * and the accompanying materials are made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Albert L. Rossi - design and implementation - ******************************************************************************/ - -package org.eclipse.ptp.rm.jaxb.tests; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import junit.framework.TestCase; - -import org.eclipse.ptp.rm.jaxb.core.IStreamParserTokenizer; -import org.eclipse.ptp.rm.jaxb.core.JAXBRMConstants; -import org.eclipse.ptp.rm.jaxb.core.data.AttributeType; -import org.eclipse.ptp.rm.jaxb.core.data.CommandType; -import org.eclipse.ptp.rm.jaxb.core.data.ControlType; -import org.eclipse.ptp.rm.jaxb.core.data.PropertyType; -import org.eclipse.ptp.rm.jaxb.core.data.ResourceManagerData; -import org.eclipse.ptp.rm.jaxb.core.data.TokenizerType; -import org.eclipse.ptp.rm.jaxb.core.runnable.command.ConfigurableRegexTokenizer; -import org.eclipse.ptp.rm.jaxb.core.utils.JAXBInitializationUtils; -import org.eclipse.ptp.rm.jaxb.core.variables.RMVariableMap; - -public class StreamParserTest extends TestCase { - - protected class Range { - - private final String expression; - private int[] from; - private int[] to; - private int len; - - public Range(String expression) { - assert (null != rmVarMap); - this.expression = rmVarMap.getString(uuid, expression); - } - - public List<Object> findInRange(String[] values) { - List<Object> found = new ArrayList<Object>(); - for (int i = 0; i < from.length; i++) { - if (from[i] == to[i]) { - found.add(values[from[i]]); - } else { - for (int j = from[i]; j < to[i]; j++) { - found.add(values[j]); - } - } - } - return found; - } - - public boolean isInRange(int line) { - for (int i = 0; i < from.length; i++) { - if ((from[i] == line && line <= to[i]) || (from[i] < line && line < to[i])) { - return true; - } - } - return false; - } - - public void setLen(int len) { - this.len = len; - parse(expression); - } - - private int maybeInterpretLength(String n) { - int i = -1; - if (n.indexOf(JAXBRMConstants.LEN) >= 0) { - String[] lenExp = n.split(JAXBRMConstants.HYPH); - if (lenExp.length == 2) { - i = len - Integer.parseInt(lenExp[1]); - } else { - i = len; - } - } else { - i = Integer.parseInt(n.trim()); - } - return i; - } - - private void parse(String expression) { - List<String> from = new ArrayList<String>(); - List<String> to = new ArrayList<String>(); - String[] commas = expression.split(JAXBRMConstants.CM); - for (int i = 0; i < commas.length; i++) { - String[] colon = commas[i].split(JAXBRMConstants.CO); - if (colon.length == 2) { - from.add(colon[0]); - to.add(colon[1]); - } else { - from.add(colon[0]); - to.add(colon[0]); - } - } - - this.from = new int[from.size()]; - this.to = new int[from.size()]; - - for (int i = 0; i < this.from.length; i++) { - this.from[i] = maybeInterpretLength(from.get(i).trim()); - this.to[i] = maybeInterpretLength(to.get(i).trim()); - } - } - } - - private static final String tokxml = JAXBRMConstants.DATA + "tokenizer-examples.xml"; //$NON-NLS-1$ - - private String uuid; - private String lineRange; - private boolean[] oracle; - private String[] values; - private final boolean verbose = true; - private String target; - private List<CommandType> startup; - private CommandType getStatus; - private RMVariableMap rmVarMap; - - @Override - public void setUp() { - rmVarMap = new RMVariableMap(); - String name = getName(); - if (name.equals("testRange")) { //$NON-NLS-1$ - // the second number is <, not <= - lineRange = "3,8,12:15,21, 24:29,40:N-3"; //$NON-NLS-1$ - oracle = new boolean[] { false, false, false, true, false, false, false, false, true, false, false, false, true, true, - true, false, false, false, false, false, false, true, false, false, true, true, true, true, true, false, false, - false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, false, - false, false }; - values = new String[oracle.length]; - } else { - try { - JAXBTestsPlugin.validate(tokxml); - ResourceManagerData rmdata = JAXBInitializationUtils.initializeRMData(JAXBTestsPlugin.getURL(tokxml)); - if (rmdata != null) { - ControlType cd = rmdata.getControlData(); - startup = cd.getStartUpCommand(); - getStatus = cd.getGetJobStatus(); - } - } catch (Throwable t) { - t.printStackTrace(); - assert (t != null); - } - } - } - - @Override - public void tearDown() { - - } - - public void test00ParseQstat() { - target = "available_queues"; //$NON-NLS-1$ - PropertyType p = new PropertyType(); - p.setName(target); - rmVarMap.getVariables().put(target, p); - runTokenizer(startup.get(0).getStdoutParser(), getQstatOut()); - p = (PropertyType) rmVarMap.getVariables().get(target); - assertNotNull(p); - assertNotNull(p.getValue()); - if (verbose) { - System.out.println(target + " = " + p.getValue()); //$NON-NLS-1$ - } - } - - public void test01JobId() { - uuid = UUID.randomUUID().toString(); - target = uuid; - PropertyType p = new PropertyType(); - p.setName(target); - p.setValue(target); - rmVarMap.getVariables().put(target, p); - runTokenizer(startup.get(1).getStdoutParser(), getNoiseBeforeJobId()); - p = (PropertyType) rmVarMap.getVariables().get(target); - assertNotNull(p); - assertNotNull(p.getValue()); - if (verbose) { - System.out.println(target + " = " + p.getValue()); //$NON-NLS-1$ - } - } - - public void test02OpenMPI() { - target = JAXBRMConstants.ATTRIBUTE; - runTokenizer(startup.get(2).getStdoutParser(), getOpenMPIOut()); - Map<String, Object> d = rmVarMap.getDiscovered(); - for (Object o : d.values()) { - AttributeType ja = (AttributeType) o; - if (verbose) { - System.out.println("DISCOVERED JAXBRMConstants.ATTRIBUTE:"); //$NON-NLS-1$ - System.out.println("name " + ja.getName()); //$NON-NLS-1$ - System.out.println("value " + ja.getValue()); //$NON-NLS-1$ - System.out.println("tooltip " + ja.getTooltip()); //$NON-NLS-1$ - System.out.println("status " + ja.getStatus()); //$NON-NLS-1$ - System.out.println("readOnly " + ja.isReadOnly()); //$NON-NLS-1$ - System.out.println("*********************************"); //$NON-NLS-1$ - } - } - } - - public void test03ImplicitWithTags() { - runTokenizer(startup.get(3).getStdoutParser(), getImplicitWithTags()); - Map<String, Object> d = rmVarMap.getDiscovered(); - for (Object o : d.values()) { - if (o instanceof PropertyType) { - PropertyType p = (PropertyType) o; - if (verbose) { - System.out.println("DISCOVERED JAXBRMConstants.PROPERTY:"); //$NON-NLS-1$ - System.out.println("name " + p.getName()); //$NON-NLS-1$ - System.out.println("value " + p.getValue()); //$NON-NLS-1$ - System.out.println("*********************************"); //$NON-NLS-1$ - } - } else if (o instanceof AttributeType) { - AttributeType ja = (AttributeType) o; - if (verbose) { - System.out.println("DISCOVERED JAXBRMConstants.ATTRIBUTE:"); //$NON-NLS-1$ - System.out.println("name " + ja.getName()); //$NON-NLS-1$ - System.out.println("value " + ja.getValue()); //$NON-NLS-1$ - System.out.println("*********************************"); //$NON-NLS-1$ - } - } - } - } - - public void test04ImplicitOrdering() { - target = JAXBRMConstants.ATTRIBUTE; - runTokenizer(startup.get(4).getStdoutParser(), getImplicitOrdering()); - Map<String, Object> d = rmVarMap.getDiscovered(); - for (Object o : d.values()) { - AttributeType ja = (AttributeType) o; - if (verbose) { - System.out.println("DISCOVERED JAXBRMConstants.ATTRIBUTE:"); //$NON-NLS-1$ - System.out.println("name " + ja.getName()); //$NON-NLS-1$ - System.out.println("type " + ja.getType()); //$NON-NLS-1$ - System.out.println("tooltip " + ja.getTooltip()); //$NON-NLS-1$ - System.out.println("description " + ja.getDescription()); //$NON-NLS-1$ - System.out.println("value " + ja.getValue()); //$NON-NLS-1$ - System.out.println("*********************************"); //$NON-NLS-1$ - } - } - } - - public void test05ImplicitWithTagsDotall() { - runTokenizer(startup.get(5).getStdoutParser(), getImplicitWithTags()); - Map<String, Object> d = rmVarMap.getDiscovered(); - for (Object o : d.values()) { - if (o instanceof PropertyType) { - PropertyType p = (PropertyType) o; - if (verbose) { - System.out.println("DISCOVERED JAXBRMConstants.PROPERTY:"); //$NON-NLS-1$ - System.out.println("name " + p.getName()); //$NON-NLS-1$ - System.out.println("value " + p.getValue()); //$NON-NLS-1$ - System.out.println("*********************************"); //$NON-NLS-1$ - } - } else if (o instanceof AttributeType) { - AttributeType ja = (AttributeType) o; - if (verbose) { - System.out.println("DISCOVERED JAXBRMConstants.ATTRIBUTE:"); //$NON-NLS-1$ - System.out.println("name " + ja.getName()); //$NON-NLS-1$ - System.out.println("value " + ja.getValue()); //$NON-NLS-1$ - System.out.println("*********************************"); //$NON-NLS-1$ - } - } - } - } - - public void test06PropertyDefsSingleLine() { - target = JAXBRMConstants.PROPERTY; - runTokenizer(startup.get(6).getStdoutParser(), getPropertyDefs()); - Map<String, Object> d = rmVarMap.getDiscovered(); - for (Object o : d.values()) { - PropertyType p = (PropertyType) o; - if (verbose) { - System.out.println("DISCOVERED JAXBRMConstants.PROPERTY:"); //$NON-NLS-1$ - System.out.println("name " + p.getName()); //$NON-NLS-1$ - System.out.println("value " + p.getValue()); //$NON-NLS-1$ - System.out.println("*********************************"); //$NON-NLS-1$ - } - } - } - - public void test07JobStates() { - target = "jobStates"; //$NON-NLS-1$ - PropertyType p = new PropertyType(); - p.setName(target); - rmVarMap.getVariables().put(target, p); - runTokenizer(startup.get(7).getStdoutParser(), getJobStates()); - p = (PropertyType) rmVarMap.getVariables().get(target); - assertNotNull(p); - assertNotNull(p.getValue()); - if (verbose) { - System.out.println(target + " = " + p.getValue()); //$NON-NLS-1$ - } - } - - public void test08Staggered() { - runTokenizer(startup.get(8).getStdoutParser(), getStaggered()); - Map<String, Object> d = rmVarMap.getDiscovered(); - for (Object o : d.values()) { - if (o instanceof PropertyType) { - PropertyType p = (PropertyType) o; - if (verbose) { - System.out.println("DISCOVERED JAXBRMConstants.PROPERTY:"); //$NON-NLS-1$ - System.out.println("name " + p.getName()); //$NON-NLS-1$ - System.out.println("value " + p.getValue()); //$NON-NLS-1$ - System.out.println("*********************************"); //$NON-NLS-1$ - } - } else if (o instanceof AttributeType) { - AttributeType ja = (AttributeType) o; - if (verbose) { - System.out.println("DISCOVERED JAXBRMConstants.ATTRIBUTE:"); //$NON-NLS-1$ - System.out.println("name " + ja.getName()); //$NON-NLS-1$ - System.out.println("value " + ja.getValue()); //$NON-NLS-1$ - System.out.println("*********************************"); //$NON-NLS-1$ - } - } - } - } - - public void test09Merged() { - target = JAXBRMConstants.PROPERTY; - runTokenizer(startup.get(9).getStdoutParser(), getMergedOrdering()); - Map<String, Object> d = rmVarMap.getDiscovered(); - for (Object o : d.values()) { - PropertyType p = (PropertyType) o; - if (verbose) { - System.out.println("DISCOVERED JAXBRMConstants.PROPERTY:"); //$NON-NLS-1$ - System.out.println("name " + p.getName()); //$NON-NLS-1$ - System.out.println("value " + p.getValue()); //$NON-NLS-1$ - System.out.println("default " + p.getDefault()); //$NON-NLS-1$ - System.out.println("*********************************"); //$NON-NLS-1$ - } - } - } - - public void test10ExitOn() { - target = "jobStates"; //$NON-NLS-1$ - PropertyType p = new PropertyType(); - p.setName(target); - rmVarMap.getVariables().put(target, p); - runTokenizer(startup.get(10).getStdoutParser(), getJobStates()); - p = (PropertyType) rmVarMap.getVariables().get(target); - assertNotNull(p); - assertNotNull(p.getValue()); - if (verbose) { - System.out.println(target + " = " + p.getValue()); //$NON-NLS-1$ - } - } - - public void test11ExitAfter() { - target = "jobStates"; //$NON-NLS-1$ - PropertyType p = new PropertyType(); - p.setName(target); - rmVarMap.getVariables().put(target, p); - runTokenizer(startup.get(11).getStdoutParser(), getJobStates()); - p = (PropertyType) rmVarMap.getVariables().get(target); - assertNotNull(p); - assertNotNull(p.getValue()); - if (verbose) { - System.out.println(target + " = " + p.getValue()); //$NON-NLS-1$ - } - } - - public void test12GetStatus() { - target = "42226";//$NON-NLS-1$ - uuid = target; - PropertyType p = new PropertyType(); - p.setName(target); - rmVarMap.getVariables().put(target, p); - runTokenizer(getStatus.getStdoutParser(), getQstat()); - p = (PropertyType) rmVarMap.getVariables().get(this.target); - assertNotNull(p); - System.out.println(p.getName() + JAXBRMConstants.CM + JAXBRMConstants.SP + p.getValue()); - } - - public void testRange() { - Range range = new Range(lineRange); - range.setLen(50); - int trues = 0; - - for (int i = 0; i < 50; i++) { - boolean b = range.isInRange(i); - if (oracle[i]) { - trues++; - } - if (verbose) { - System.out.println(" line " + i + " in range: " + b + ", should be " + oracle[i]); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - assertEquals(oracle[i], b); - values[i] = "" + oracle[i]; //$NON-NLS-1$ - } - - List<Object> valid = range.findInRange(values); - for (Object o : valid) { - assertEquals("true", o); //$NON-NLS-1$ - assertEquals(trues, valid.size()); - } - } - - private void runTokenizer(TokenizerType tokenizer, InputStream stream) { - IStreamParserTokenizer t = new ConfigurableRegexTokenizer(uuid, tokenizer, rmVarMap); - t.setInputStream(stream); - Thread thr = new Thread(t); - thr.start(); - try { - thr.join(); - } catch (InterruptedException ignored) { - } - Throwable throwable = t.getInternalError(); - if (throwable != null) { - throwable.printStackTrace(); - } - assertNull(throwable); - } - - private static InputStream getImplicitOrdering() { - String content = "jobAttribute_1" + JAXBRMConstants.LINE_SEP + "java.lang.String" + JAXBRMConstants.LINE_SEP + JAXBRMConstants.LINE_SEP + JAXBRMConstants.LINE_SEP + "value_1" + JAXBRMConstants.LINE_SEP //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + "jobAttribute_2" + JAXBRMConstants.LINE_SEP + "java.lang.String" + JAXBRMConstants.LINE_SEP + "meaingless attribute" + JAXBRMConstants.LINE_SEP //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + "ignore this attribute" + JAXBRMConstants.LINE_SEP + "value_2" //$NON-NLS-1$ //$NON-NLS-2$ - + JAXBRMConstants.LINE_SEP; - return new ByteArrayInputStream(content.getBytes()); - } - - private static InputStream getImplicitWithTags() { - String content = "JAXBRMConstants.PROPERTY" + JAXBRMConstants.LINE_SEP + "value:423.4" + JAXBRMConstants.LINE_SEP + "name:x" + JAXBRMConstants.LINE_SEP + "JAXBRMConstants.ATTRIBUTE" + JAXBRMConstants.LINE_SEP + "name:y" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - + JAXBRMConstants.LINE_SEP - + "value:-130.42" + JAXBRMConstants.LINE_SEP + "JAXBRMConstants.PROPERTY" + JAXBRMConstants.LINE_SEP + "name:z" + JAXBRMConstants.LINE_SEP + "value:-1.7" + JAXBRMConstants.LINE_SEP; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - return new ByteArrayInputStream(content.getBytes()); - } - - private static InputStream getJobStates() { - String content = "blah blah xxxx blah blah xxxx blah blah xxxx blah blah xx" //$NON-NLS-1$ - + "<job>304823:RUNNING</job>fooblah blah xxxx\n blah blah xxxx blah blah xxxx blah " //$NON-NLS-1$ - + " blah x\nx<job>312042:DONE</job>blah xxxx blah blah xxxx blah b" //$NON-NLS-1$ - + "blah blah xxxx foobarfoobr 231028388 <job>338831:SUJAXBRMConstants.SPENDED" //$NON-NLS-1$ - + "</job>fooroiqEXIT\npoiewmr<job>318388:QUEUED</job>blah blah xxxx"; //$NON-NLS-1$ - return new ByteArrayInputStream(content.getBytes()); - } - - private static InputStream getMergedOrdering() { - String content = "name:foo0;value:bar0" + JAXBRMConstants.LINE_SEP + "name:foo1;value:bar1" + JAXBRMConstants.LINE_SEP + "name:foo0;default:baz0" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + JAXBRMConstants.LINE_SEP; - return new ByteArrayInputStream(content.getBytes()); - } - - private static InputStream getNoiseBeforeJobId() { - String content = "abe and lincoln will be down for 3 hours Saturday May 14, 2013 from 00:00:00 to 03:00:00" + JAXBRMConstants.LINE_SEP //$NON-NLS-1$ - + "There is currently no way to know what your shell is. Please look in /etc/passwd" + JAXBRMConstants.LINE_SEP //$NON-NLS-1$ - + "To get your default account, click your heels three times and say, 'There's no place like home!'" + JAXBRMConstants.LINE_SEP //$NON-NLS-1$ - + "429324.honest1" + JAXBRMConstants.LINE_SEP; //$NON-NLS-1$ - return new ByteArrayInputStream(content.getBytes()); - } - - private static InputStream getOpenMPIOut() { - String content = "mca:mca:base:param:mca_component_disable_dlopen:status:writable" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mca:base:param:mca_component_disable_dlopen:help:Whether to attempt to disable opening dynamic components or not" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mca:base:param:mca_component_disable_dlopen:deprecated:no" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mpi:base:param:mpi_param_check:value:1" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mpi:base:param:mpi_param_check:data_source:default value" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mpi:base:param:mpi_param_check:status:read-only" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mpi:base:param:mpi_param_check:help:Whether you want MPI API parameters checked at run-time or not. Possible values are 0 (no checking) and 1 (perform checking at run-time)" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mpi:base:param:mpi_param_check:deprecated:no" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mpi:base:param:mpi_yield_when_idle:value:-1" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mpi:base:param:mpi_yield_when_idle:data_source:default value" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mpi:base:param:mpi_yield_when_idle:status:writable" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP - + "mca:mpi:base:param:mpi_yield_when_idle:help:Yield the processor when waiting for MPI communication (for MPI processes, will default to 1 when oversubscribing nodes)" //$NON-NLS-1$ - + JAXBRMConstants.LINE_SEP + "mca:mpi:base:param:mpi_yield_when_idle:deprecated:no" + JAXBRMConstants.LINE_SEP //$NON-NLS-1$ - + "mca:mpi:base:param:mpi_event_tick_rate:value:-1" + JAXBRMConstants.LINE_SEP; //$NON-NLS-1$ - return new ByteArrayInputStream(content.getBytes()); - } - - private static InputStream getPropertyDefs() { - String content = "<name>pnameA</name><value>pvalueA</value>" + JAXBRMConstants.LINE_SEP + "<name>pnameB</name><value>pvalueB</value>" //$NON-NLS-1$ //$NON-NLS-2$ - + JAXBRMConstants.LINE_SEP - + "<name>pnameC</name><value>pvalueC</value>" + JAXBRMConstants.LINE_SEP + "<name>pnameD</name><value>pvalueD</value>" //$NON-NLS-1$ //$NON-NLS-2$ - + JAXBRMConstants.LINE_SEP + "<value>pvalueW</value><name>pnameW</name>" + JAXBRMConstants.LINE_SEP; //$NON-NLS-1$ - return new ByteArrayInputStream(content.getBytes()); - } - - private static InputStream getQstat() { - String content = "42226.ember g_zn_ph2 enoey 665:51:4 R normal \n";//$NON-NLS-1$ - return new ByteArrayInputStream(content.getBytes()); - } - - private static InputStream getQstatOut() { - String content = "normal" + JAXBRMConstants.LINE_SEP + "iacat2" + JAXBRMConstants.LINE_SEP + "indprio" + JAXBRMConstants.LINE_SEP + "lincoln_nomss" + JAXBRMConstants.LINE_SEP + "cap1" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - + JAXBRMConstants.LINE_SEP - + "lincoln_debug" + JAXBRMConstants.LINE_SEP + "long" + JAXBRMConstants.LINE_SEP + "iacat" + JAXBRMConstants.LINE_SEP + "industrial" + JAXBRMConstants.LINE_SEP //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - + "lincoln" + JAXBRMConstants.LINE_SEP + "wide" + JAXBRMConstants.LINE_SEP + "nomss" + JAXBRMConstants.LINE_SEP + "debug" + JAXBRMConstants.LINE_SEP + "iacat3" + JAXBRMConstants.LINE_SEP //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - + "lincoln_cuda3.2" + JAXBRMConstants.LINE_SEP + "fernsler" + JAXBRMConstants.LINE_SEP; //$NON-NLS-1$ //$NON-NLS-2$ - return new ByteArrayInputStream(content.getBytes()); - } - - private static InputStream getStaggered() { - String content = "value:1" + JAXBRMConstants.LINE_SEP + "value:2" + JAXBRMConstants.LINE_SEP + "name:1" + JAXBRMConstants.LINE_SEP + "name:2" + JAXBRMConstants.LINE_SEP + "name:3" + JAXBRMConstants.LINE_SEP //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - + "name:4" + JAXBRMConstants.LINE_SEP + "value:3" + JAXBRMConstants.LINE_SEP + "value:4" + JAXBRMConstants.LINE_SEP; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - return new ByteArrayInputStream(content.getBytes()); - } -} diff --git a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/messages.properties b/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/messages.properties deleted file mode 100644 index cceb69127..000000000 --- a/rms/org.eclipse.ptp.rm.jaxb.tests/src/org/eclipse/ptp/rm/jaxb/tests/messages.properties +++ /dev/null @@ -1 +0,0 @@ -RMVariableTest_1=The list of files to be staged in prior to job execution. |