/*
 * $Header$
 * 
 * Copyright (c) OSGi Alliance (2005). All Rights Reserved.
 * 
 * Implementation of certain elements of the OSGi Specification may be subject
 * to third party intellectual property rights, including without limitation,
 * patent rights (such a third party may or may not be a member of the OSGi
 * Alliance). The OSGi Alliance is not responsible and shall not be held
 * responsible in any manner for identifying or failing to identify any or all
 * such third party intellectual property rights.
 * 
 * This document and the information contained herein are provided on an "AS IS"
 * basis and THE OSGI ALLIANCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
 * HEREIN WILL NOT INFRINGE ANY RIGHTS AND ANY IMPLIED WARRANTIES OF
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL THE
 * OSGI ALLIANCE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF
 * USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR DIRECT, INDIRECT, SPECIAL OR
 * EXEMPLARY, INCIDENTIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND IN
 * CONNECTION WITH THIS DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
 * 
 * All Company, brand and product names may be trademarks that are the sole
 * property of their respective owners. All rights reserved.
 */

package org.osgi.test.cases.packageadmin.tc5.tbc.PackageAdmin;

import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.test.cases.packageadmin.tc5.tbc.TestControl;

/**
 * 
 * Test the method org.osgi.service.packageadmin.PackageAdmin.resolveBundles().
 * 
 * @version $Revision$
 */
public class ResolveBundles {

	private TestControl	control;

	/**
	 * Creates a new ResolveBundles
	 * 
	 * @param _control the bundle control for this test
	 */
	public ResolveBundles(TestControl _control) {
		control = _control;
	}

	/**
	 * Run the tests
	 */
	public void run() throws Exception {
		testResolveBundles0001();
		testResolveBundles0002();
	}

	/**
	 * Check the invocation of the method with an unresolved bundle
	 */
	public void testResolveBundles0001() throws Exception {
		Bundle tb5;
		PackageAdmin packageAdmin;
		ServiceReference serviceReference;

		serviceReference = control.getContext().getServiceReference(
				PackageAdmin.class.getName());
		packageAdmin = (PackageAdmin) control.getContext().getService(
				serviceReference);

		control.installTestBundles();

		tb5 = control.getTestBundle5();
		control.assertEquals("Checking the bundle state", Bundle.INSTALLED, tb5
				.getState());

		control.assertTrue("Checking the resolved bundle", packageAdmin
				.resolveBundles(new Bundle[] {tb5}));

		control.assertEquals("Checking the bundle state", Bundle.RESOLVED, tb5
				.getState());

		control.uninstallTestBundles();

		control.refreshPackageAdmin();

		control.getContext().ungetService(serviceReference);
	}

	/**
	 * Check the invocation of the method to resolve all bundles
	 */
	public void testResolveBundles0002() throws Exception {
		Bundle tb5;
		PackageAdmin packageAdmin;
		ServiceReference serviceReference;

		serviceReference = control.getContext().getServiceReference(
				PackageAdmin.class.getName());
		packageAdmin = (PackageAdmin) control.getContext().getService(
				serviceReference);

		control.installTestBundles();

		tb5 = control.getTestBundle5();
		control.assertEquals("Checking the bundle state", Bundle.INSTALLED, tb5
				.getState());

		control.assertTrue("Checking the bundle is sucessfully resolved",
				packageAdmin.resolveBundles(null));

		control.assertEquals("Checking the bundle state", Bundle.RESOLVED, tb5
				.getState());

		control.uninstallTestBundles();

		control.refreshPackageAdmin();

		control.getContext().ungetService(serviceReference);
	}

}
@@ -2603,32 +2603,34 @@
 estBundle5();%0A%09%09
+/*
 control.assertEq
@@ -2694,32 +2694,34 @@
 %09%09%09.getState());
+*/
 %0A%0A%09%09control.asse
@@ -3501,16 +3501,18 @@
 e5();%0A%09%09
+/*
 control.
@@ -3584,32 +3584,34 @@
 %09%09%09.getState());
+*/
 %0A%0A%09%09control.asse

Fix for bug#50 "problems in packageadmin.tc5" (2)