Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java22
-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
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/ConfigCUsActionTest/level1/level2/config.ini1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/ProductActionTest/productFileActionTest.product9
5 files changed, 65 insertions, 16 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java
index b99b1c8d0..3d77fdebf 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java
@@ -15,6 +15,7 @@ import java.util.*;
import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.frameworkadmin.BundleInfo;
+import org.eclipse.equinox.internal.p2.metadata.TouchpointInstruction;
import org.eclipse.equinox.internal.p2.publisher.eclipse.GeneratorBundleInfo;
import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
@@ -246,8 +247,12 @@ public class ConfigCUsAction extends AbstractPublisherAction {
String key = aProperty.getKey();
if (shouldPublishProperty(key) && !properties.contains(key)) {
properties.add(key);
- configurationData += "setProgramProperty(propName:" + key + ", propValue:" + aProperty.getValue() + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- unconfigurationData += "setProgramProperty(propName:" + key + ", propValue:);"; //$NON-NLS-1$ //$NON-NLS-2$
+ Map<String, String> parameters = new LinkedHashMap<String, String>();
+ parameters.put("propName", key); //$NON-NLS-1$
+ parameters.put("propValue", aProperty.getValue()); //$NON-NLS-1$
+ configurationData += TouchpointInstruction.encodeAction("setProgramProperty", parameters); //$NON-NLS-1$
+ parameters.put("propValue", ""); //$NON-NLS-1$//$NON-NLS-2$
+ unconfigurationData += TouchpointInstruction.encodeAction("setProgramProperty", parameters); //$NON-NLS-1$
}
}
}
@@ -270,6 +275,7 @@ public class ConfigCUsAction extends AbstractPublisherAction {
String configurationData = ""; //$NON-NLS-1$
String unconfigurationData = ""; //$NON-NLS-1$
+ Map<String, String> touchpointParameters = new LinkedHashMap<String, String>();
Set<String> jvmSet = new HashSet<String>();
Set<String> programSet = new HashSet<String>();
for (IExecutableAdvice advice : launchingAdvice) {
@@ -277,16 +283,20 @@ public class ConfigCUsAction extends AbstractPublisherAction {
for (int i = 0; i < jvmArgs.length; i++)
if (shouldPublishJvmArg(jvmArgs[i]) && !jvmSet.contains(jvmArgs[i])) {
jvmSet.add(jvmArgs[i]);
- configurationData += "addJvmArg(jvmArg:" + jvmArgs[i] + ");"; //$NON-NLS-1$ //$NON-NLS-2$
- unconfigurationData += "removeJvmArg(jvmArg:" + jvmArgs[i] + ");"; //$NON-NLS-1$ //$NON-NLS-2$
+ touchpointParameters.clear();
+ touchpointParameters.put("jvmArg", jvmArgs[i]); //$NON-NLS-1$
+ configurationData += TouchpointInstruction.encodeAction("addJvmArg", touchpointParameters); //$NON-NLS-1$
+ unconfigurationData += TouchpointInstruction.encodeAction("removeJvmArg", touchpointParameters); //$NON-NLS-1$
}
String[] programArgs = advice.getProgramArguments();
for (int i = 0; i < programArgs.length; i++)
if (shouldPublishProgramArg(programArgs[i]) && !programSet.contains(programArgs[i])) {
if (programArgs[i].startsWith("-")) //$NON-NLS-1$
programSet.add(programArgs[i]);
- configurationData += "addProgramArg(programArg:" + programArgs[i] + ");"; //$NON-NLS-1$ //$NON-NLS-2$
- unconfigurationData += "removeProgramArg(programArg:" + programArgs[i] + ");"; //$NON-NLS-1$ //$NON-NLS-2$
+ touchpointParameters.clear();
+ touchpointParameters.put("programArg", programArgs[i]); //$NON-NLS-1$
+ configurationData += TouchpointInstruction.encodeAction("addProgramArg", touchpointParameters); //$NON-NLS-1$
+ unconfigurationData += TouchpointInstruction.encodeAction("removeProgramArg", touchpointParameters); //$NON-NLS-1$
} else if (i + 1 < programArgs.length && !programArgs[i + 1].startsWith("-")) { //$NON-NLS-1$
// if we are not publishing then skip over the following arg as it is assumed to be a parameter
// to this command line arg.
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]);
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/ConfigCUsActionTest/level1/level2/config.ini b/bundles/org.eclipse.equinox.p2.tests/testData/ConfigCUsActionTest/level1/level2/config.ini
index 71fedcf8a..bd06ad55b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/testData/ConfigCUsActionTest/level1/level2/config.ini
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/ConfigCUsActionTest/level1/level2/config.ini
@@ -3,6 +3,7 @@ eclipse.p2.profile=PlatformProfile
osgi.bundles.defaultStartLevel=4
eclipse.product=org.eclipse.platform.ide
eclipse.buildId=TEST-ID
+my.property={a,b:c;$d}
osgi.bundles=org.eclipse.swt,\
org.eclipse.swt.win32.win32.x86,\
org.eclipse.swt.gtk.linux.x86,\
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/ProductActionTest/productFileActionTest.product b/bundles/org.eclipse.equinox.p2.tests/testData/ProductActionTest/productFileActionTest.product
index 863e14cd3..5890a0cc6 100644
--- a/bundles/org.eclipse.equinox.p2.tests/testData/ProductActionTest/productFileActionTest.product
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/ProductActionTest/productFileActionTest.product
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
-<product name="SampleProduct" version="1.0.0" useFeatures="false">
+<product name="SampleProduct" version="1.0.0" useFeatures="false" includeLaunchers="true">
-
- <configIni>
+ <configIni use="">
</configIni>
<launcherArgs>
+ <programArgs>-product &quot;com,ma&quot;</programArgs>
+ <vmArgs>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8272</vmArgs>
</launcherArgs>
<windowImages/>
-
<launcher>
<solaris/>
<win useIco="false">
@@ -21,7 +21,6 @@
</win>
</launcher>
-
<vm>
</vm>

Back to the top