aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2011-11-22 07:49:53 (EST)
committerJohn Ross2011-11-22 07:49:53 (EST)
commit049ac4efd0bb6efd55ffd3fa4c862288dca95cfe (patch)
tree3bea28521f68eda7acce9e2eb492786d7d90770f
parent19d60e3a282f099c5fc666a317cefb9e009bdbfe (diff)
downloadrt.equinox.bundles-049ac4efd0bb6efd55ffd3fa4c862288dca95cfe.zip
rt.equinox.bundles-049ac4efd0bb6efd55ffd3fa4c862288dca95cfe.tar.gz
rt.equinox.bundles-049ac4efd0bb6efd55ffd3fa4c862288dca95cfe.tar.bz2
Bug 364459: New test to sniff out NPE in OCD.getIcon when no icons were specified.
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb9/OSGI-INF/metatype/metadata.xml6
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/IconTest.java12
2 files changed, 18 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb9/OSGI-INF/metatype/metadata.xml b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb9/OSGI-INF/metatype/metadata.xml
index e4412f1..eb86ab3 100644
--- a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb9/OSGI-INF/metatype/metadata.xml
+++ b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb9/OSGI-INF/metatype/metadata.xml
@@ -9,7 +9,13 @@
<Icon size="22500" resource="icons/tn_ibm_turns_100-150x150.jpg"/>
<Icon size="40000" resource="icons/tn_ibm_turns_100-200x200.jpg"/>
</OCD>
+ <OCD id="2" name="ocd2">
+ <AD id="1" name="ad1" type="Byte"/>
+ </OCD>
<Designate pid="org.eclipse.equinox.metatype.tests.tb9">
<Object ocdref="1"/>
</Designate>
+ <Designate pid="org.eclipse.equinox.metatype.tests.tb9.2">
+ <Object ocdref="2"/>
+ </Designate>
</MetaData>
diff --git a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/IconTest.java b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/IconTest.java
index 89a0c51..e1388d6 100644
--- a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/IconTest.java
+++ b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/IconTest.java
@@ -49,12 +49,24 @@ public class IconTest extends AbstractTest {
assertIcon(ocd.getIcon(31251), 40000);
}
+ public void testNullIcon() throws Exception {
+ MetaTypeInformation mti = metatype.getMetaTypeInformation(bundle);
+ assertNotNull(mti);
+ ObjectClassDefinition ocd = mti.getObjectClassDefinition("org.eclipse.equinox.metatype.tests.tb9.2", null); //$NON-NLS-1$
+ assertObjectClassDefinition(ocd, "2", "ocd2", null); //$NON-NLS-1$ //$NON-NLS-2$
+ AttributeDefinition[] ads = ocd.getAttributeDefinitions(ObjectClassDefinition.ALL);
+ assertAttributeDefinitions(ads, 1);
+ assertAttributeDefinition(ads[0], 0, null, null, "1", "ad1", null, null, AttributeDefinition.BYTE); //$NON-NLS-1$ //$NON-NLS-2$
+ assertNull("Icon was not null", ocd.getIcon(10000)); //$NON-NLS-1$
+ }
+
protected void setUp() throws Exception {
super.setUp();
bundle = bundleInstaller.installBundle("tb9"); //$NON-NLS-1$
}
protected void tearDown() throws Exception {
+ bundle.uninstall();
super.tearDown();
}
}