|
From: <caw...@us...> - 2007-02-22 15:09:12
|
Revision: 1998
http://svn.sourceforge.net/rubyeclipse/?rev=1998&view=rev
Author: cawilliams
Date: 2007-02-22 07:09:10 -0800 (Thu, 22 Feb 2007)
Log Message:
-----------
fix test up a little (though it is still broken)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMType.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMType.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMType.java 2007-02-22 14:31:48 UTC (rev 1997)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMType.java 2007-02-22 15:09:10 UTC (rev 1998)
@@ -52,7 +52,12 @@
public IPath[] getDefaultLibraryLocations(File installLocation) {
File rubyExecutable = findRubyExecutable(installLocation);
- LibraryInfo info = getLibraryInfo(installLocation, rubyExecutable);
+ LibraryInfo info;
+ if (rubyExecutable == null) {
+ info = getDefaultLibraryInfo(installLocation);
+ } else {
+ info = getLibraryInfo(installLocation, rubyExecutable);
+ }
String[] loadpath = info.getBootpath();
IPath[] paths = new IPath[loadpath.length];
for (int i = 0; i < loadpath.length; i++) {
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-02-22 14:31:48 UTC (rev 1997)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-02-22 15:09:10 UTC (rev 1998)
@@ -759,8 +759,8 @@
* @since 0.9.0
*/
public static IVMInstall computeVMInstall(ILaunchConfiguration configuration) throws CoreException {
- String jreAttr = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_RUBY_CONTAINER_PATH, (String)null);
- if (jreAttr == null) {
+ String rubyVmAttr = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_RUBY_CONTAINER_PATH, (String)null);
+ if (rubyVmAttr == null) {
String type = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, (String)null);
if (type == null) {
IRubyProject proj = getRubyProject(configuration);
@@ -775,13 +775,13 @@
return resolveVM(type, name, configuration);
}
} else {
- IPath jrePath = Path.fromPortableString(jreAttr);
- ILoadpathEntry entry = RubyCore.newContainerEntry(jrePath);
- IRuntimeLoadpathEntryResolver2 resolver = getVariableResolver(jrePath.segment(0));
+ IPath rubyVmPath = Path.fromPortableString(rubyVmAttr);
+ ILoadpathEntry entry = RubyCore.newContainerEntry(rubyVmPath);
+ IRuntimeLoadpathEntryResolver2 resolver = getVariableResolver(rubyVmPath.segment(0));
if (resolver != null) {
return resolver.resolveVMInstall(entry);
} else {
- resolver = getContainerResolver(jrePath.segment(0));
+ resolver = getContainerResolver(rubyVmPath.segment(0));
if (resolver != null) {
return resolver.resolveVMInstall(entry);
}
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-02-22 14:31:48 UTC (rev 1997)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-02-22 15:09:10 UTC (rev 1998)
@@ -7,6 +7,7 @@
import java.util.Map;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -23,6 +24,7 @@
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.tests.ModifyingResourceTest;
+import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
import org.rubypeople.rdt.launching.IVMInstall;
import org.rubypeople.rdt.launching.IVMInstallType;
import org.rubypeople.rdt.launching.RubyRuntime;
@@ -39,8 +41,11 @@
private static final String VM_TYPE_ID = "org.rubypeople.rdt.launching.StandardVMType";
private IVMInstallType vmType;
+ private IVMInstall interpreter;
private IRubyProject project;
+ // XXX This test class desperately needs to be rewritten...
+
public TC_RunnerLaunching(String name) {
super(name);
}
@@ -48,19 +53,25 @@
@Override
protected void setUp() throws Exception {
super.setUp();
+ project = createRubyProject('/' + PROJECT_NAME);
+ IFolder location = createFolder('/' + PROJECT_NAME + "/interpreterOne");
+ createFolder('/' + PROJECT_NAME +"/interpreterOne/lib");
+ createFolder('/' + PROJECT_NAME +"/interpreterOne/bin");
+ createFile('/' + PROJECT_NAME +"/interpreterOne/bin/ruby", "");
+
vmType = RubyRuntime.getVMInstallType(VM_TYPE_ID);
VMStandin standin = new VMStandin(vmType, "fake");
standin.setName("fake");
- standin.setInstallLocation(new File("C:\ruby"));
- IVMInstall real = standin.convertToRealVM();
- RubyRuntime.setDefaultVMInstall(real, null, true);
- project = createRubyProject(PROJECT_NAME);
+ standin.setInstallLocation(location.getLocation().toFile());
+ interpreter = standin.convertToRealVM();
+ RubyRuntime.setDefaultVMInstall(interpreter, null, true);
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
- deleteProject(PROJECT_NAME);
+ deleteProject('/' + PROJECT_NAME);
+ vmType.disposeVMInstall(interpreter.getId());
}
protected ILaunchManager getLaunchManager() {
@@ -109,8 +120,6 @@
}
public void launch(boolean debug) throws Exception {
- IVMInstall interpreter = new VMStandin(vmType, "");
-
ILaunchConfiguration configuration = new ShamLaunchConfiguration();
ILaunch launch = new Launch(configuration, debug ? ILaunchManager.DEBUG_MODE : ILaunchManager.RUN_MODE, null);
ILaunchConfigurationType launchConfigurationType =
@@ -162,19 +171,19 @@
}
public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException {
- return false;
+ return defaultValue;
}
public int getAttribute(String attributeName, int defaultValue) throws CoreException {
- return 0;
+ return defaultValue;
}
public List getAttribute(String attributeName, List defaultValue) throws CoreException {
- return null;
+ return defaultValue;
}
public Map getAttribute(String attributeName, Map defaultValue) throws CoreException {
- return null;
+ return defaultValue;
}
public String getAttribute(String attributeName, String defaultValue) throws CoreException {
@@ -183,14 +192,16 @@
} else if (attributeName.equals(RubyLaunchConfigurationAttribute.FILE_NAME)) {
return RUBY_LIB_DIR + File.separator + RUBY_FILE_NAME;
} else if (attributeName.equals(RubyLaunchConfigurationAttribute.WORKING_DIRECTORY)) {
- return "C:\\Working Dir";
+ return '/' + PROJECT_NAME;
} else if (attributeName.equals(RubyLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS)) {
return INTERPRETER_ARGUMENTS;
} else if (attributeName.equals(RubyLaunchConfigurationAttribute.PROGRAM_ARGUMENTS)) {
return PROGRAM_ARGUMENTS;
+ } else if (attributeName.equals(IRubyLaunchConfigurationConstants.ATTR_VM_ARGUMENTS)) {
+ return "";
}
- return null;
+ return defaultValue;
}
public IFile getFile() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|