Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2010-05-11 15:29:39 +0000
committerAndrew Niefer2010-05-11 15:29:39 +0000
commitbae88e0807987e3625db8dafd332386f2ded09d5 (patch)
tree5acd01e62b9440a500a627409092f293966eee14 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher
parentfb92b58c719290e6abfbf11a415973a8e4118381 (diff)
downloadrt.equinox.p2-bae88e0807987e3625db8dafd332386f2ded09d5.tar.gz
rt.equinox.p2-bae88e0807987e3625db8dafd332386f2ded09d5.tar.xz
rt.equinox.p2-bae88e0807987e3625db8dafd332386f2ded09d5.zip
bug 267822 - special characters not correctly escaped
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java42
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java7
2 files changed, 44 insertions, 5 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java
index 0ef37fc0b..cd9657dd5 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java
@@ -18,14 +18,14 @@ import org.easymock.EasyMock;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
import org.eclipse.equinox.internal.p2.publisher.eclipse.DataLoader;
+import org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile;
import org.eclipse.equinox.internal.provisional.frameworkadmin.ConfigData;
import org.eclipse.equinox.internal.provisional.frameworkadmin.LauncherData;
import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.publisher.IPublisherResult;
import org.eclipse.equinox.p2.publisher.eclipse.*;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
-import org.eclipse.equinox.p2.tests.TestActivator;
-import org.eclipse.equinox.p2.tests.TestMetadataRepository;
+import org.eclipse.equinox.p2.tests.*;
@SuppressWarnings({"unchecked", "restriction"})
public class ConfigCUsActionTest extends ActionTest {
@@ -86,6 +86,10 @@ public class ConfigCUsActionTest extends ActionTest {
verifyProvidedCapability(providedCapabilities, flavor + id, id + "." + cuType, version); //$NON-NLS-1$
assertTrue(providedCapabilities.size() == 2);
assertTrue(iu.getRequirements().size() == 0);
+ if (cuType.equals("ini"))
+ verifyLauncherArgs(iu);
+ if (cuType.equals("config"))
+ verifyConfigProperties(iu);
return; //pass
}
}
@@ -93,6 +97,28 @@ public class ConfigCUsActionTest extends ActionTest {
}
+ private void verifyLauncherArgs(IInstallableUnit iu) {
+ Collection<ITouchpointData> touchpointData = iu.getTouchpointData();
+ assertEquals(1, touchpointData.size());
+ ITouchpointData data = touchpointData.iterator().next();
+ ITouchpointInstruction instruction = data.getInstruction("configure");
+ String body = instruction.getBody();
+ assertTrue("arg -foo bar", body.indexOf("addProgramArg(programArg:-foo bar);") > -1);
+ assertTrue("vmarg -agentlib", body.indexOf("addJvmArg(jvmArg:-agentlib${#58}jdwp=transport=dt_socket${#44}server=y${#44}suspend=n${#44}address=8272);") > -1);
+ assertTrue("arg -product com,ma", body.indexOf("addProgramArg(programArg:-product);addProgramArg(programArg:com${#44}ma);") > -1);
+ }
+
+ private void verifyConfigProperties(IInstallableUnit iu) {
+ Collection<ITouchpointData> touchpointData = iu.getTouchpointData();
+ assertEquals(1, touchpointData.size());
+ ITouchpointData data = touchpointData.iterator().next();
+ ITouchpointInstruction instruction = data.getInstruction("configure");
+ String body = instruction.getBody();
+ assertTrue("eclipse.product", body.indexOf("setProgramProperty(propName:eclipse.product,propValue:org.eclipse.platform.ide);") > -1);
+ assertTrue("eclipse.buildId", body.indexOf("setProgramProperty(propName:eclipse.buildId,propValue:TEST-ID);") > -1);
+ assertTrue("my.property", body.indexOf("setProgramProperty(propName:my.property,propValue:${#123}a${#44}b${#58}c${#59}${#36}d${#125});") > -1);
+ }
+
protected void insertPublisherInfoBehavior() {
loader = new DataLoader(configLocation, executableLocation);
@@ -103,11 +129,21 @@ public class ConfigCUsActionTest extends ActionTest {
configList.add(configAdvice);
expect(publisherInfo.getAdvice(EasyMock.matches(configSpec), EasyMock.eq(false), (String) EasyMock.anyObject(), (Version) EasyMock.anyObject(), EasyMock.eq(IConfigAdvice.class))).andReturn(configList).anyTimes();
- //configure ILaunchingAdvice
+ //configure IExecutableAdvice
LauncherData launcherData = loader.getLauncherData();
LaunchingAdvice launchingAdvice = new LaunchingAdvice(launcherData, configSpec);
+
ArrayList launchingList = new ArrayList();
launchingList.add(launchingAdvice);
+
+ try {
+ String productFileLocation = TestData.getFile("ProductActionTest", "productFileActionTest.product").toString();
+ ProductFileAdvice productAdvice = new ProductFileAdvice(new ProductFile(productFileLocation), configSpec);
+ launchingList.add(productAdvice);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ }
+
expect(publisherInfo.getAdvice(EasyMock.matches(configSpec), EasyMock.eq(false), (String) EasyMock.anyObject(), (Version) EasyMock.anyObject(), EasyMock.eq(IExecutableAdvice.class))).andReturn(launchingList).anyTimes();
//setup metadata repository
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java
index fe6ba98b3..f2164db85 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java
@@ -59,7 +59,9 @@ public class ProductFileAdviceTest extends AbstractProvisioningTest {
assertEquals("1.3", "My Name", programArgumentsWin32[2]);
String[] programArguments2 = productFileAdvice2.getProgramArguments();
- assertEquals("2.0", 0, programArguments2.length);
+ assertEquals("2.0", 2, programArguments2.length);
+ assertEquals("2.1", "-product", programArguments2[0]);
+ assertEquals("2.2", "com,ma", programArguments2[1]);
}
/**
@@ -72,7 +74,8 @@ public class ProductFileAdviceTest extends AbstractProvisioningTest {
assertEquals("1.2", "-Dfoo=b a r", vmArgumentsWin32[1]);
String[] vmArguments2 = productFileAdvice2.getVMArguments();
- assertEquals("2.0", 0, vmArguments2.length);
+ assertEquals("2.0", 1, vmArguments2.length);
+ assertEquals("2.1", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8272", vmArguments2[0]);
}
/**

Back to the top