Bug 294209 - JEE Galileo SR1 Root folder Installation path breaks Subversive Incubation installation
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java
index 973795a..89f30b1 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java
@@ -111,7 +111,7 @@
public static File fromOSGiJarToOSGiInstallArea(String path) {
IPath parentFolder = new Path(path).removeLastSegments(1);
- if (parentFolder.lastSegment().equalsIgnoreCase("plugins")) //$NON-NLS-1$
+ if ("plugins".equalsIgnoreCase(parentFolder.lastSegment())) //$NON-NLS-1$
return parentFolder.removeLastSegments(1).toFile();
return parentFolder.toFile();
}
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/AllTests.java b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/AllTests.java
index b6ab89d..0af378a 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/AllTests.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/AllTests.java
@@ -30,6 +30,7 @@
suite.addTestSuite(NoConfigurationValueInEclipseIni.class);
suite.addTestSuite(NoRenamingLauncherIni.class);
suite.addTestSuite(OSGiVersionChange.class);
+ suite.addTestSuite(ParserUtilsTest.class);
suite.addTestSuite(ReaderTest1.class);
suite.addTestSuite(ReaderTest2.class);
suite.addTestSuite(ReaderTest3.class);
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/ManipulatorTests.java b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/ManipulatorTests.java
index e8897ef..d151c7a 100644
--- a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/ManipulatorTests.java
+++ b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/ManipulatorTests.java
@@ -12,10 +12,9 @@
package org.eclipse.equinox.frameworkadmin.tests;
import java.io.*;
-import java.util.*;
+import java.util.Properties;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.equinox.internal.frameworkadmin.equinox.ParserUtils;
import org.eclipse.equinox.internal.provisional.frameworkadmin.*;
public class ManipulatorTests extends AbstractFwkAdminTest {
@@ -100,50 +99,4 @@
assertContents(ini, new String[] {"-foo", "bar", "-console", "-vmargs", "-Xmx256m", "-Xms64m"});
}
- public void testParserUtils_removeArgument() throws Exception {
- String [] args = new String [] { "-bar", "-foo", "-other"};
- ParserUtils.removeArgument("-foo", Arrays.asList(args));
- assertEquals(args, new String [] {"-bar", null, "-other"});
-
- args = new String [] { "-bar", "-foo", "other"};
- ParserUtils.removeArgument("-foo", Arrays.asList(args));
- assertEquals(args, new String [] {"-bar", null, null});
-
- args = new String [] { "-bar", "-foo", "s-pecial"};
- ParserUtils.removeArgument("-foo", Arrays.asList(args));
- assertEquals(args, new String [] {"-bar", null, null});
- }
-
- public void testParserUtils_setValueForArgument() throws Exception {
- List args = new ArrayList();
- ParserUtils.setValueForArgument("-foo", "bar", args);
- assertTrue(args.size() == 2);
- assertEquals(args.get(0), "-foo");
- assertEquals(args.get(1), "bar");
-
- args.add("-other");
- args.set(1, "s-pecial");
- ParserUtils.setValueForArgument("-foo", "bas", args);
- assertTrue(args.size() == 3);
- assertEquals(args.get(0), "-foo");
- assertEquals(args.get(1), "bas");
- assertEquals(args.get(2), "-other");
-
- args.remove(1);
- ParserUtils.setValueForArgument("-foo", "bas", args);
- assertTrue(args.size() == 3);
- assertEquals(args.get(0), "-foo");
- assertEquals(args.get(1), "bas");
- assertEquals(args.get(2), "-other");
- }
-
- public void testParserUtils_getValueForArgument() throws Exception {
- List args = new ArrayList();
- args.add("-foo");
- args.add("bar");
- assertEquals( "bar", ParserUtils.getValueForArgument("-foo", args));
-
- args.set(1, "-bar");
- assertEquals(null, ParserUtils.getValueForArgument("-foo", args));
- }
}
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/ParserUtilsTest.java b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/ParserUtilsTest.java
new file mode 100644
index 0000000..88b77bc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.frameworkadmin.test/src/org/eclipse/equinox/frameworkadmin/tests/ParserUtilsTest.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.frameworkadmin.tests;
+
+import java.io.File;
+import java.util.*;
+import org.eclipse.equinox.internal.frameworkadmin.equinox.ParserUtils;
+
+/**
+ * Tests for {@link ParserUtils}.
+ */
+public class ParserUtilsTest extends AbstractFwkAdminTest {
+
+ public ParserUtilsTest(String name) {
+ super(name);
+ }
+ public void testGetValueForArgument() throws Exception {
+ List args = new ArrayList();
+ args.add("-foo");
+ args.add("bar");
+ assertEquals( "bar", ParserUtils.getValueForArgument("-foo", args));
+
+ args.set(1, "-bar");
+ assertEquals(null, ParserUtils.getValueForArgument("-foo", args));
+ }
+
+ public void testRemoveArgument() throws Exception {
+ String [] args = new String [] { "-bar", "-foo", "-other"};
+ ParserUtils.removeArgument("-foo", Arrays.asList(args));
+ assertEquals(args, new String [] {"-bar", null, "-other"});
+
+ args = new String [] { "-bar", "-foo", "other"};
+ ParserUtils.removeArgument("-foo", Arrays.asList(args));
+ assertEquals(args, new String [] {"-bar", null, null});
+
+ args = new String [] { "-bar", "-foo", "s-pecial"};
+ ParserUtils.removeArgument("-foo", Arrays.asList(args));
+ assertEquals(args, new String [] {"-bar", null, null});
+ }
+
+ public void testSetValueForArgument() throws Exception {
+ List args = new ArrayList();
+ ParserUtils.setValueForArgument("-foo", "bar", args);
+ assertTrue(args.size() == 2);
+ assertEquals(args.get(0), "-foo");
+ assertEquals(args.get(1), "bar");
+
+ args.add("-other");
+ args.set(1, "s-pecial");
+ ParserUtils.setValueForArgument("-foo", "bas", args);
+ assertTrue(args.size() == 3);
+ assertEquals(args.get(0), "-foo");
+ assertEquals(args.get(1), "bas");
+ assertEquals(args.get(2), "-other");
+
+ args.remove(1);
+ ParserUtils.setValueForArgument("-foo", "bas", args);
+ assertTrue(args.size() == 3);
+ assertEquals(args.get(0), "-foo");
+ assertEquals(args.get(1), "bas");
+ assertEquals(args.get(2), "-other");
+ }
+
+ public void testFromOSGiJarToOSGiInstallArea() {
+ String path = "";
+ File result =ParserUtils.fromOSGiJarToOSGiInstallArea(path);
+ assertNotNull("1.0", result);
+
+ path = "osgi.jar";
+ result =ParserUtils.fromOSGiJarToOSGiInstallArea(path);
+ assertNotNull("1.0", result);
+ assertEquals("1.1", "", result.toString());
+ }
+
+}