Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 163717
Collapse All | Expand All

(-)src/org/eclipse/hyades/test/core/services/AbstractTestExecutionService.java (-4 / +60 lines)
Lines 18-29 Link Here
18
import java.util.List;
18
import java.util.List;
19
import java.util.Properties;
19
import java.util.Properties;
20
20
21
import org.eclipse.core.resources.IContainer;
21
import org.eclipse.core.resources.IFile;
22
import org.eclipse.core.resources.IFile;
23
import org.eclipse.core.resources.IFolder;
22
import org.eclipse.core.resources.IProject;
24
import org.eclipse.core.resources.IProject;
23
import org.eclipse.core.runtime.CoreException;
25
import org.eclipse.core.runtime.CoreException;
24
import org.eclipse.core.runtime.IPlatformRunnable;
26
import org.eclipse.core.runtime.IPlatformRunnable;
25
import org.eclipse.core.runtime.IProgressMonitor;
27
import org.eclipse.core.runtime.IProgressMonitor;
28
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.NullProgressMonitor;
29
import org.eclipse.core.runtime.NullProgressMonitor;
30
import org.eclipse.core.runtime.Status;
27
import org.eclipse.debug.core.DebugPlugin;
31
import org.eclipse.debug.core.DebugPlugin;
28
import org.eclipse.debug.core.ILaunch;
32
import org.eclipse.debug.core.ILaunch;
29
import org.eclipse.debug.core.ILaunchConfiguration;
33
import org.eclipse.debug.core.ILaunchConfiguration;
Lines 46-56 Link Here
46
import org.eclipse.hyades.models.common.facades.behavioral.impl.FacadeResourceFactoryImpl;
50
import org.eclipse.hyades.models.common.facades.behavioral.impl.FacadeResourceFactoryImpl;
47
import org.eclipse.hyades.models.common.testprofile.TPFDeployment;
51
import org.eclipse.hyades.models.common.testprofile.TPFDeployment;
48
import org.eclipse.hyades.models.common.testprofile.TPFExecutionResult;
52
import org.eclipse.hyades.models.common.testprofile.TPFExecutionResult;
53
import org.eclipse.hyades.models.common.testprofile.TPFTest;
49
import org.eclipse.hyades.models.common.testprofile.TPFTestSuite;
54
import org.eclipse.hyades.models.common.testprofile.TPFTestSuite;
50
import org.eclipse.hyades.models.common.testprofile.impl.Common_TestprofilePackageImpl;
55
import org.eclipse.hyades.models.common.testprofile.impl.Common_TestprofilePackageImpl;
51
import org.eclipse.hyades.models.common.util.ICommonConstants;
56
import org.eclipse.hyades.models.common.util.ICommonConstants;
52
import org.eclipse.hyades.models.hierarchy.util.HyadesExtendedResourceFactory;
57
import org.eclipse.hyades.models.hierarchy.util.HyadesExtendedResourceFactory;
53
import org.eclipse.hyades.models.util.ModelDebugger;
58
import org.eclipse.hyades.models.util.ModelDebugger;
59
import org.eclipse.hyades.test.core.TestCorePlugin;
54
import org.eclipse.hyades.test.core.internal.launch.extensions.LaunchConfigurationExtensionsManager;
60
import org.eclipse.hyades.test.core.internal.launch.extensions.LaunchConfigurationExtensionsManager;
55
import org.eclipse.hyades.test.core.internal.launch.processes.TestExecutionProcess;
61
import org.eclipse.hyades.test.core.internal.launch.processes.TestExecutionProcess;
56
import org.eclipse.hyades.test.core.launch.configurations.DeploymentLaunchConfigurationFacade;
62
import org.eclipse.hyades.test.core.launch.configurations.DeploymentLaunchConfigurationFacade;
Lines 335-344 Link Here
335
341
336
		// Specify results in launch configuration
342
		// Specify results in launch configuration
