aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2012-06-12 03:51:36 (EDT)
committerUwe Stieber2012-06-12 03:51:36 (EDT)
commitc8849a6edcaf861506749be4094d1920c7f1d71c (patch)
treef44ad761d0048b26c9bbfde93fd3c85e5e0f9b8c
parent717517dcf250e01f25e19ad6e863fea623457527 (diff)
downloadorg.eclipse.tcf-c8849a6edcaf861506749be4094d1920c7f1d71c.zip
org.eclipse.tcf-c8849a6edcaf861506749be4094d1920c7f1d71c.tar.gz
org.eclipse.tcf-c8849a6edcaf861506749be4094d1920c7f1d71c.tar.bz2
Target Explorer: CHANGE improve test output
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/launch/TcfLaunchTests.java235
1 files changed, 118 insertions, 117 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/launch/TcfLaunchTests.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/launch/TcfLaunchTests.java
index f63bddd..8486faa 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/launch/TcfLaunchTests.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/launch/TcfLaunchTests.java
@@ -1,117 +1,118 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.tests.tcf.launch;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
-import org.eclipse.tcf.te.launch.core.lm.LaunchSpecification;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
-import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
-import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
-import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.runtime.services.filetransfer.FileTransferItem;
-import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
-import org.eclipse.tcf.te.runtime.utils.Host;
-import org.eclipse.tcf.te.tcf.launch.core.interfaces.ILaunchTypes;
-import org.eclipse.tcf.te.tcf.launch.core.interfaces.IRemoteAppLaunchAttributes;
-import org.eclipse.tcf.te.tests.tcf.TcfTestCase;
-
-/**
- * TCF Launch tests.
- */
-public class TcfLaunchTests extends TcfTestCase {
-
- /**
- * Provides a test suite to the caller which combines all single
- * test bundled within this category.
- *
- * @return Test suite containing all test for this test category.
- */
- public static Test getTestSuite() {
- TestSuite testSuite = new TestSuite("TCF Launch tests"); //$NON-NLS-1$
-
- // add ourself to the test suite
- testSuite.addTestSuite(TcfLaunchTests.class);
-
- return testSuite;
- }
-
-
- public void testRemoteAppLaunch() {
- final ILaunchSpecification spec = new LaunchSpecification(ILaunchTypes.REMOTE_APPLICATION, ILaunchManager.RUN_MODE);
- LaunchContextsPersistenceDelegate.setLaunchContexts(spec, new IModelNode[]{peerModel});
-
- IPath helloWorldLocation = getHelloWorldLocation();
- assertTrue("Missing hello world example for current OS and Arch", //$NON-NLS-1$
- helloWorldLocation != null &&
- helloWorldLocation.toFile().exists() &&
- helloWorldLocation.toFile().canExecute());
-
- String temp = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
- IPath tempDir = temp != null ? new Path(temp) : null;
- assertNotNull("Missing temp directory", tempDir); //$NON-NLS-1$
-
- IPath tempHelloWorld = tempDir.append(helloWorldLocation.lastSegment());
- if (tempHelloWorld.toFile().exists()) {
- tempHelloWorld.toFile().delete();
- }
- assertFalse("Cannot delete process image " + tempHelloWorld.toOSString(), tempHelloWorld.toFile().exists()); //$NON-NLS-1$
-
- IPath outFile = tempDir.append("/HelloWorld.out"); //$NON-NLS-1$
- if (outFile.toFile().exists()) {
- outFile.toFile().delete();
- }
- assertFalse("Cannot delete console output file " + outFile.toOSString(), outFile.toFile().exists()); //$NON-NLS-1$
-
- FileTransfersPersistenceDelegate.setFileTransfers(spec, new IFileTransferItem[]{new FileTransferItem(helloWorldLocation, tempDir)});
- spec.addAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, tempHelloWorld.toOSString());
-
- ILaunchConfiguration config = null;
- try {
- config = LaunchManager.getInstance().getLaunchConfiguration(spec, true);
- ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
- wc.setAttribute("org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON", false); //$NON-NLS-1$
- wc.setAttribute("org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE", outFile.toOSString()); //$NON-NLS-1$
- config = wc.doSave();
- }
- catch (Exception e) {
- assertNull("Unexpected exception when creating launch: " + e, e); //$NON-NLS-1$
- }
-
- try {
- LaunchManager.getInstance().launch(config, ILaunchManager.RUN_MODE, false, new NullProgressMonitor());
- }
- catch (Exception e) {
- assertNull("Unexpected exception when launching hello world: " + e, e); //$NON-NLS-1$
- }
-
- assertTrue("Missing console output file", outFile.toFile().exists() && outFile.toFile().length() > 0); //$NON-NLS-1$
- }
-
- private IPath getHelloWorldLocation() {
- IPath path = getDataLocation("helloWorld", true, true); //$NON-NLS-1$
- if (path != null) {
- path = path.append("HelloWorld"); //$NON-NLS-1$
- if (Host.isWindowsHost()) {
- path = path.addFileExtension("exe"); //$NON-NLS-1$
- }
- }
-
- return path;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tests.tcf.launch;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
+import org.eclipse.tcf.te.launch.core.lm.LaunchSpecification;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
+import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.services.filetransfer.FileTransferItem;
+import org.eclipse.tcf.te.runtime.services.interfaces.filetransfer.IFileTransferItem;
+import org.eclipse.tcf.te.runtime.utils.Host;
+import org.eclipse.tcf.te.tcf.launch.core.interfaces.ILaunchTypes;
+import org.eclipse.tcf.te.tcf.launch.core.interfaces.IRemoteAppLaunchAttributes;
+import org.eclipse.tcf.te.tests.tcf.TcfTestCase;
+
+/**
+ * TCF Launch tests.
+ */
+public class TcfLaunchTests extends TcfTestCase {
+
+ /**
+ * Provides a test suite to the caller which combines all single
+ * test bundled within this category.
+ *
+ * @return Test suite containing all test for this test category.
+ */
+ public static Test getTestSuite() {
+ TestSuite testSuite = new TestSuite("TCF Launch tests"); //$NON-NLS-1$
+
+ // add ourself to the test suite
+ testSuite.addTestSuite(TcfLaunchTests.class);
+
+ return testSuite;
+ }
+
+
+ public void testRemoteAppLaunch() {
+ final ILaunchSpecification spec = new LaunchSpecification(ILaunchTypes.REMOTE_APPLICATION, ILaunchManager.RUN_MODE);
+ LaunchContextsPersistenceDelegate.setLaunchContexts(spec, new IModelNode[]{peerModel});
+
+ IPath helloWorldLocation = getHelloWorldLocation();
+ assertTrue("Missing hello world example for current OS and Arch:" + Platform.getOS() + "/" + Platform.getOSArch(), //$NON-NLS-1$ //$NON-NLS-2$
+ helloWorldLocation != null &&
+ helloWorldLocation.toFile().exists() &&
+ helloWorldLocation.toFile().canExecute());
+
+ String temp = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
+ IPath tempDir = temp != null ? new Path(temp) : null;
+ assertNotNull("Missing java temp directory", tempDir); //$NON-NLS-1$
+
+ IPath tempHelloWorld = tempDir.append(helloWorldLocation.lastSegment());
+ if (tempHelloWorld.toFile().exists()) {
+ tempHelloWorld.toFile().delete();
+ }
+ assertFalse("Cannot delete process image " + tempHelloWorld.toOSString(), tempHelloWorld.toFile().exists()); //$NON-NLS-1$
+
+ IPath outFile = tempDir.append("/HelloWorld.out"); //$NON-NLS-1$
+ if (outFile.toFile().exists()) {
+ outFile.toFile().delete();
+ }
+ assertFalse("Cannot delete console output file " + outFile.toOSString(), outFile.toFile().exists()); //$NON-NLS-1$
+
+ FileTransfersPersistenceDelegate.setFileTransfers(spec, new IFileTransferItem[]{new FileTransferItem(helloWorldLocation, tempDir)});
+ spec.addAttribute(IRemoteAppLaunchAttributes.ATTR_PROCESS_IMAGE, tempHelloWorld.toOSString());
+
+ ILaunchConfiguration config = null;
+ try {
+ config = LaunchManager.getInstance().getLaunchConfiguration(spec, true);
+ ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
+ wc.setAttribute("org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON", false); //$NON-NLS-1$
+ wc.setAttribute("org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE", outFile.toOSString()); //$NON-NLS-1$
+ config = wc.doSave();
+ }
+ catch (Exception e) {
+ assertNull("Unexpected exception when creating launch: " + e, e); //$NON-NLS-1$
+ }
+
+ try {
+ LaunchManager.getInstance().launch(config, ILaunchManager.RUN_MODE, false, new NullProgressMonitor());
+ }
+ catch (Exception e) {
+ assertNull("Unexpected exception when launching hello world: " + e, e); //$NON-NLS-1$
+ }
+
+ assertTrue("Missing console output file", outFile.toFile().exists() && outFile.toFile().length() > 0); //$NON-NLS-1$
+ }
+
+ private IPath getHelloWorldLocation() {
+ IPath path = getDataLocation("helloWorld", true, true); //$NON-NLS-1$
+ if (path != null) {
+ path = path.append("HelloWorld"); //$NON-NLS-1$
+ if (Host.isWindowsHost()) {
+ path = path.addFileExtension("exe"); //$NON-NLS-1$
+ }
+ }
+
+ return path;
+ }
+}