diff options
author | John Ross | 2011-11-18 18:24:26 +0000 |
---|---|---|
committer | John Ross | 2011-11-18 18:26:34 +0000 |
commit | 1d478e3bff188ccbed8408fa8d12985ea7e02e1a (patch) | |
tree | 2c9da13e1899a0bf90fb127823d6971543c86384 /bundles/org.eclipse.equinox.compendium.tests/src | |
parent | 7a03fea698d27f67f32132fc296a996b99c07d32 (diff) | |
download | rt.equinox.bundles-1d478e3bff188ccbed8408fa8d12985ea7e02e1a.tar.gz rt.equinox.bundles-1d478e3bff188ccbed8408fa8d12985ea7e02e1a.tar.xz rt.equinox.bundles-1d478e3bff188ccbed8408fa8d12985ea7e02e1a.zip |
Bug 363374: New test for unresolved bundle.
Diffstat (limited to 'bundles/org.eclipse.equinox.compendium.tests/src')
2 files changed, 53 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/AllTests.java b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/AllTests.java index 3cb601a13..f530f0853 100644 --- a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/AllTests.java +++ b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/AllTests.java @@ -23,6 +23,7 @@ public class AllTests { suite.addTestSuite(SameOcdPidFactoryPidTest.class); suite.addTestSuite(ExtendableTest.class); suite.addTestSuite(Bug358969Test.class); + suite.addTestSuite(UnresolvedBundleTest.class); return suite; } } diff --git a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/UnresolvedBundleTest.java b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/UnresolvedBundleTest.java new file mode 100644 index 000000000..ff9242a1c --- /dev/null +++ b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/UnresolvedBundleTest.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2011 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.metatype.tests; + +import org.osgi.framework.Bundle; +import org.osgi.service.metatype.*; + +/* + * Ensure the metadata XML information from an unresolved bundle is provided. + * + * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=363374. + */ +public class UnresolvedBundleTest extends AbstractTest { + private Bundle bundle; + + public void testUnresolvedBundle() { + assertBundleUnresolved(); + MetaTypeInformation mti = metatype.getMetaTypeInformation(bundle); + assertNotNull("Metatype information was null", mti); //$NON-NLS-1$ + ObjectClassDefinition ocd = mti.getObjectClassDefinition("org.eclipse.equinox.metatype.tests.tb8", null); //$NON-NLS-1$ + assertNotNull("Object class definition was null", ocd); //$NON-NLS-1$ + AttributeDefinition[] ads = ocd.getAttributeDefinitions(ObjectClassDefinition.ALL); + assertEquals("Wrong number of attribute definitions", 1, ads.length); //$NON-NLS-1$ + AttributeDefinition ad = ads[0]; + assertNotNull("Attribute definition was null", ad); //$NON-NLS-1$ + assertEquals("Wrong attribute definition ID", "ad1", ad.getID()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Wrong attribute definition name", "ad1", ad.getName()); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Wrong attribute definition type", AttributeDefinition.STRING, ad.getType()); //$NON-NLS-1$ + } + + protected void setUp() throws Exception { + super.setUp(); + bundle = bundleInstaller.installBundle("tb8"); //$NON-NLS-1$ + assertBundleUnresolved(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + } + + private void assertBundleUnresolved() { + assertEquals("Bundle should not be resolved", Bundle.INSTALLED, bundle.getState()); //$NON-NLS-1$ + } +} |