1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
package org.eclipse.equinox.frameworkadmin.tests;
import org.eclipse.equinox.internal.provisional.frameworkadmin.FrameworkAdminRuntimeException;
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo;
import java.net.URISyntaxException;
import org.osgi.framework.BundleException;
import java.io.File;
import java.io.IOException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.provisional.frameworkadmin.*;
public class Bug258370 extends FwkAdminAndSimpleConfiguratorTest {
public Bug258370(String name) {
super(name);
// TODO Auto-generated constructor stub
}
public void testComma() {
FrameworkAdmin fwkAdmin = null;
try {
fwkAdmin = getEquinoxFrameworkAdmin();
} catch (BundleException e1) {
fail("0.0");
}
Manipulator manipulator = fwkAdmin.getManipulator();
File installFolder = Activator.getContext().getDataFile(SimpleConfiguratorTest.class.getName());
File configurationFolder = new File(installFolder, "configuration");
String launcherName = "eclipse";
LauncherData launcherData = manipulator.getLauncherData();
launcherData.setFwConfigLocation(configurationFolder);
launcherData.setLauncher(new File(installFolder, launcherName));
try {
try {
manipulator.load();
} catch (FrameworkAdminRuntimeException e) {
fail("1.0");
} catch (IOException e) {
fail("2.0");
}
} catch (IllegalStateException e) {
//TODO We ignore the framework JAR location not set exception
}
BundleInfo osgiBi = null;
BundleInfo bundle1Bi = null;
BundleInfo bundle2Bi = null;
try {
osgiBi = new BundleInfo("org.eclipse.osgi", "3.3.1", URIUtil.toURI(FileLocator.resolve(Activator.getContext().getBundle().getEntry("dataFile/org.eclipse.osgi.jar"))), 0, true);
bundle1Bi = new BundleInfo("bundle_1", "1.0.0", URIUtil.toURI(FileLocator.resolve(Activator.getContext().getBundle().getEntry("dataFile/bundle_1"))), 2, true);
bundle2Bi = new BundleInfo("bundle_2", "1.0.0", URIUtil.toURI(FileLocator.resolve(Activator.getContext().getBundle().getEntry("dataFile/bundle_2"))), 2, true);
} catch (URISyntaxException e) {
fail("3.0");
} catch (IOException e) {
fail("4.0");
}
manipulator.getConfigData().addBundle(osgiBi);
manipulator.getConfigData().addBundle(bundle1Bi);
manipulator.getConfigData().addBundle(bundle2Bi);
try {
manipulator.save(false);
} catch (FrameworkAdminRuntimeException e) {
fail("5.0");
} catch (IOException e) {
fail("6.0");
}
File configINI = new File(configurationFolder, "config.ini");
assertContent(configINI, "org.eclipse.osgi");
assertContent(configINI, "bundle_1");
assertContent(configINI, "bundle_2");
assertContent(configINI, "start,reference"); //This test for the presence of the comma.
}
}
|