Lines 1-340
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2008, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2008, 2009 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
7 |
* |
7 |
* |
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.pde.ui.tests.target; |
11 |
package org.eclipse.pde.ui.tests.target; |
12 |
|
12 |
|
13 |
import org.eclipse.core.runtime.CoreException; |
13 |
import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService; |
14 |
|
14 |
|
15 |
import org.eclipse.pde.internal.core.target.provisional.ITargetHandle; |
15 |
import org.eclipse.pde.internal.core.target.provisional.LoadTargetDefinitionJob; |
16 |
|
16 |
|
17 |
import org.eclipse.core.resources.IFile; |
17 |
import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition; |
18 |
|
18 |
|
19 |
import org.eclipse.core.resources.ResourcesPlugin; |
19 |
import java.io.*; |
20 |
|
20 |
import java.net.URL; |
21 |
import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService; |
21 |
import java.util.*; |
22 |
|
22 |
import java.util.zip.ZipEntry; |
23 |
import java.io.*; |
23 |
import java.util.zip.ZipFile; |
24 |
import java.net.URL; |
24 |
import junit.framework.TestCase; |
25 |
import java.util.*; |
25 |
import org.eclipse.core.resources.IFile; |
26 |
import java.util.zip.ZipEntry; |
26 |
import org.eclipse.core.resources.ResourcesPlugin; |
27 |
import java.util.zip.ZipFile; |
27 |
import org.eclipse.core.runtime.*; |
28 |
import junit.framework.TestCase; |
28 |
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo; |
29 |
import org.eclipse.core.runtime.*; |
29 |
import org.eclipse.pde.core.plugin.IPluginModelBase; |
30 |
import org.eclipse.equinox.internal.provisional.frameworkadmin.BundleInfo; |
30 |
import org.eclipse.pde.core.plugin.TargetPlatform; |
31 |
import org.eclipse.pde.core.plugin.TargetPlatform; |
31 |
import org.eclipse.pde.internal.core.*; |
32 |
import org.eclipse.pde.internal.core.*; |
32 |
import org.eclipse.pde.internal.core.target.provisional.*; |
33 |
import org.eclipse.pde.internal.core.target.provisional.*; |
33 |
import org.eclipse.pde.internal.ui.tests.macro.MacroPlugin; |
34 |
import org.eclipse.pde.internal.ui.tests.macro.MacroPlugin; |
34 |
import org.osgi.framework.ServiceReference; |
35 |
import org.osgi.framework.ServiceReference; |
35 |
|
36 |
|
36 |
/** |
37 |
/** |
37 |
* Tests for target definitions. |
38 |
* Tests for target definitions. |
38 |
* |
39 |
* |
39 |
* @since 3.5 |
40 |
* @since 3.5 |
40 |
*/ |
41 |
*/ |
41 |
public class TargetDefinitionTests extends TestCase { |
42 |
public class TargetDefinitionTests extends TestCase { |
42 |
|
43 |
|
43 |
/** |
44 |
/** |
44 |
* Retrieves all bundles (source and code) in the given target definition |
45 |
* Retrieves all bundles (source and code) in the given target definition |
45 |
* returning them as a set of URLs. |
46 |
* returning them as a set of URLs. |
46 |
* |
47 |
* |
47 |
* @param target target definition |
48 |
* @param target target definition |
48 |
* @return all bundle URLs |
49 |
* @return all bundle URLs |
49 |
*/ |
50 |
*/ |
50 |
protected Set getAllBundleURLs(ITargetDefinition target) throws Exception { |
51 |
protected Set getAllBundleURLs(ITargetDefinition target) throws Exception { |
51 |
BundleInfo[] code = target.resolveBundles(null); |
52 |
BundleInfo[] code = target.resolveBundles(null); |
52 |
BundleInfo[] source = target.resolveSourceBundles(null); |
53 |
BundleInfo[] source = target.resolveSourceBundles(null); |
53 |
Set urls = new HashSet(code.length + source.length); |
54 |
Set urls = new HashSet(code.length + source.length); |
54 |
for (int i = 0; i < code.length; i++) { |
55 |
for (int i = 0; i < code.length; i++) { |
55 |
urls.add(new File(code[i].getLocation()).toURL()); |
56 |
urls.add(new File(code[i].getLocation()).toURL()); |
56 |
} |
57 |
} |
57 |
for (int i = 0; i < source.length; i++) { |
58 |
for (int i = 0; i < source.length; i++) { |
58 |
urls.add(new File(source[i].getLocation()).toURL()); |
59 |
urls.add(new File(source[i].getLocation()).toURL()); |
59 |
} |
60 |
} |
60 |
return urls; |
61 |
return urls; |
61 |
} |
62 |
} |
62 |
|
63 |
|
63 |
/** |
64 |
/** |
64 |
* Extracts the classic plug-ins archive, if not already done, and returns a path to the |
65 |
* Extracts the classic plug-ins archive, if not already done, and returns a path to the |
65 |
* root directory containing the plug-ins. |
66 |
* root directory containing the plug-ins. |
66 |
* |
67 |
* |
67 |
* @return path to the plug-ins directory |
68 |
* @return path to the plug-ins directory |
68 |
* @throws Exception |
69 |
* @throws Exception |
69 |
*/ |
70 |
*/ |
70 |
protected IPath extractClassicPlugins() throws Exception { |
71 |
protected IPath extractClassicPlugins() throws Exception { |
71 |
// extract the 3.0.2 skeleton |
72 |
// extract the 3.0.2 skeleton |
72 |
IPath stateLocation = MacroPlugin.getDefault().getStateLocation(); |
73 |
IPath stateLocation = MacroPlugin.getDefault().getStateLocation(); |
73 |
IPath location = stateLocation.append("classic-plugins"); |
74 |
IPath location = stateLocation.append("classic-plugins"); |
74 |
if (location.toFile().exists()) { |
75 |
if (location.toFile().exists()) { |
75 |
return location; |
76 |
return location; |
76 |
} |
77 |
} |
77 |
URL zipURL = MacroPlugin.getBundleContext().getBundle().getEntry("/tests/targets/classic-plugins.zip"); |
78 |
URL zipURL = MacroPlugin.getBundleContext().getBundle().getEntry("/tests/targets/classic-plugins.zip"); |
78 |
Path zipPath = new Path(new File(FileLocator.toFileURL(zipURL).getFile()).getAbsolutePath()); |
79 |
Path zipPath = new Path(new File(FileLocator.toFileURL(zipURL).getFile()).getAbsolutePath()); |
79 |
ZipFile zipFile = new ZipFile(zipPath.toFile()); |
80 |
ZipFile zipFile = new ZipFile(zipPath.toFile()); |
80 |
Enumeration entries = zipFile.entries(); |
81 |
Enumeration entries = zipFile.entries(); |
81 |
while (entries.hasMoreElements()) { |
82 |
while (entries.hasMoreElements()) { |
82 |
ZipEntry entry = (ZipEntry) entries.nextElement(); |
83 |
ZipEntry entry = (ZipEntry) entries.nextElement(); |
83 |
if (!entry.isDirectory()) { |
84 |
if (!entry.isDirectory()) { |
84 |
IPath entryPath = stateLocation.append(entry.getName()); |
85 |
IPath entryPath = stateLocation.append(entry.getName()); |
85 |
File dir = entryPath.removeLastSegments(1).toFile(); |
86 |
File dir = entryPath.removeLastSegments(1).toFile(); |
86 |
dir.mkdirs(); |
87 |
dir.mkdirs(); |
87 |
File file = entryPath.toFile(); |
88 |
File file = entryPath.toFile(); |
88 |
file.createNewFile(); |
89 |
file.createNewFile(); |
89 |
InputStream inputStream = new BufferedInputStream(zipFile.getInputStream(entry)); |
90 |
InputStream inputStream = new BufferedInputStream(zipFile.getInputStream(entry)); |
90 |
byte[] bytes = getInputStreamAsByteArray(inputStream, -1); |
91 |
byte[] bytes = getInputStreamAsByteArray(inputStream, -1); |
91 |
inputStream.close(); |
92 |
inputStream.close(); |
92 |
BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(file)); |
93 |
BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(file)); |
93 |
outputStream.write(bytes); |
94 |
outputStream.write(bytes); |
94 |
outputStream.close(); |
95 |
outputStream.close(); |
95 |
} |
96 |
} |
96 |
} |
97 |
} |
97 |
zipFile.close(); |
98 |
zipFile.close(); |
98 |
return location; |
99 |
return location; |
99 |
} |
100 |
} |
100 |
|
101 |
|
101 |
/** |
102 |
/** |
102 |
* Returns the target platform service or <code>null</code> if none |
103 |
* Returns the target platform service or <code>null</code> if none |
103 |
* |
104 |
* |
104 |
* @return target platform service |
105 |
* @return target platform service |
105 |
*/ |
106 |
*/ |
106 |
protected ITargetPlatformService getTargetService() { |
107 |
protected ITargetPlatformService getTargetService() { |
107 |
ServiceReference reference = MacroPlugin.getBundleContext().getServiceReference(ITargetPlatformService.class.getName()); |
108 |
ServiceReference reference = MacroPlugin.getBundleContext().getServiceReference(ITargetPlatformService.class.getName()); |
108 |
assertNotNull("Missing target platform service", reference); |
109 |
assertNotNull("Missing target platform service", reference); |
109 |
if (reference == null) |
110 |
if (reference == null) |
110 |
return null; |
111 |
return null; |
111 |
return (ITargetPlatformService) MacroPlugin.getBundleContext().getService(reference); |
112 |
return (ITargetPlatformService) MacroPlugin.getBundleContext().getService(reference); |
112 |
} |
113 |
} |
113 |
|
114 |
|
114 |
/** |
115 |
/** |
115 |
* Returns a default target platform that takes target weaving into account |
116 |
* Tests that a target definition equivalent to the default target platform |
116 |
* if in a second instance of Eclipse. This allows the target platfrom to be |
117 |
* contains the same bundles as the default target platform (this is an |
117 |
* reset after changing it in a test. |
118 |
* explicit location with no target weaving). |
118 |
* |
119 |
* |
119 |
* @return default settings for target platform |
120 |
* @throws Exception |
120 |
*/ |
121 |
*/ |
121 |
protected ITargetDefinition getDefaultTargetPlatorm() { |
122 |
public void testDefaultTargetPlatform() throws Exception { |
122 |
ITargetDefinition definition = getTargetService().newTarget(); |
123 |
// the new way |
123 |
IBundleContainer container = getTargetService().newProfileContainer(TargetPlatform.getDefaultLocation(), |
124 |
ITargetDefinition definition = getTargetService().newTarget(); |
124 |
new File(Platform.getConfigurationLocation().getURL().getFile()).getAbsolutePath()); |
125 |
IBundleContainer container = getTargetService().newProfileContainer(TargetPlatform.getDefaultLocation()); |
125 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
126 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
126 |
return definition; |
127 |
Set urls = getAllBundleURLs(definition); |
127 |
} |
128 |
|
128 |
|
129 |
// the old way |
129 |
/** |
130 |
IPath location = new Path(TargetPlatform.getDefaultLocation()); |
130 |
* Used to reset the target platform to original settings after a test that changes |
131 |
URL[] pluginPaths = P2Utils.readBundlesTxt(location.toOSString(), location.append("configuration").toFile().toURL()); |
131 |
* the target platform. |
132 |
assertEquals("Should have same number of bundles", pluginPaths.length, urls.size()); |
132 |
*/ |
133 |
for (int i = 0; i < pluginPaths.length; i++) { |
133 |
protected void resetTargetPlatform() { |
134 |
URL url = pluginPaths[i]; |
134 |
ITargetDefinition definition = getDefaultTargetPlatorm(); |
135 |
assertTrue("Missing plug-in " + url.toString(), urls.contains(url)); |
135 |
setTargetPlatform(definition); |
136 |
} |
136 |
} |
137 |
|
137 |
|
138 |
} |
138 |
/** |
139 |
|
139 |
* Sets the target platform based on the given definition. |
140 |
/** |
140 |
* |
141 |
* Tests that a target definition equivalent to the default target platform |
141 |
* @param target target definition |
142 |
* contains the same bundles as the default target platform using the |
142 |
*/ |
143 |
* platform's configuration location (which will do target weaving). This |
143 |
protected void setTargetPlatform(ITargetDefinition target) { |
144 |
* is really only tested when run as a JUnit plug-in test suite from |
144 |
LoadTargetDefinitionJob job = new LoadTargetDefinitionJob(target); |
145 |
* within Eclipse. |
145 |
job.schedule(); |
146 |
* |
146 |
try { |
147 |
* @throws Exception |
147 |
job.join(); |
148 |
*/ |
148 |
} catch (InterruptedException e) { |
149 |
public void testWovenTargetPlatform() throws Exception { |
149 |
assertFalse("Target platform reset interrupted", true); |
150 |
// the new way |
150 |
} |
151 |
ITargetDefinition definition = getTargetService().newTarget(); |
151 |
} |
152 |
IBundleContainer container = getTargetService().newProfileContainer(TargetPlatform.getDefaultLocation(), |
152 |
|
153 |
new File(Platform.getConfigurationLocation().getURL().getFile()).getAbsolutePath()); |
153 |
/** |
154 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
154 |
* Tests that resetting the target platform should work OK (i.e. is equivalent to the |
155 |
Set urls = getAllBundleURLs(definition); |
155 |
* models in the default target platform). |
156 |
|
156 |
* |
157 |
// the old way |
157 |
* @throws CoreException |
158 |
URL[] pluginPaths = PluginPathFinder.getPluginPaths(TargetPlatform.getDefaultLocation()); |
158 |
*/ |
159 |
assertEquals("Should have same number of bundles", pluginPaths.length, urls.size()); |
159 |
public void testResetTargetPlatform() throws Exception { |
160 |
for (int i = 0; i < pluginPaths.length; i++) { |
160 |
ITargetDefinition definition = getDefaultTargetPlatorm(); |
161 |
URL url = pluginPaths[i]; |
161 |
Set urls = getAllBundleURLs(definition); |
162 |
assertTrue("Missing plug-in " + url.toString(), urls.contains(url)); |
162 |
|
163 |
} |
163 |
// current platform |
164 |
|
164 |
IPluginModelBase[] models = TargetPlatformHelper.getPDEState().getTargetModels(); |
165 |
} |
165 |
|
166 |
|
166 |
// should be equivalent |
167 |
/** |
167 |
assertEquals("Should have same number of bundles", urls.size(), models.length); |
168 |
* Tests that a bundle directory container is equivalent to scanning locations. |
168 |
for (int i = 0; i < models.length; i++) { |
169 |
* |
169 |
String location = models[i].getInstallLocation(); |
170 |
* @throws Exception |
170 |
assertTrue("Missing plug-in " + location, urls.contains(new File(location).toURL())); |
171 |
*/ |
171 |
} |
172 |
public void testDirectoryBundleContainer() throws Exception { |
172 |
} |
173 |
// the new way |
173 |
|
174 |
ITargetDefinition definition = getTargetService().newTarget(); |
174 |
/** |
175 |
IBundleContainer container = getTargetService().newDirectoryContainer(TargetPlatform.getDefaultLocation() + "/plugins"); |
175 |
* Tests that a target definition equivalent to the default target platform |
176 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
176 |
* contains the same bundles as the default target platform (this is an |
177 |
Set urls = getAllBundleURLs(definition); |
177 |
* explicit location with no target weaving). |
178 |
|
178 |
* |
179 |
Preferences store = PDECore.getDefault().getPluginPreferences(); |
179 |
* @throws Exception |
180 |
boolean restore = store.getBoolean(ICoreConstants.TARGET_PLATFORM_REALIZATION); |
180 |
*/ |
181 |
try { |
181 |
public void testDefaultTargetPlatform() throws Exception { |
182 |
store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, false); |
182 |
// the new way |
183 |
// the old way |
183 |
ITargetDefinition definition = getTargetService().newTarget(); |
184 |
URL[] pluginPaths = PluginPathFinder.getPluginPaths(TargetPlatform.getDefaultLocation()); |
184 |
IBundleContainer container = getTargetService().newProfileContainer(TargetPlatform.getDefaultLocation()); |
185 |
assertEquals("Should have same number of bundles", pluginPaths.length, urls.size()); |
185 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
186 |
for (int i = 0; i < pluginPaths.length; i++) { |
186 |
Set urls = getAllBundleURLs(definition); |
187 |
URL url = pluginPaths[i]; |
187 |
|
188 |
assertTrue("Missing plug-in " + url.toString(), urls.contains(url)); |
188 |
// the old way |
189 |
} |
189 |
IPath location = new Path(TargetPlatform.getDefaultLocation()); |
190 |
} |
190 |
URL[] pluginPaths = P2Utils.readBundlesTxt(location.toOSString(), location.append("configuration").toFile().toURL()); |
191 |
finally { |
191 |
assertEquals("Should have same number of bundles", pluginPaths.length, urls.size()); |
192 |
store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, restore); |
192 |
for (int i = 0; i < pluginPaths.length; i++) { |
193 |
} |
193 |
URL url = pluginPaths[i]; |
194 |
} |
194 |
assertTrue("Missing plug-in " + url.toString(), urls.contains(url)); |
195 |
|
195 |
} |
196 |
/** |
196 |
|
197 |
* Tests reading a 3.0.2 install with a mix of classic and OSGi plug-ins. |
197 |
} |
198 |
* |
198 |
|
199 |
* @throws Exception |
199 |
/** |
200 |
*/ |
200 |
* Tests that a target definition equivalent to the default target platform |
201 |
public void testClassicPlugins() throws Exception { |
201 |
* contains the same bundles as the default target platform (this is an |
202 |
// extract the 3.0.2 skeleton |
202 |
* explicit location with no target weaving), when created with a variable |
203 |
IPath location = extractClassicPlugins(); |
203 |
* referencing ${eclipse_home} |
204 |
|
204 |
* |
205 |
// the new way |
205 |
* @throws Exception |
206 |
ITargetDefinition definition = getTargetService().newTarget(); |
206 |
*/ |
207 |
IBundleContainer container = getTargetService().newDirectoryContainer(location.toOSString()); |
207 |
public void testEclipseHomeTargetPlatform() throws Exception { |
208 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
208 |
// the new way |
209 |
Set urls = getAllBundleURLs(definition); |
209 |
ITargetDefinition definition = getTargetService().newTarget(); |
210 |
|
210 |
IBundleContainer container = getTargetService().newProfileContainer("${eclipse_home}"); |
211 |
Preferences store = PDECore.getDefault().getPluginPreferences(); |
211 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
212 |
boolean restore = store.getBoolean(ICoreConstants.TARGET_PLATFORM_REALIZATION); |
212 |
Set urls = getAllBundleURLs(definition); |
213 |
try { |
213 |
|
214 |
store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, false); |
214 |
// the old way |
215 |
// the old way |
215 |
IPath location = new Path(TargetPlatform.getDefaultLocation()); |
216 |
URL[] pluginPaths = PluginPathFinder.getPluginPaths(location.toOSString()); |
216 |
URL[] pluginPaths = P2Utils.readBundlesTxt(location.toOSString(), location.append("configuration").toFile().toURL()); |
217 |
for (int i = 0; i < pluginPaths.length; i++) { |
217 |
assertEquals("Should have same number of bundles", pluginPaths.length, urls.size()); |
218 |
URL url = pluginPaths[i]; |
218 |
for (int i = 0; i < pluginPaths.length; i++) { |
219 |
if (!urls.contains(url)) { |
219 |
URL url = pluginPaths[i]; |
220 |
System.err.println(url.toString()); |
220 |
assertTrue("Missing plug-in " + url.toString(), urls.contains(url)); |
221 |
} |
221 |
} |
222 |
} |
222 |
|
223 |
assertEquals("Wrong number of bundles", pluginPaths.length, urls.size()); |
223 |
} |
224 |
} |
224 |
|
225 |
finally { |
225 |
/** |
226 |
store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, restore); |
226 |
* Tests that a target definition equivalent to the default target platform |
227 |
} |
227 |
* contains the same bundles as the default target platform (this is an |
228 |
} |
228 |
* explicit location with no target weaving), when created with a variable |
229 |
|
229 |
* referencing ${eclipse_home}. |
230 |
/** |
230 |
* |
231 |
* Tests identification of source bundles in a 3.0.2 install. |
231 |
* @throws Exception |
232 |
* |
232 |
*/ |
233 |
* @throws Exception |
233 |
public void testEclipseHomeTargetPlatformAndConfigurationArea() throws Exception { |
234 |
*/ |
234 |
// the new way |
235 |
public void testClassicSourcePlugins() throws Exception { |
235 |
ITargetDefinition definition = getTargetService().newTarget(); |
236 |
// extract the 3.0.2 skeleton |
236 |
IBundleContainer container = getTargetService().newProfileContainer("${eclipse_home}", "${eclipse_home}/configuration"); |
237 |
IPath location = extractClassicPlugins(); |
237 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
238 |
|
238 |
Set urls = getAllBundleURLs(definition); |
239 |
// the new way |
239 |
|
240 |
ITargetDefinition definition = getTargetService().newTarget(); |
240 |
// the old way |
241 |
IBundleContainer container = getTargetService().newDirectoryContainer(location.toOSString()); |
241 |
IPath location = new Path(TargetPlatform.getDefaultLocation()); |
242 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
242 |
URL[] pluginPaths = P2Utils.readBundlesTxt(location.toOSString(), location.append("configuration").toFile().toURL()); |
243 |
BundleInfo[] bundles = definition.resolveSourceBundles(null); |
243 |
assertEquals("Should have same number of bundles", pluginPaths.length, urls.size()); |
244 |
assertEquals("Wrong number of source bundles", 3, bundles.length); |
244 |
for (int i = 0; i < pluginPaths.length; i++) { |
245 |
Set names = new HashSet(); |
245 |
URL url = pluginPaths[i]; |
246 |
for (int i = 0; i < bundles.length; i++) { |
246 |
assertTrue("Missing plug-in " + url.toString(), urls.contains(url)); |
247 |
names.add(bundles[i].getSymbolicName()); |
247 |
} |
248 |
} |
248 |
|
249 |
String[] expected = new String[]{"org.eclipse.platform.source", "org.eclipse.jdt.source", "org.eclipse.pde.source"}; |
249 |
} |
250 |
for (int i = 0; i < expected.length; i++) { |
250 |
|
251 |
assertTrue("Missing source for " + expected[i], names.contains(expected[i])); |
251 |
/** |
252 |
} |
252 |
* Tests that a target definition equivalent to the default target platform |
253 |
} |
253 |
* contains the same bundles as the default target platform using the |
254 |
|
254 |
* platform's configuration location (which will do target weaving). This |
255 |
/** |
255 |
* is really only tested when run as a JUnit plug-in test suite from |
256 |
* Returns the given input stream as a byte array |
256 |
* within Eclipse. |
257 |
* @param stream the stream to get as a byte array |
257 |
* |
258 |
* @param length the length to read from the stream or -1 for unknown |
258 |
* @throws Exception |
259 |
* @return the given input stream as a byte array |
259 |
*/ |
260 |
* @throws IOException |
260 |
public void testWovenTargetPlatform() throws Exception { |
261 |
*/ |
261 |
// the new way |
262 |
public static byte[] getInputStreamAsByteArray(InputStream stream, int length) throws IOException { |
262 |
ITargetDefinition definition = getTargetService().newTarget(); |
263 |
byte[] contents; |
263 |
IBundleContainer container = getTargetService().newProfileContainer(TargetPlatform.getDefaultLocation(), |
264 |
if (length == -1) { |
264 |
new File(Platform.getConfigurationLocation().getURL().getFile()).getAbsolutePath()); |
265 |
contents = new byte[0]; |
265 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
266 |
int contentsLength = 0; |
266 |
Set urls = getAllBundleURLs(definition); |
267 |
int amountRead = -1; |
267 |
|
268 |
do { |
268 |
// the old way |
269 |
// read at least 8K |
269 |
URL[] pluginPaths = PluginPathFinder.getPluginPaths(TargetPlatform.getDefaultLocation()); |
270 |
int amountRequested = Math.max(stream.available(), 8192); |
270 |
assertEquals("Should have same number of bundles", pluginPaths.length, urls.size()); |
271 |
// resize contents if needed |
271 |
for (int i = 0; i < pluginPaths.length; i++) { |
272 |
if (contentsLength + amountRequested > contents.length) { |
272 |
URL url = pluginPaths[i]; |
273 |
System.arraycopy(contents, |
273 |
assertTrue("Missing plug-in " + url.toString(), urls.contains(url)); |
274 |
0, |
274 |
} |
275 |
contents = new byte[contentsLength + amountRequested], |
275 |
|
276 |
0, |
276 |
} |
277 |
contentsLength); |
277 |
|
278 |
} |
278 |
/** |
279 |
// read as many bytes as possible |
279 |
* Tests that a bundle directory container is equivalent to scanning locations. |
280 |
amountRead = stream.read(contents, contentsLength, amountRequested); |
280 |
* |
281 |
if (amountRead > 0) { |
281 |
* @throws Exception |
282 |
// remember length of contents |
282 |
*/ |
283 |
contentsLength += amountRead; |
283 |
public void testDirectoryBundleContainer() throws Exception { |
284 |
} |
284 |
// the new way |
285 |
} while (amountRead != -1); |
285 |
ITargetDefinition definition = getTargetService().newTarget(); |
286 |
// resize contents if necessary |
286 |
IBundleContainer container = getTargetService().newDirectoryContainer(TargetPlatform.getDefaultLocation() + "/plugins"); |
287 |
if (contentsLength < contents.length) { |
287 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
288 |
System.arraycopy(contents, 0, contents = new byte[contentsLength], 0, contentsLength); |
288 |
Set urls = getAllBundleURLs(definition); |
289 |
} |
289 |
|
290 |
} else { |
290 |
Preferences store = PDECore.getDefault().getPluginPreferences(); |
291 |
contents = new byte[length]; |
291 |
boolean restore = store.getBoolean(ICoreConstants.TARGET_PLATFORM_REALIZATION); |
292 |
int len = 0; |
292 |
try { |
293 |
int readSize = 0; |
293 |
store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, false); |
294 |
while ((readSize != -1) && (len != length)) { |
294 |
// the old way |
295 |
// See PR 1FMS89U |
295 |
URL[] pluginPaths = PluginPathFinder.getPluginPaths(TargetPlatform.getDefaultLocation()); |
296 |
// We record first the read size. In this case length is the actual |
296 |
assertEquals("Should have same number of bundles", pluginPaths.length, urls.size()); |
297 |
// read size. |
297 |
for (int i = 0; i < pluginPaths.length; i++) { |
298 |
len += readSize; |
298 |
URL url = pluginPaths[i]; |
299 |
readSize = stream.read(contents, len, length - len); |
299 |
assertTrue("Missing plug-in " + url.toString(), urls.contains(url)); |
300 |
} |
300 |
} |
301 |
} |
301 |
} |
302 |
return contents; |
302 |
finally { |
303 |
} |
303 |
store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, restore); |
304 |
|
304 |
} |
305 |
/** |
305 |
} |
306 |
* Tests restoration of a handle to target definition in an IFile |
306 |
|
307 |
* @throws CoreException |
307 |
/** |
308 |
*/ |
308 |
* Tests that a bundle directory container is equivalent to scanning locations |
309 |
public void testWorkspaceTargetHandleMemento() throws CoreException { |
309 |
* when it uses a variable to specify its location. |
310 |
ITargetPlatformService service = getTargetService(); |
310 |
* |
311 |
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("does/not/exist")); |
311 |
* @throws Exception |
312 |
ITargetHandle handle = service.getTarget(file); |
312 |
*/ |
313 |
assertFalse("Target should not exist", handle.exists()); |
313 |
public void testVariableDirectoryBundleContainer() throws Exception { |
314 |
String memento = handle.getMemento(); |
314 |
// the new way |
315 |
assertNotNull("Missing memento", memento); |
315 |
ITargetDefinition definition = getTargetService().newTarget(); |
316 |
ITargetHandle handle2 = service.getTarget(memento); |
316 |
IBundleContainer container = getTargetService().newDirectoryContainer("${eclipse_home}/plugins"); |
317 |
assertEquals("Restore failed", handle, handle2); |
317 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
318 |
IFile file2 = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("does/not/exist/either")); |
318 |
Set urls = getAllBundleURLs(definition); |
319 |
ITargetHandle handle3 = service.getTarget(file2); |
319 |
|
320 |
assertFalse("Should be different targets", handle.equals(handle3)); |
320 |
Preferences store = PDECore.getDefault().getPluginPreferences(); |
321 |
} |
321 |
boolean restore = store.getBoolean(ICoreConstants.TARGET_PLATFORM_REALIZATION); |
322 |
|
322 |
try { |
323 |
/** |
323 |
store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, false); |
324 |
* Tests restoration of a handle to target definition in local metadata |
324 |
// the old way |
325 |
* |
325 |
URL[] pluginPaths = PluginPathFinder.getPluginPaths(TargetPlatform.getDefaultLocation()); |
326 |
* @throws CoreException |
326 |
assertEquals("Should have same number of bundles", pluginPaths.length, urls.size()); |
327 |
* @throws InterruptedException |
327 |
for (int i = 0; i < pluginPaths.length; i++) { |
328 |
*/ |
328 |
URL url = pluginPaths[i]; |
329 |
public void testLocalTargetHandleMemento() throws CoreException, InterruptedException { |
329 |
assertTrue("Missing plug-in " + url.toString(), urls.contains(url)); |
330 |
ITargetPlatformService service = getTargetService(); |
330 |
} |
331 |
ITargetHandle handle = service.newTarget().getHandle(); |
331 |
} |
332 |
assertFalse("Target should not exist", handle.exists()); |
332 |
finally { |
333 |
String memento = handle.getMemento(); |
333 |
store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, restore); |
334 |
assertNotNull("Missing memento", memento); |
334 |
} |
335 |
ITargetHandle handle2 = service.getTarget(memento); |
335 |
} |
336 |
assertEquals("Restore failed", handle, handle2); |
336 |
|
337 |
ITargetHandle handle3 = service.newTarget().getHandle(); |
337 |
/** |
338 |
assertFalse("Should be different targets", handle.equals(handle3)); |
338 |
* Tests reading a 3.0.2 install with a mix of classic and OSGi plug-ins. |
339 |
} |
339 |
* |
340 |
} |
340 |
* @throws Exception |
|
|
341 |
*/ |
342 |
public void testClassicPlugins() throws Exception { |
343 |
// extract the 3.0.2 skeleton |
344 |
IPath location = extractClassicPlugins(); |
345 |
|
346 |
// the new way |
347 |
ITargetDefinition definition = getTargetService().newTarget(); |
348 |
IBundleContainer container = getTargetService().newDirectoryContainer(location.toOSString()); |
349 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
350 |
Set urls = getAllBundleURLs(definition); |
351 |
|
352 |
Preferences store = PDECore.getDefault().getPluginPreferences(); |
353 |
boolean restore = store.getBoolean(ICoreConstants.TARGET_PLATFORM_REALIZATION); |
354 |
try { |
355 |
store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, false); |
356 |
// the old way |
357 |
URL[] pluginPaths = PluginPathFinder.getPluginPaths(location.toOSString()); |
358 |
for (int i = 0; i < pluginPaths.length; i++) { |
359 |
URL url = pluginPaths[i]; |
360 |
if (!urls.contains(url)) { |
361 |
System.err.println(url.toString()); |
362 |
} |
363 |
} |
364 |
assertEquals("Wrong number of bundles", pluginPaths.length, urls.size()); |
365 |
} |
366 |
finally { |
367 |
store.setValue(ICoreConstants.TARGET_PLATFORM_REALIZATION, restore); |
368 |
} |
369 |
} |
370 |
|
371 |
/** |
372 |
* Tests identification of source bundles in a 3.0.2 install. |
373 |
* |
374 |
* @throws Exception |
375 |
*/ |
376 |
public void testClassicSourcePlugins() throws Exception { |
377 |
// extract the 3.0.2 skeleton |
378 |
IPath location = extractClassicPlugins(); |
379 |
|
380 |
// the new way |
381 |
ITargetDefinition definition = getTargetService().newTarget(); |
382 |
IBundleContainer container = getTargetService().newDirectoryContainer(location.toOSString()); |
383 |
definition.setBundleContainers(new IBundleContainer[]{container}); |
384 |
BundleInfo[] bundles = definition.resolveSourceBundles(null); |
385 |
assertEquals("Wrong number of source bundles", 3, bundles.length); |
386 |
Set names = new HashSet(); |
387 |
for (int i = 0; i < bundles.length; i++) { |
388 |
names.add(bundles[i].getSymbolicName()); |
389 |
} |
390 |
String[] expected = new String[]{"org.eclipse.platform.source", "org.eclipse.jdt.source", "org.eclipse.pde.source"}; |
391 |
for (int i = 0; i < expected.length; i++) { |
392 |
assertTrue("Missing source for " + expected[i], names.contains(expected[i])); |
393 |
} |
394 |
} |
395 |
|
396 |
/** |
397 |
* Returns the given input stream as a byte array |
398 |
* @param stream the stream to get as a byte array |
399 |
* @param length the length to read from the stream or -1 for unknown |
400 |
* @return the given input stream as a byte array |
401 |
* @throws IOException |
402 |
*/ |
403 |
public static byte[] getInputStreamAsByteArray(InputStream stream, int length) throws IOException { |
404 |
byte[] contents; |
405 |
if (length == -1) { |
406 |
contents = new byte[0]; |
407 |
int contentsLength = 0; |
408 |
int amountRead = -1; |
409 |
do { |
410 |
// read at least 8K |
411 |
int amountRequested = Math.max(stream.available(), 8192); |
412 |
// resize contents if needed |
413 |
if (contentsLength + amountRequested > contents.length) { |
414 |
System.arraycopy(contents, |
415 |
0, |
416 |
contents = new byte[contentsLength + amountRequested], |
417 |
0, |
418 |
contentsLength); |
419 |
} |
420 |
// read as many bytes as possible |
421 |
amountRead = stream.read(contents, contentsLength, amountRequested); |
422 |
if (amountRead > 0) { |
423 |
// remember length of contents |
424 |
contentsLength += amountRead; |
425 |
} |
426 |
} while (amountRead != -1); |
427 |
// resize contents if necessary |
428 |
if (contentsLength < contents.length) { |
429 |
System.arraycopy(contents, 0, contents = new byte[contentsLength], 0, contentsLength); |
430 |
} |
431 |
} else { |
432 |
contents = new byte[length]; |
433 |
int len = 0; |
434 |
int readSize = 0; |
435 |
while ((readSize != -1) && (len != length)) { |
436 |
// See PR 1FMS89U |
437 |
// We record first the read size. In this case length is the actual |
438 |
// read size. |
439 |
len += readSize; |
440 |
readSize = stream.read(contents, len, length - len); |
441 |
} |
442 |
} |
443 |
return contents; |
444 |
} |
445 |
|
446 |
/** |
447 |
* Tests restoration of a handle to target definition in an IFile |
448 |
* @throws CoreException |
449 |
*/ |
450 |
public void testWorkspaceTargetHandleMemento() throws CoreException { |
451 |
ITargetPlatformService service = getTargetService(); |
452 |
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("does/not/exist")); |
453 |
ITargetHandle handle = service.getTarget(file); |
454 |
assertFalse("Target should not exist", handle.exists()); |
455 |
String memento = handle.getMemento(); |
456 |
assertNotNull("Missing memento", memento); |
457 |
ITargetHandle handle2 = service.getTarget(memento); |
458 |
assertEquals("Restore failed", handle, handle2); |
459 |
IFile file2 = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("does/not/exist/either")); |
460 |
ITargetHandle handle3 = service.getTarget(file2); |
461 |
assertFalse("Should be different targets", handle.equals(handle3)); |
462 |
} |
463 |
|
464 |
/** |
465 |
* Tests restoration of a handle to target definition in local metadata |
466 |
* |
467 |
* @throws CoreException |
468 |
* @throws InterruptedException |
469 |
*/ |
470 |
public void testLocalTargetHandleMemento() throws CoreException, InterruptedException { |
471 |
ITargetPlatformService service = getTargetService(); |
472 |
ITargetHandle handle = service.newTarget().getHandle(); |
473 |
assertFalse("Target should not exist", handle.exists()); |
474 |
String memento = handle.getMemento(); |
475 |
assertNotNull("Missing memento", memento); |
476 |
ITargetHandle handle2 = service.getTarget(memento); |
477 |
assertEquals("Restore failed", handle, handle2); |
478 |
ITargetHandle handle3 = service.newTarget().getHandle(); |
479 |
assertFalse("Should be different targets", handle.equals(handle3)); |
480 |
} |
481 |
|
482 |
/** |
483 |
* Returns the location of the JDT feature in the running host as |
484 |
* a path in the local file system. |
485 |
* |
486 |
* @return path to JDT feature |
487 |
*/ |
488 |
protected IPath getJdtFeatureLocation() { |
489 |
IPath path = new Path(TargetPlatform.getDefaultLocation()); |
490 |
path = path.append("features"); |
491 |
File dir = path.toFile(); |
492 |
assertTrue("Missing features directory", dir.exists() && !dir.isFile()); |
493 |
String[] files = dir.list(); |
494 |
String location = null; |
495 |
for (int i = 0; i < files.length; i++) { |
496 |
if (files[i].startsWith("org.eclipse.jdt_")) { |
497 |
location = path.append(files[i]).toOSString(); |
498 |
break; |
499 |
} |
500 |
} |
501 |
assertNotNull("Missing JDT feature", location); |
502 |
return new Path(location); |
503 |
} |
504 |
|
505 |
/** |
506 |
* Tests a JDT feature bundle container contains the appropriate bundles |
507 |
* @throws Exception |
508 |
*/ |
509 |
public void testFeatureBundleContainer() throws Exception { |
510 |
IBundleContainer container = getTargetService().newFeatureContainer("${eclipse_home}", "org.eclipse.jdt", null); |
511 |
BundleInfo[] bundles = container.resolveBundles(null); |
512 |
|
513 |
Set expected = new HashSet(); |
514 |
expected.add("org.eclipse.jdt"); |
515 |
expected.add("org.eclipse.ant.ui"); |
516 |
expected.add("org.eclipse.jdt.apt.core"); |
517 |
expected.add("org.eclipse.jdt.apt.ui"); |
518 |
expected.add("org.eclipse.jdt.apt.pluggable.core"); |
519 |
expected.add("org.eclipse.jdt.compiler.apt"); |
520 |
expected.add("org.eclipse.jdt.compiler.tool"); |
521 |
expected.add("org.eclipse.jdt.core"); |
522 |
expected.add("org.eclipse.jdt.core.manipulation"); |
523 |
expected.add("org.eclipse.jdt.debug.ui"); |
524 |
expected.add("org.eclipse.jdt.debug"); |
525 |
expected.add("org.eclipse.jdt.junit"); |
526 |
expected.add("org.eclipse.jdt.junit.runtime"); |
527 |
expected.add("org.eclipse.jdt.junit4.runtime"); |
528 |
expected.add("org.eclipse.jdt.launching"); |
529 |
expected.add("org.eclipse.jdt.ui"); |
530 |
expected.add("org.junit"); |
531 |
expected.add("org.junit4"); |
532 |
expected.add("org.eclipse.jdt.doc.user"); |
533 |
if (Platform.getOS() == Platform.OS_MACOSX) { |
534 |
expected.add("org.eclipse.jdt.launching.macosx"); |
535 |
} |
536 |
assertEquals("Wrong number of bundles in JDT feature", expected.size(), bundles.length); |
537 |
for (int i = 0; i < bundles.length; i++) { |
538 |
expected.remove(bundles[i].getSymbolicName()); |
539 |
} |
540 |
Iterator iterator = expected.iterator(); |
541 |
while (iterator.hasNext()) { |
542 |
String name = (String) iterator.next(); |
543 |
System.err.println("Missing: " + name); |
544 |
} |
545 |
assertTrue("Wrong bundles in JDT feature", expected.isEmpty()); |
546 |
|
547 |
|
548 |
// should be no source bundles |
549 |
bundles = container.resolveSourceBundles(null); |
550 |
assertEquals("Wrong source bundle count", 0, bundles.length); |
551 |
} |
552 |
|
553 |
/** |
554 |
* Tests a JDT source feature bundle container contains the appropriate bundles |
555 |
* @throws Exception |
556 |
*/ |
557 |
public void testSourceFeatureBundleContainer() throws Exception { |
558 |
IBundleContainer container = getTargetService().newFeatureContainer("${eclipse_home}", "org.eclipse.jdt.source", null); |
559 |
BundleInfo[] bundles = container.resolveSourceBundles(null); |
560 |
|
561 |
Set expected = new HashSet(); |
562 |
expected.add("org.eclipse.jdt.source"); |
563 |
expected.add("org.eclipse.ant.ui.source"); |
564 |
expected.add("org.eclipse.jdt.apt.core.source"); |
565 |
expected.add("org.eclipse.jdt.apt.ui.source"); |
566 |
expected.add("org.eclipse.jdt.apt.pluggable.core.source"); |
567 |
expected.add("org.eclipse.jdt.compiler.apt.source"); |
568 |
expected.add("org.eclipse.jdt.compiler.tool.source"); |
569 |
expected.add("org.eclipse.jdt.core.source"); |
570 |
expected.add("org.eclipse.jdt.core.manipulation.source"); |
571 |
expected.add("org.eclipse.jdt.debug.ui.source"); |
572 |
expected.add("org.eclipse.jdt.debug.source"); |
573 |
expected.add("org.eclipse.jdt.junit.source"); |
574 |
expected.add("org.eclipse.jdt.junit.runtime.source"); |
575 |
expected.add("org.eclipse.jdt.junit4.runtime.source"); |
576 |
expected.add("org.eclipse.jdt.launching.source"); |
577 |
expected.add("org.eclipse.jdt.ui.source"); |
578 |
expected.add("org.junit.source"); |
579 |
expected.add("org.junit4.source"); |
580 |
if (Platform.getOS() == Platform.OS_MACOSX) { |
581 |
expected.add("org.eclipse.jdt.launching.macosx.source"); |
582 |
} |
583 |
for (int i = 0; i < bundles.length; i++) { |
584 |
expected.remove(bundles[i].getSymbolicName()); |
585 |
} |
586 |
Iterator iterator = expected.iterator(); |
587 |
while (iterator.hasNext()) { |
588 |
String name = (String) iterator.next(); |
589 |
System.err.println("Missing: " + name); |
590 |
} |
591 |
assertTrue("Wrong bundles in JDT feature", expected.isEmpty()); |
592 |
|
593 |
|
594 |
// should be one doc bundle |
595 |
bundles = container.resolveBundles(null); |
596 |
assertEquals("Wrong bundle count", 1, bundles.length); |
597 |
assertEquals("Missing bundle", "org.eclipse.jdt.doc.isv", bundles[0].getSymbolicName()); |
598 |
} |
599 |
|
600 |
|
601 |
/** |
602 |
* Tests setting the target platform to the JDT feature with a specific version. |
603 |
* |
604 |
* @throws Exception |
605 |
*/ |
606 |
public void testSetTargetPlatformToJdtFeature() throws Exception { |
607 |
try { |
608 |
IPath location = getJdtFeatureLocation(); |
609 |
String segment = location.lastSegment(); |
610 |
int index = segment.indexOf('_'); |
611 |
assertTrue("Missing version id", index > 0); |
612 |
String version = segment.substring(index + 1); |
613 |
ITargetPlatformService targetService = getTargetService(); |
614 |
IBundleContainer container = targetService.newFeatureContainer("${eclipse_home}", "org.eclipse.jdt", version); |
615 |
ITargetDefinition target = targetService.newTarget(); |
616 |
target.setBundleContainers(new IBundleContainer[]{container}); |
617 |
|
618 |
setTargetPlatform(target); |
619 |
|
620 |
Set expected = new HashSet(); |
621 |
expected.add("org.eclipse.jdt"); |
622 |
expected.add("org.eclipse.ant.ui"); |
623 |
expected.add("org.eclipse.jdt.apt.core"); |
624 |
expected.add("org.eclipse.jdt.apt.ui"); |
625 |
expected.add("org.eclipse.jdt.apt.pluggable.core"); |
626 |
expected.add("org.eclipse.jdt.compiler.apt"); |
627 |
expected.add("org.eclipse.jdt.compiler.tool"); |
628 |
expected.add("org.eclipse.jdt.core"); |
629 |
expected.add("org.eclipse.jdt.core.manipulation"); |
630 |
expected.add("org.eclipse.jdt.debug.ui"); |
631 |
expected.add("org.eclipse.jdt.debug"); |
632 |
expected.add("org.eclipse.jdt.junit"); |
633 |
expected.add("org.eclipse.jdt.junit.runtime"); |
634 |
expected.add("org.eclipse.jdt.junit4.runtime"); |
635 |
expected.add("org.eclipse.jdt.launching"); |
636 |
expected.add("org.eclipse.jdt.ui"); |
637 |
expected.add("org.junit"); |
638 |
expected.add("org.junit4"); |
639 |
expected.add("org.eclipse.jdt.doc.user"); |
640 |
if (Platform.getOS() == Platform.OS_MACOSX) { |
641 |
expected.add("org.eclipse.jdt.launching.macosx"); |
642 |
} |
643 |
|
644 |
// current platform |
645 |
IPluginModelBase[] models = TargetPlatformHelper.getPDEState().getTargetModels(); |
646 |
|
647 |
assertEquals("Wrong number of bundles in JDT feature", expected.size(), models.length); |
648 |
for (int i = 0; i < models.length; i++) { |
649 |
expected.remove(models[i].getPluginBase().getId()); |
650 |
} |
651 |
Iterator iterator = expected.iterator(); |
652 |
while (iterator.hasNext()) { |
653 |
String name = (String) iterator.next(); |
654 |
System.err.println("Missing: " + name); |
655 |
} |
656 |
assertTrue("Wrong bundles in target platform", expected.isEmpty()); |
657 |
} finally { |
658 |
resetTargetPlatform(); |
659 |
} |
660 |
} |
661 |
|
662 |
/** |
663 |
* Tests setting the target platform to empty. |
664 |
*/ |
665 |
public void testSetEmptyTargetPlatform() { |
666 |
try { |
667 |
ITargetPlatformService targetService = getTargetService(); |
668 |
ITargetDefinition target = targetService.newTarget(); |
669 |
|
670 |
setTargetPlatform(target); |
671 |
|
672 |
// current platform |
673 |
IPluginModelBase[] models = TargetPlatformHelper.getPDEState().getTargetModels(); |
674 |
|
675 |
assertEquals("Wrong number of bundles in empty target", 0, models.length); |
676 |
|
677 |
} finally { |
678 |
resetTargetPlatform(); |
679 |
} |
680 |
} |
681 |
} |