Skip to main content
summaryrefslogtreecommitdiffstats
blob: aecb53309a57e73e3d42eaa91a6543625247c793 (plain) (blame)
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
/*******************************************************************************
 *  Copyright (c) 2009 IBM Corporation and others.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 * 
 *  Contributors:
 *      IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.equinox.frameworkadmin.tests;

import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.frameworkadmin.BundleInfo;
import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator;
import org.osgi.framework.Constants;

public class FrameworkExtensionTest extends FwkAdminAndSimpleConfiguratorTest {

	public FrameworkExtensionTest(String name) {
		super(name);
	}
	
	public void testAddRemoveFrameworkExtension() throws Exception  {
		Manipulator manipulator = createMinimalConfiguration(FrameworkExtensionTest.class.getName());
		BundleInfo bundleInfo = new BundleInfo("dummy.frameworkextension", "1.0.0", URIUtil.toURI(FileLocator.resolve(Activator.getContext().getBundle().getEntry("dataFile/dummy.frameworkextension_1.0.0.jar"))), 4, false);
		bundleInfo.setFragmentHost(Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
		manipulator.getConfigData().addBundle(bundleInfo);
		manipulator.save(false);
		assertContent(getBundleTxt(), "dummy.frameworkextension");
		assertPropertyContains(getConfigIni(),"osgi.framework.extensions", "dummy.frameworkextension");
		assertNotPropertyContains(getConfigIni(),"osgi.bundles", "dummy.frameworkextension");
		
		BundleInfo basicBundleInfo = new BundleInfo("dummy.frameworkextension", "1.0.0", null, -1, false);
		manipulator.getConfigData().removeBundle(basicBundleInfo);
		manipulator.save(false);		
		assertNotContent(getBundleTxt(), "dummy.frameworkextension");
		assertNotPropertyContains(getConfigIni(),"osgi.framework.extensions", "dummy.frameworkextension");
	}

}

Back to the top