Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Garms2006-06-08 22:51:14 +0000
committerJesse Garms2006-06-08 22:51:14 +0000
commit2c6acb10cb46e2eb589c913c4b9e13d292e292dd (patch)
treeb7ba7c32fac594e06ec8149f4f95b8fbcb24f7de
parent476283aa26316bf7e064c1f831a8ec9cda3814c0 (diff)
downloadeclipse.jdt.core-APT_3_1_1_maintenance.tar.gz
eclipse.jdt.core-APT_3_1_1_maintenance.tar.xz
eclipse.jdt.core-APT_3_1_1_maintenance.zip
Fix windows-specific tests that were broken on linux. Patch submitted by sbandow@bea.com.v20060620APT_3_1_1_maintenance
-rw-r--r--org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/PreferencesTests.java32
-rw-r--r--org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/annotations/mirrortest/MirrorUtilTestAnnotationProcessor.java16
2 files changed, 36 insertions, 12 deletions
diff --git a/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/PreferencesTests.java b/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/PreferencesTests.java
index d8627cee0b..9a07b35861 100644
--- a/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/PreferencesTests.java
+++ b/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/PreferencesTests.java
@@ -13,6 +13,7 @@
package org.eclipse.jdt.apt.tests;
import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -48,9 +49,9 @@ public class PreferencesTests extends APTTestBase {
public void testFactoryPathEncodingAndDecoding() throws Exception {
//encode
Map<FactoryContainer, FactoryPath.Attributes> factories = new LinkedHashMap<FactoryContainer, FactoryPath.Attributes>();
- FactoryContainer jarFactory1 = FactoryPathUtil.newExtJarFactoryContainer(new File("C:/test1.jar")); //$NON-NLS-1$
+ FactoryContainer jarFactory1 = FactoryPathUtil.newExtJarFactoryContainer(new File(JAR_PATH_1)); //$NON-NLS-1$
FactoryPath.Attributes jarFPA1 = new FactoryPath.Attributes(true, false);
- FactoryContainer jarFactory2 = FactoryPathUtil.newExtJarFactoryContainer(new File("C:/test2.jar")); //$NON-NLS-1$
+ FactoryContainer jarFactory2 = FactoryPathUtil.newExtJarFactoryContainer(new File(JAR_PATH_2)); //$NON-NLS-1$
FactoryPath.Attributes jarFPA2 = new FactoryPath.Attributes(true, true);
FactoryContainer pluginFactory = FactoryPathUtil.getPluginFactoryContainer("org.eclipse.jdt.apt.tests"); //$NON-NLS-1$
FactoryPath.Attributes pluginFPA = new FactoryPath.Attributes(false, false);
@@ -94,11 +95,34 @@ public class PreferencesTests extends APTTestBase {
}
}
+ // Need to use temp files to get path to external jars.
+ // Platform differences prevent us from hard-coding a string here
+ private static final String JAR_PATH_1;
+ private static final String JAR_PATH_2;
+
+ static {
+ File jar1 = null;
+ File jar2 = null;
+ try {
+ jar1 = File.createTempFile("test1", "jar");
+ jar2 = File.createTempFile("test2", "jar");
+ JAR_PATH_1 = jar1.getAbsolutePath();
+ JAR_PATH_2 = jar2.getAbsolutePath();
+ }
+ catch (IOException ioe) {
+ throw new RuntimeException("Could not create temp jar files", ioe);
+ }
+ finally {
+ if (jar1 != null) jar1.delete();
+ if (jar2 != null) jar2.delete();
+ }
+ }
+
@SuppressWarnings("nls")
private static final String serializedFactories =
"<factorypath>\n" +
- " <factorypathentry kind=\"EXTJAR\" id=\"C:\\test1.jar\" enabled=\"true\" runInBatchMode=\"false\"/>\n" +
- " <factorypathentry kind=\"EXTJAR\" id=\"C:\\test2.jar\" enabled=\"true\" runInBatchMode=\"true\"/>\n" +
+ " <factorypathentry kind=\"EXTJAR\" id=\"" + JAR_PATH_1 + "\" enabled=\"true\" runInBatchMode=\"false\"/>\n" +
+ " <factorypathentry kind=\"EXTJAR\" id=\"" + JAR_PATH_2 + "\" enabled=\"true\" runInBatchMode=\"true\"/>\n" +
" <factorypathentry kind=\"PLUGIN\" id=\"org.eclipse.jdt.apt.tests\" enabled=\"false\" runInBatchMode=\"false\"/>\n" +
"</factorypath>\n";
diff --git a/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/annotations/mirrortest/MirrorUtilTestAnnotationProcessor.java b/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/annotations/mirrortest/MirrorUtilTestAnnotationProcessor.java
index dbb9a0d147..ac53197a57 100644
--- a/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/annotations/mirrortest/MirrorUtilTestAnnotationProcessor.java
+++ b/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/annotations/mirrortest/MirrorUtilTestAnnotationProcessor.java
@@ -61,16 +61,16 @@ public class MirrorUtilTestAnnotationProcessor extends BaseProcessor
public static final String[] ENV_VALUES = {
// no-translation
"normal",
- "normal\\foo.bar",
- "%NOSUCH\\VARNAME%",
- "%ROOT%\\someOtherProject\\foo\\nonexistent.txt",
+ "normal/foo.bar",
+ "%NOSUCH/VARNAME%",
+ "%ROOT%/someOtherProject/foo/nonexistent.txt",
// expected-translation
"%ECLIPSE_HOME%",
- "%ECLIPSE_HOME%\\plugins",
- "%ECLIPSE_HOME%\\startup.jar",
- "%ROOT%\\org.eclipse.jdt.apt.tests.MirrorUtilTestsProject",
- "%ROOT%\\org.eclipse.jdt.apt.tests.MirrorUtilTestsProject\\.classpath",
- "%PROJECT.DIR%\\.classpath"
+ "%ECLIPSE_HOME%/plugins",
+ "%ECLIPSE_HOME%/startup.jar",
+ "%ROOT%/org.eclipse.jdt.apt.tests.MirrorUtilTestsProject",
+ "%ROOT%/org.eclipse.jdt.apt.tests.MirrorUtilTestsProject/.classpath",
+ "%PROJECT.DIR%/.classpath"
};
public MirrorUtilTestAnnotationProcessor(AnnotationProcessorEnvironment env)

Back to the top