}
@org.junit.Test public void testResourceType() throws Exception {
{
final InputStream s = new FileInputStream(getTestBundle("testbundle-1.0.jar"));
final RegisteredResource r = create(new InstallableResource("test:1.jar", s, null, "some digest", null, null));
assertEquals(".jar URL creates a BUNDLE resource",
InstallableResource.TYPE_BUNDLE, r.getType());
final InputStream rs = r.getInputStream();
assertNotNull("BUNDLE resource provides an InputStream", rs);
rs.close();
assertNull("BUNDLE resource does not provide a Dictionary", r.getDictionary());
assertEquals("RegisteredResource entity ID must match", "bundle:osgi-installer-testbundle", r.getEntityId());
}
{
final Hashtable<String, Object> data = new Hashtable<String, Object>();
data.put("foo", "bar");
data.put("other", 2);
final TaskResource r = create(new InstallableResource("configuration:1", null, data, null, null, null));
assertEquals("No-extension URL with Dictionary creates a CONFIG resource",
InstallableResource.TYPE_CONFIG, r.getType());
final InputStream rs = r.getInputStream();
assertNull("CONFIG resource does not provide an InputStream", rs);
final Dictionary<String, Object> d = r.getDictionary();