337
		if (this.resultsSpecifier != null) {
343
		if (this.resultsSpecifier != null) {
344
			this.resultsSpecifier = this.resultsSpecifier.trim();
338
			ExecutionHistoryLaunchConfigurationFacade.setUseDefaults(
345
			ExecutionHistoryLaunchConfigurationFacade.setUseDefaults(
339
					configuration, false);
346
					configuration, false);
347
			
348
			IContainer executionHistoryLocation = null;
349
			String executionHistoryName = this.resultsSpecifier;
350
351
			// Strip trailing slash if present
352
			if (this.resultsSpecifier.endsWith("/") || this.resultsSpecifier.endsWith("\\"))
353
				this.resultsSpecifier = this.resultsSpecifier.substring(0, this.resultsSpecifier.length()-1);
354
355
			int index1 = this.resultsSpecifier.lastIndexOf('/');
356
			int index2 = this.resultsSpecifier.lastIndexOf('\\');
357
			if (index1 > 0 || index2 > 0)
358
			{
359
				int index = Math.max(index1, index2);
360
				
361
				// The resultsSpecifier contains one or more slashes, so
362
				// we know it contains a directory to put the results in
363
				// and it may or may not contain a filename as well.
364
				IFolder folder = project.getFolder(resultsSpecifier);
365
				if (folder.exists()) {
366
					// If the resultsSpecifier exists as a folder in the
367
					// project, then this is the target dir, and we'll use
368
					// the default name.
369
					executionHistoryLocation = folder;
370
					executionHistoryName = ExecutionHistoryLaunchConfigurationFacade.getDefaultExecutionHistoryName(configuration);
371
				}
372
				else {
373
					// The results specifer contains both a relative directory
374
					// in the project and the execution filename.  Parse them 
375
					// apart and set them
376
					if (index >= this.resultsSpecifier.length()) {
377
						IStatus status = new Status(IStatus.ERROR, TestCorePlugin.getPluginId(), this.resultsSpecifier + " does not exist"); 
378
						throw new CoreException(status);
379
						
380
					}
381
					executionHistoryName = this.resultsSpecifier.substring(index+1);
382
					String containerName = this.resultsSpecifier.substring(0, index);
383
					
384
					folder = project.getFolder(containerName);
385
					if (folder.exists()) {
386
						executionHistoryLocation = folder;
387
					}
388
				}
389
			}
390
			
340
			ExecutionHistoryLaunchConfigurationFacade.setExecutionHistoryName(
391
			ExecutionHistoryLaunchConfigurationFacade.setExecutionHistoryName(
341
					configuration, this.resultsSpecifier);
392
					configuration, executionHistoryName);
342
			ExecutionHistoryLaunchConfigurationFacade
393
			ExecutionHistoryLaunchConfigurationFacade
343
					.setExecutionHistoryOverriden(
394
					.setExecutionHistoryOverriden(
344
							configuration,
395
							configuration,
Lines 347-353 Link Here
347
			ExecutionHistoryLaunchConfigurationFacade
398
			ExecutionHistoryLaunchConfigurationFacade
348
					.setExecutionHistoryLocation(
399
					.setExecutionHistoryLocation(
349
							configuration,
400
							configuration,
350
							ExecutionHistoryLaunchConfigurationFacade
401
							executionHistoryLocation != null ? executionHistoryLocation : 
402
								 ExecutionHistoryLaunchConfigurationFacade
351
									.getDefaultExecutionHistoryLocation(configuration));
403
									.getDefaultExecutionHistoryLocation(configuration));
352
		}
404
		}
353
405
Lines 598-604 Link Here
598
		this.connectionSpecifier = this.getProperty("connection");
650
		this.connectionSpecifier = this.getProperty("connection");
599
651
600
		// Allocate a return list to store result strings
652
		// Allocate a return list to store result strings
601
		this.results = new ArrayList(this.suiteSelector.size());
653
		this.results = new ArrayList();//this.suiteSelector.size());
602
654
603
		// Ensure project is synchronized with file system
655
		// Ensure project is synchronized with file system
604
		this.refreshProject();
656
		this.refreshProject();
Lines 747-753 Link Here
747
799
748
		// Wait for test execution process to be terminated
800
		// Wait for test execution process to be terminated
749
		this.print("Waiting...");
801
		this.print("Waiting...");
750
		while (!process.isTerminated()) {
802
		while (process != null && !process.isTerminated()) {
751
			synchronized (process) {
803
			synchronized (process) {
752
				try {
804
				try {
753
					process
805
					process
Lines 758-763 Link Here
758
				}
810
				}
759
			}
811
			}
760
		}
812
		}
813
		
814
		if (process == null) {
815
			System.out.println("Process was null -- test completed too fast?");
816
		}
761
817
762
		// Output extra line for end of waiting display
818
		// Output extra line for end of waiting display
763
		this.println();
819
		this.println();

Return to bug 163717