Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2005, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2005, 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 |
Lines 16-22
Link Here
|
16 |
import junit.framework.Test; |
16 |
import junit.framework.Test; |
17 |
import junit.framework.TestSuite; |
17 |
import junit.framework.TestSuite; |
18 |
import org.eclipse.core.internal.content.*; |
18 |
import org.eclipse.core.internal.content.*; |
19 |
import org.eclipse.core.runtime.*; |
19 |
import org.eclipse.core.runtime.IPath; |
|
|
20 |
import org.eclipse.core.runtime.Platform; |
20 |
import org.eclipse.core.runtime.content.*; |
21 |
import org.eclipse.core.runtime.content.*; |
21 |
import org.eclipse.core.runtime.preferences.InstanceScope; |
22 |
import org.eclipse.core.runtime.preferences.InstanceScope; |
22 |
import org.eclipse.core.tests.harness.*; |
23 |
import org.eclipse.core.tests.harness.*; |
Lines 158-169
Link Here
|
158 |
return count; |
159 |
return count; |
159 |
} |
160 |
} |
160 |
|
161 |
|
|
|
162 |
public IPath getExtraPluginLocation() { |
163 |
return getTempDir().append(TEST_DATA_ID); |
164 |
} |
165 |
|
161 |
private Bundle installContentTypes(String tag, int numberOfLevels, int nodesPerLevel) { |
166 |
private Bundle installContentTypes(String tag, int numberOfLevels, int nodesPerLevel) { |
162 |
TestRegistryChangeListener listener = new TestRegistryChangeListener(Platform.PI_RUNTIME, ContentTypeBuilder.PT_CONTENTTYPES, null, null); |
167 |
TestRegistryChangeListener listener = new TestRegistryChangeListener(Platform.PI_RUNTIME, ContentTypeBuilder.PT_CONTENTTYPES, null, null); |
163 |
Bundle installed = null; |
168 |
Bundle installed = null; |
164 |
listener.register(); |
169 |
listener.register(); |
165 |
try { |
170 |
try { |
166 |
IPath pluginLocation = getRandomLocation(); |
171 |
IPath pluginLocation = getExtraPluginLocation(); |
167 |
pluginLocation.toFile().mkdirs(); |
172 |
pluginLocation.toFile().mkdirs(); |
168 |
URL installURL = null; |
173 |
URL installURL = null; |
169 |
try { |
174 |
try { |
Lines 267-289
Link Here
|
267 |
}.run(this, 10, 2); |
272 |
}.run(this, 10, 2); |
268 |
} |
273 |
} |
269 |
|
274 |
|
|
|
275 |
/* (non-Javadoc) |
276 |
* @see junit.framework.TestCase#setUp() |
277 |
*/ |
278 |
protected void setUp() throws Exception { |
279 |
super.setUp(); |
280 |
if (getName().equals("testDoSetUp") || getName().equals("testDoTearDown")) |
281 |
return; |
282 |
Bundle installed = null; |
283 |
try { |
284 |
installed = RuntimeTestsPlugin.getContext().installBundle(getExtraPluginLocation().toFile().toURL().toExternalForm()); |
285 |
} catch (BundleException e) { |
286 |
e.printStackTrace(); |
287 |
} catch (MalformedURLException e) { |
288 |
fail("4.99", e); |
289 |
} |
290 |
BundleTestingHelper.refreshPackages(RuntimeTestsPlugin.getContext(), new Bundle[] {installed}); |
291 |
} |
292 |
|
270 |
public void testDoSetUp() { |
293 |
public void testDoSetUp() { |
271 |
installContentTypes("1.0", NUMBER_OF_LEVELS, ELEMENTS_PER_LEVEL); |
294 |
installContentTypes("1.0", NUMBER_OF_LEVELS, ELEMENTS_PER_LEVEL); |
272 |
} |
295 |
} |
273 |
|
296 |
|
274 |
public void testDoTearDown() { |
297 |
public void testDoTearDown() { |
275 |
Bundle bundle = Platform.getBundle(TEST_DATA_ID); |
298 |
ensureDoesNotExistInFileSystem(getExtraPluginLocation().toFile()); |
276 |
if (bundle == null) |
|
|
277 |
// there is nothing to clean up (install failed?) |
278 |
fail("1.0 nothing to clean-up"); |
279 |
try { |
280 |
bundle.uninstall(); |
281 |
ensureDoesNotExistInFileSystem(new File(new URL(bundle.getLocation()).getFile())); |
282 |
} catch (MalformedURLException e) { |
283 |
fail("2.0", e); |
284 |
} catch (BundleException e) { |
285 |
fail("3.0", e); |
286 |
} |
287 |
} |
299 |
} |
288 |
|
300 |
|
289 |
public void testIsKindOf() { |
301 |
public void testIsKindOf() { |