Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b3729c3d51ee50c4c43db2779536c712d561a1c4 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*******************************************************************************
 * Copyright (c) 2004, 2015 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.osgi.tests.services.resolver;

import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.State;
import org.osgi.framework.BundleException;

public class NewResolverTest extends AbstractStateTest {

	public NewResolverTest(String testName) {
		super(testName);
	}
	
	public static Test suite() {
		return new TestSuite(NewResolverTest.class);
	}

	public void testSkeleton() {
		State state = buildEmptyState();
		state.resolve();
	}
	
	public void testBasicScenario1() throws BundleException {
		State state = buildEmptyState();
		
		final String MAN_A = "Bundle-SymbolicName: A\n" + 
		                     "Export-Package: servlet; specification-version=2.1";
		BundleDescription bA = state.getFactory().createBundleDescription(parseManifest(MAN_A),
																		"org.eclipse.basic1A", 0);
		state.addBundle(bA);
		
		final String MAN_B = "Bundle-SymbolicName: B\n" + 
        					 "Import-Package: servlet; specification-version=2.1";
		BundleDescription bB = state.getFactory().createBundleDescription(parseManifest(MAN_B),
													"org.eclipse.basic1B", 1);
		state.addBundle(bB);

		state.resolve();
		
		BundleDescription b0 = state.getBundle(0);
		assertNotNull("0.1", b0);
		assertFullyResolved("0.2", b0);
		
		BundleDescription b1 = state.getBundle(1);
		assertNotNull("0.3", b1);
		assertFullyResolved("0.4", b1);
	}
}


Back to the top