|
From: <caw...@us...> - 2007-07-11 16:08:26
|
Revision: 2747
http://svn.sourceforge.net/rubyeclipse/?rev=2747&view=rev
Author: cawilliams
Date: 2007-07-11 09:08:23 -0700 (Wed, 11 Jul 2007)
Log Message:
-----------
try to improve test
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java 2007-07-11 15:36:48 UTC (rev 2746)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java 2007-07-11 16:08:23 UTC (rev 2747)
@@ -1,7 +1,11 @@
package org.rubypeople.rdt.internal.launching;
import java.io.File;
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -12,6 +16,7 @@
import org.rubypeople.rdt.launching.IVMInstallType;
import org.rubypeople.rdt.launching.RubyRuntime;
import org.rubypeople.rdt.launching.VMStandin;
+import org.w3c.dom.Document;
public class TC_RubyRuntime extends ModifyingResourceTest {
@@ -86,7 +91,7 @@
}
}
- public void testSetInstalledInterpreters() throws CoreException {
+ public void testSetInstalledInterpreters() throws Exception {
String vmOneName = "InterpreterOne";
String vmOneId = vmOneName;
String vmTwoName = "InterpreterTwo";
@@ -102,7 +107,7 @@
IPath vmOneLocation = folderOne.getLocation();
assertEquals(
"XML should indicate only one interpreter with it being the one selected.",
- Util.convertToIndependantLineDelimiter("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+ Util.convertToIndependantLineDelimiter(getXMLHeader() +
"<vmSettings defaultVM=\"43,org.rubypeople.rdt.launching.StandardVMType14," + vmOneId + "\">\r\n" +
"<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n" +
vmToXML(vmOneId, vmOneName, vmOneLocation) +
@@ -118,7 +123,7 @@
assertEquals(2, vmType.getVMInstalls().length);
assertEquals(
"XML should indicate both interpreters with the first one being selected.",
- Util.convertToIndependantLineDelimiter("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+ Util.convertToIndependantLineDelimiter(getXMLHeader() +
"<vmSettings defaultVM=\"43,org.rubypeople.rdt.launching.StandardVMType14," + vmOneId + "\">\r\n" +
"<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n" +
vmToXML(vmOneId, vmOneName, vmOneLocation) +
@@ -131,7 +136,7 @@
assertEquals(2, vmType.getVMInstalls().length);
assertEquals(
"XML should indicate both interpreters with the second one being selected.",
- Util.convertToIndependantLineDelimiter("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+ Util.convertToIndependantLineDelimiter(getXMLHeader() +
"<vmSettings defaultVM=\"" + RubyRuntime.getCompositeIdFromVM(standin2) + "\">\r\n" +
"<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n" +
vmToXML(vmOneId, vmOneName, vmOneLocation) +
@@ -145,6 +150,11 @@
}
}
+ private String getXMLHeader() throws IOException, TransformerException, ParserConfigurationException {
+ Document doc = LaunchingPlugin.getDocument();
+ return LaunchingPlugin.serializeDocument(doc).trim() + "\r\n";
+ }
+
private String getVMsXML() {
return RubyRuntime.getPreferences().getString(RubyRuntime.PREF_VM_XML);
}
@@ -165,8 +175,8 @@
xml.append("<libraryLocation src=\"");
xml.append(location.toPortableString());
xml.append("/lib/ruby/1.8\"/>\r\n");
- File file = LaunchingPlugin.getFileInPlugin(new Path("ruby" + File.separator + id + File.separator + "lib"));
- if (file != null) {
+ File file = LaunchingPlugin.getDefault().getStateLocation().append(id).append("lib").toFile();
+ if (file != null && file.exists()) {
xml.append("<libraryLocation src=\"");
xml.append(Path.fromOSString(file.toString()).toPortableString());
xml.append("\"/>\r\n");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|