aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2011-11-21 10:26:04 (EST)
committerJohn Ross2011-11-21 10:26:04 (EST)
commita15cf5afabb37e107d9ceaa8a18c3f10f4b44037 (patch)
treebaabf6eae4ae21bacfc1997bde31aacf6026d86e
parent82fc12f75e778e1832afcd9eab8fb561269fca76 (diff)
downloadrt.equinox.bundles-a15cf5afabb37e107d9ceaa8a18c3f10f4b44037.zip
rt.equinox.bundles-a15cf5afabb37e107d9ceaa8a18c3f10f4b44037.tar.gz
rt.equinox.bundles-a15cf5afabb37e107d9ceaa8a18c3f10f4b44037.tar.bz2
Bug 363374: Additional unresolved bundle tests.
There were a couple of places where BundleWiring.findEntries was still being used instead of Bundle.findEntries. These new tests are designed to catch those in the future. In order to do that, the test had to be setup so that a resource bundle and icon was used, as well as ensure a call to MetaTypeInformation.getLocales occurred.
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/l10n/bundle.properties13
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/l10n/bundle_en.properties13
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/metatype/icons/tn_ibm_turns_100.jpgbin0 -> 4821 bytes
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/metatype/metadata.xml7
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/UnresolvedBundleTest.java21
5 files changed, 48 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..cb27bee
--- /dev/null
+++ b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# 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
+###############################################################################
+ad1name=AD1 Name
+icon=OSGI-INF/metatype/icons/tn_ibm_turns_100.jpg
+ocd1name=OCD1 Name \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/l10n/bundle_en.properties b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/l10n/bundle_en.properties
new file mode 100644
index 0000000..cb27bee
--- /dev/null
+++ b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/l10n/bundle_en.properties
@@ -0,0 +1,13 @@
+###############################################################################
+# 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
+###############################################################################
+ad1name=AD1 Name
+icon=OSGI-INF/metatype/icons/tn_ibm_turns_100.jpg
+ocd1name=OCD1 Name \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/metatype/icons/tn_ibm_turns_100.jpg b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/metatype/icons/tn_ibm_turns_100.jpg
new file mode 100644
index 0000000..16708fa
--- /dev/null
+++ b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/metatype/icons/tn_ibm_turns_100.jpg
Binary files differ
diff --git a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/metatype/metadata.xml b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/metatype/metadata.xml
index 370592b..6259f9a 100644
--- a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/metatype/metadata.xml
+++ b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb8/OSGI-INF/metatype/metadata.xml
@@ -3,10 +3,11 @@
xmlns="http://www.org.osgi/xmlns/metatype/v1.2.0/md"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.org.osgi/xmlns/metatype/v1.2.0/md metatype.xsd">
- <OCD id="ocd1" name="ocd1">
- <AD name="ad1" id="ad1" type="String"/>
+ <OCD id="1" name="%ocd1name">
+ <AD id="1" name="%ad1name" type="String"/>
+ <Icon resource="%icon" size="10000"/>
</OCD>
<Designate pid="org.eclipse.equinox.metatype.tests.tb8">
- <Object ocdref="ocd1"/>
+ <Object ocdref="1"/>
</Designate>
</MetaData>
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
index ff9242a..eee81f6 100644
--- 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.metatype.tests;
+import java.io.IOException;
+import java.io.InputStream;
import org.osgi.framework.Bundle;
import org.osgi.service.metatype.*;
@@ -21,19 +23,32 @@ import org.osgi.service.metatype.*;
public class UnresolvedBundleTest extends AbstractTest {
private Bundle bundle;
- public void testUnresolvedBundle() {
+ public void testUnresolvedBundle() throws Exception {
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$
+ assertEquals("Wrong object class definition ID", "1", ocd.getID()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Wrong object class definition name", "OCD1 Name", ocd.getName()); //$NON-NLS-1$ //$NON-NLS-2$
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 ID", "1", ad.getID()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Wrong attribute definition name", "AD1 Name", ad.getName()); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Wrong attribute definition type", AttributeDefinition.STRING, ad.getType()); //$NON-NLS-1$
+ InputStream icon = ocd.getIcon(10000);
+ assertNotNull("Icon was null", icon); //$NON-NLS-1$
+ try {
+ icon.close();
+ } catch (IOException e) {
+ // noop
+ }
+ String[] locales = mti.getLocales();
+ assertNotNull("Locales was null", locales); //$NON-NLS-1$
+ assertEquals("Wrong number of locales", 1, locales.length); //$NON-NLS-1$
+ assertEquals("Wrong locale", "en", locales[0]); //$NON-NLS-1$ //$NON-NLS-2$
}
protected void setUp() throws Exception {