incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r955903 - in /sling/trunk/installer/osgi: installer/src/main/java/org/apache/sling/osgi/installer/ installer/src/main/java/org/apache/sling/osgi/installer/impl/ installer/src/test/java/org/apache/sling/osgi/installer/impl/ it/src/test/java/...
Date Fri, 18 Jun 2010 09:30:35 GMT
Author: cziegeler
Date: Fri Jun 18 09:30:35 2010
New Revision: 955903

URL: http://svn.apache.org/viewvc?rev=955903&view=rev
Log:
SLING-1560 : Improve and clean up code
Make DigestUtil private

Added:
    sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java   (with props)
Modified:
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResourceFactory.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/DigestUtil.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/InstallableResourceFactoryImpl.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/InstallableResourceImpl.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/RegisteredResourceTest.java
    sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallUpgradeDowngradeTest.java
    sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundlePrioritiesTest.java
    sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleStatePreservedTest.java
    sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigInstallTest.java
    sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigPrioritiesTest.java
    sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java
    sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RegisterResourcesTest.java

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResourceFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResourceFactory.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResourceFactory.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/InstallableResourceFactory.java Fri Jun 18 09:30:35 2010
@@ -47,6 +47,7 @@ public interface InstallableResourceFact
      * @param optional resource type - if the client knows the resource type it should
      *     be specified - if not, the factory detects the type
      * @param optional priority - if not specified {@link #DEFAULT_PRIORITY} will be used.
+     * @return A new installable resource or null if something goes wrong
      */
     InstallableResource create(String url,
                                InputStream is,
@@ -73,6 +74,7 @@ public interface InstallableResourceFact
      * @param optional resource type - if the client knows the resource type it should
      *     be specified - if not, the factory detects the type
      * @param optional priority - if not specified {@link #DEFAULT_PRIORITY} will be used.
+     * @return A new installable resource or null if something goes wrong
      */
     InstallableResource create(String url,
                                Dictionary<String, Object> d,

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/DigestUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/DigestUtil.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/DigestUtil.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/DigestUtil.java Fri Jun 18 09:30:35 2010
@@ -45,12 +45,14 @@ public abstract class DigestUtil {
     }
 
     /** Compute digest on all keys of supplied data */
-    public static String computeDigest(Dictionary<String, Object> data) throws IOException, NoSuchAlgorithmException {
+    public static String computeDigest(Dictionary<String, Object> data)
+    throws IOException, NoSuchAlgorithmException {
     	return computeDigest(data, null);
     }
 
     /** Digest is needed to detect changes in data, and must not depend on dictionary ordering */
-    public static String computeDigest(Dictionary<String, Object> data, Set<String> keysToIgnore) throws IOException, NoSuchAlgorithmException {
+    public static String computeDigest(Dictionary<String, Object> data, Set<String> keysToIgnore)
+    throws IOException, NoSuchAlgorithmException {
         final MessageDigest d = MessageDigest.getInstance(DIGEST_TYPE);
         final ByteArrayOutputStream bos = new ByteArrayOutputStream();
         final ObjectOutputStream oos = new ObjectOutputStream(bos);

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/InstallableResourceFactoryImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/InstallableResourceFactoryImpl.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/InstallableResourceFactoryImpl.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/InstallableResourceFactoryImpl.java Fri Jun 18 09:30:35 2010
@@ -18,11 +18,18 @@
  */
 package org.apache.sling.osgi.installer.impl;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Properties;
 
 import org.apache.sling.osgi.installer.InstallableResource;
 import org.apache.sling.osgi.installer.InstallableResourceFactory;
+import org.apache.sling.osgi.installer.InstallableResource.Type;
+import org.apache.sling.osgi.installer.impl.propertyconverter.PropertyConverter;
+import org.apache.sling.osgi.installer.impl.propertyconverter.PropertyValue;
 
 /**
  * Default implementation of the installable resource factory.
@@ -43,10 +50,24 @@ public class InstallableResourceFactoryI
         if ( is == null ) {
             throw new IllegalArgumentException("input stream must not be null.");
         }
-        if ( priority == null ) {
-            return new InstallableResourceImpl(url, is, digest);
+        final InstallableResource.Type resourceType = (type != null ? type : computeResourceType(getExtension(url)));
+        if ( resourceType == InstallableResource.Type.CONFIG ) {
+            try {
+                return this.create(url, readDictionary(is), digest, resourceType, priority);
+            } catch (IOException ignore) {
+                // TODO - log this
+                return null;
+            }
         }
-        return new InstallableResourceImpl(url, is, digest, priority);
+
+        // TODO - compute digest for bundle if digest is null - for now we throw
+        if ( digest == null ) {
+            throw new IllegalArgumentException("digest must not be null for a bundle.");
+        }
+
+        return new InstallableResourceImpl(url, is, digest,
+                resourceType,
+                (priority != null ? priority : DEFAULT_PRIORITY));
     }
 
     /**
@@ -63,9 +84,50 @@ public class InstallableResourceFactoryI
         if ( d == null ) {
             throw new IllegalArgumentException("dictionary must not be null.");
         }
-        if ( priority == null ) {
-            return new InstallableResourceImpl(url, d);
+        try {
+            return new InstallableResourceImpl(url, d,
+                    (digest != null ? digest : url + ":" + DigestUtil.computeDigest(d)),
+                    (type != null ? type : Type.CONFIG),
+                    (priority != null ? priority : DEFAULT_PRIORITY));
+        } catch (Exception ignore) {
+            // TODO - log this
+            return null;
+        }
+    }
+
+    /** Convert InputStream to Dictionary using our extended properties format,
+     *  which supports multi-value properties
+     */
+    private static Dictionary<String, Object> readDictionary(InputStream is) throws IOException {
+        try {
+            final Dictionary<String, Object> result = new Hashtable<String, Object>();
+            final PropertyConverter converter = new PropertyConverter();
+            final Properties p = new Properties();
+            p.load(is);
+            for(Map.Entry<Object, Object> e : p.entrySet()) {
+                final PropertyValue v = converter.convert((String)e.getKey(), (String)e.getValue());
+                result.put(v.getKey(), v.getValue());
+            }
+            return result;
+        } finally {
+            try {
+                is.close();
+            } catch (IOException ignore ) {
+                // we ignore this
+            }
+        }
+    }
+
+    /** Compute the extension */
+    private static String getExtension(String url) {
+        final int pos = url.lastIndexOf('.');
+        return (pos < 0 ? "" : url.substring(pos+1));
+    }
+
+    private static Type computeResourceType(String extension) {
+        if(extension.equals("jar")) {
+            return Type.BUNDLE;
         }
-        return new InstallableResourceImpl(url, d, priority);
+        return Type.CONFIG;
     }
 }

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/InstallableResourceImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/InstallableResourceImpl.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/InstallableResourceImpl.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/InstallableResourceImpl.java Fri Jun 18 09:30:35 2010
@@ -30,46 +30,6 @@ import org.apache.sling.osgi.installer.O
  */
 public class InstallableResourceImpl implements InstallableResource {
 
-    /** Return this data's URL. It is opaque for the {@link OsgiInstaller}
-	 * 	but the scheme must be the one used in the
-	 * 	{@link OsgiInstaller#registerResources} call.
-	 */
-    public String getUrl() {
-        return this.url;
-    }
-
-	/** Return the type of this resource. */
-    public Type getType() {
-        return this.resourceType;
-    }
-
-	/** Return an input stream with the data of this resource. Null if resource
-	 *  contains a dictionary instead. Caller is responsible for closing the stream.
-	 */
-    public InputStream getInputStream() {
-        return this.inputStream;
-    }
-
-	/** Return this resource's dictionary. Null if resource contains an InputStream instead */
-	public Dictionary<String, Object> getDictionary() {
-	    return this.dictionary;
-	}
-
-	/** Return this resource's digest. Not necessarily an actual md5 or other digest of the
-	 *  data, can be any string that changes if the data changes.
-	 */
-    public String getDigest() {
-        return this.digest;
-    }
-
-	/** Return the priority of this resource. Priorities are used to decide which
-	 *  resource to install when several are registered for the same OSGi entity
-	 *  (bundle, config, etc.)
-	 */
-    public int getPriority() {
-        return this.priority;
-    }
-
     private final String url;
     private final String digest;
     private final InputStream inputStream;
@@ -77,9 +37,6 @@ public class InstallableResourceImpl imp
     private final int priority;
     private final Type resourceType;
 
-    /** Default resource priority */
-    public static final int DEFAULT_PRIORITY = 100;
-
     /** Create a data object that wraps an InputStream
      *  @param url unique URL of the supplied data, must start with the scheme used
      *     {@link OsgiInstaller#registerResources} call
@@ -89,26 +46,13 @@ public class InstallableResourceImpl imp
      *     by the client avoids having to compute real digests to find out if a resource
      *     has changed, which can be expensive.
      */
-    public InstallableResourceImpl(String url, InputStream is, String digest) {
-        this(url, is, digest, DEFAULT_PRIORITY);
-    }
-
-    /** Create a data object that wraps an InputStream
-     *  @param url unique URL of the supplied data, must start with the scheme used
-     *     {@link OsgiInstaller#registerResources} call
-     *  @param is the resource contents
-     *  @param digest must be supplied by client. Does not need to be an actual digest
-     *     of the contents, but must change if the contents change. Having this supplied
-     *     by the client avoids having to compute real digests to find out if a resource
-     *     has changed, which can be expensive.
-     */
-    public InstallableResourceImpl(String url, InputStream is, String digest, final int priority) {
+    public InstallableResourceImpl(String url, InputStream is, String digest,
+            final Type type,
+            final int priority) {
         this.url = url;
         this.digest = digest;
         this.priority = priority;
-        // detect resource type by checking the extension
-        final String extension = getExtension(this.url);
-        this.resourceType = computeResourceType(extension);
+        this.resourceType = type;
 //        if ( this.resourceType == Type.CONFIG ) {
 //            this.dictionary = null;
 //            this.inputStream = null;
@@ -126,46 +70,62 @@ public class InstallableResourceImpl imp
      *  @param url unique URL of the supplied data, must start with the scheme used
      *     {@link OsgiInstaller#registerResources} call
      */
-    public InstallableResourceImpl(final String url, final Dictionary<String, Object> d) {
-        this(url, d, DEFAULT_PRIORITY);
-    }
-
-    /** Create a data object that wraps a Dictionary. Digest will be computed
-     *  by the installer in this case, as configuration dictionaries are
-     *  usually small so computing a real digest to find out if they changed
-     *  is ok.
-     *
-     *  @param url unique URL of the supplied data, must start with the scheme used
-     *     {@link OsgiInstaller#registerResources} call
-     */
-    public InstallableResourceImpl(final String url, final Dictionary<String, Object> d, final int priority) {
+    public InstallableResourceImpl(final String url, final Dictionary<String, Object> d,
+            final String digest,
+            final Type type,
+            final int priority) {
         this.url = url;
         this.inputStream = null;
-        this.resourceType = Type.CONFIG;
+        this.resourceType = type;
         this.dictionary = d;
-        try {
-            this.digest = url + ":" + DigestUtil.computeDigest(d);
-        } catch(Exception e) {
-            throw new IllegalStateException("Unexpected Exception while computing digest", e);
-        }
+        this.digest = digest;
         this.priority = priority;
     }
 
-    @Override
-    public String toString() {
-        return getClass().getSimpleName() + ", priority=" + priority + ", url=" + url;
+    /**
+     * @see org.apache.sling.osgi.installer.InstallableResource#getUrl()
+     */
+    public String getUrl() {
+        return this.url;
     }
 
-    /** Compute the extension */
-    private static String getExtension(String url) {
-        final int pos = url.lastIndexOf('.');
-        return (pos < 0 ? "" : url.substring(pos+1));
+    /**
+     * @see org.apache.sling.osgi.installer.InstallableResource#getType()
+     */
+    public Type getType() {
+        return this.resourceType;
     }
 
-    private static Type computeResourceType(String extension) {
-        if(extension.equals("jar")) {
-            return Type.BUNDLE;
-        }
-        return Type.CONFIG;
+    /**
+     * @see org.apache.sling.osgi.installer.InstallableResource#getInputStream()
+     */
+    public InputStream getInputStream() {
+        return this.inputStream;
+    }
+
+	/**
+	 * @see org.apache.sling.osgi.installer.InstallableResource#getDictionary()
+	 */
+	public Dictionary<String, Object> getDictionary() {
+	    return this.dictionary;
+	}
+
+    /**
+     * @see org.apache.sling.osgi.installer.InstallableResource#getDigest()
+     */
+    public String getDigest() {
+        return this.digest;
+    }
+
+    /**
+     * @see org.apache.sling.osgi.installer.InstallableResource#getPriority()
+     */
+    public int getPriority() {
+        return this.priority;
+    }
+
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + ", priority=" + priority + ", url=" + url;
     }
 }

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java (original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java Fri Jun 18 09:30:35 2010
@@ -77,21 +77,22 @@ public class RegisteredResourceImpl impl
 	public RegisteredResourceImpl(OsgiInstallerContext osgiCtx, InstallableResource input) throws IOException {
 
 	    final BundleContext ctx = osgiCtx.getBundleContext();
-	    try {
-    		url = input.getUrl();
-    		urlScheme = getUrlScheme(url);
-    		resourceType = input.getType();
-    		priority = input.getPriority();
-    		serialNumber = getNextSerialNumber();
+		url = input.getUrl();
+		urlScheme = getUrlScheme(url);
+		resourceType = input.getType();
+		priority = input.getPriority();
+		serialNumber = getNextSerialNumber();
+
+        if(input.getDigest() == null || input.getDigest().length() == 0) {
+            throw new IllegalArgumentException("Missing digest: " + input);
+        }
 
-            if(input.getDigest() == null || input.getDigest().length() == 0) {
-                throw new IllegalArgumentException("Missing digest: " + input);
+		if(resourceType == InstallableResource.Type.BUNDLE) {
+		    final InputStream is = input.getInputStream();
+            if (is == null) {
+                throw new IllegalArgumentException("InputStream is required for BUNDLE resource type: " + input);
             }
-
-    		if(resourceType == InstallableResource.Type.BUNDLE) {
-                if(input.getInputStream() == null) {
-                    throw new IllegalArgumentException("InputStream is required for BUNDLE resource type: " + input);
-                }
+            try {
                 dictionary = null;
                 final File f = getDataFile(ctx);
                 osgiCtx.logDebug("Copying data to local storage " + f.getAbsolutePath());
@@ -106,24 +107,18 @@ public class RegisteredResourceImpl impl
                 } else {
                     entity = ENTITY_BUNDLE_PREFIX + name;
                 }
-    		} else {
-                hasDataFile = false;
-                final ConfigurationPid pid = new ConfigurationPid(input.getUrl());
-                entity = ENTITY_CONFIG_PREFIX + pid.getCompositePid();
-                attributes.put(CONFIG_PID_ATTRIBUTE, pid);
-                if(input.getInputStream() == null) {
-                    // config provided as a Dictionary
-                    dictionary = copy(input.getDictionary());
-                } else {
-                    dictionary = readDictionary(input.getInputStream());
-                }
-                digest = input.getDigest();
-    		}
-    	} finally {
-    		if(input.getInputStream() != null) {
-    			input.getInputStream().close();
-    		}
-    	}
+            } finally {
+                is.close();
+            }
+		} else {
+            hasDataFile = false;
+            final ConfigurationPid pid = new ConfigurationPid(input.getUrl());
+            entity = ENTITY_CONFIG_PREFIX + pid.getCompositePid();
+            attributes.put(CONFIG_PID_ATTRIBUTE, pid);
+            // config provided as a Dictionary
+            dictionary = copy(input.getDictionary());
+            digest = input.getDigest();
+		}
 	}
 
     private static long getNextSerialNumber() {

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/RegisteredResourceTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/RegisteredResourceTest.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/RegisteredResourceTest.java (original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/RegisteredResourceTest.java Fri Jun 18 09:30:35 2010
@@ -69,7 +69,7 @@ public class RegisteredResourceTest {
 
 		final TestInputStream t = new TestInputStream(new ByteArrayInputStream(data.getBytes()));
 		final InstallableResource ir = factory.create(TEST_URL, t, "somedigest", null, null);
-		assertEquals("TestInputStream must not be closed before test", 0, t.closeCount);
+		//assertEquals("TestInputStream must not be closed before test", 0, t.closeCount);
 		new LocalFileRegisteredResource(ir);
 		assertEquals("TestInputStream must be closed by RegisteredResource", 1, t.closeCount);
 	}
@@ -134,12 +134,6 @@ public class RegisteredResourceTest {
             fail("With jar extension, expected an IllegalArgumentException as digest is null");
         } catch(IllegalArgumentException asExpected) {
         }
-
-        try {
-            new LocalFileRegisteredResource(factory.create("test:1.foo", in, null, null, null));
-            fail("With non-jar extension, expected an IllegalArgumentException as digest is null");
-        } catch(IllegalArgumentException asExpected) {
-        }
     }
 
     @org.junit.Test public void testBundleManifest() throws Exception {

Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallUpgradeDowngradeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallUpgradeDowngradeTest.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallUpgradeDowngradeTest.java (original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallUpgradeDowngradeTest.java Fri Jun 18 09:30:35 2010
@@ -35,24 +35,24 @@ public class BundleInstallUpgradeDowngra
     public static Option[] configuration() {
     	return defaultConfiguration();
     }
-    
+
     @Before
     public void setUp() {
         setupInstaller();
     }
-    
+
     @After
     public void tearDown() {
         super.tearDown();
     }
-    
+
 	@Test
     public void testInstallUpgradeDowngradeBundle() throws Exception {
     	final String symbolicName = "osgi-installer-testbundle";
     	int testIndex = 0;
-    	
+
     	assertNull("Test bundle must not be present before test", findBundle(symbolicName));
-    	
+
     	// Install first test bundle and check version
     	long bundleId = 0;
     	{
@@ -64,7 +64,7 @@ public class BundleInstallUpgradeDowngra
     	    final Bundle b = assertBundle("After installing", symbolicName, "1.1", Bundle.ACTIVE);
     	    bundleId = b.getBundleId();
     	}
-    	
+
     	assertNoOsgiTasks("After test " + testIndex++);
 
     	// Upgrade to later version, verify
@@ -84,19 +84,19 @@ public class BundleInstallUpgradeDowngra
             resetCounters();
             installer.addResource(getInstallableResource(
                     getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar"), "digestA"));
-            
+
             // make sure no updates happen
             waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
             final Bundle b = assertBundle("After ignored downgrade", symbolicName, "1.2", Bundle.ACTIVE);
             assertEquals("Bundle ID must not change after ignored downgrade", bundleId, b.getBundleId());
         }
-    	
+
     	assertNoOsgiTasks("After test " + testIndex++);
-    	
+
     	// Verify number of registered resources and groups
         assertCounter(OsgiInstaller.REGISTERED_RESOURCES_COUNTER, 3);
         assertCounter(OsgiInstaller.REGISTERED_GROUPS_COUNTER, 1);
-        
+
     	// Update to same version with different digest must be ignored
     	{
     	    resetCounters();
@@ -104,34 +104,34 @@ public class BundleInstallUpgradeDowngra
                     getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar"), "digestB"));
         	assertNoOsgiTasks("Update to same version should generate no OSGi tasks");
     	}
-    	
+
     	// Uninstall
     	{
             resetCounters();
-            installer.removeResource(getNonInstallableResource(
+            installer.removeResource(getNonInstallableResourceUrl(
                     getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar")));
             waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-            
+
             resetCounters();
-            installer.removeResource(getNonInstallableResource(
+            installer.removeResource(getNonInstallableResourceUrl(
                     getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar")));
             waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-            
+
             resetCounters();
-            installer.removeResource(getNonInstallableResource(
+            installer.removeResource(getNonInstallableResourceUrl(
                     getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.2.jar")));
             waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-            
+
             final Bundle b = findBundle(symbolicName);
             assertNull("Testbundle must be gone", b);
     	}
-    	
+
     	// No resources must be registered anymore
         assertCounter(OsgiInstaller.REGISTERED_RESOURCES_COUNTER, 0);
     	assertCounter(OsgiInstaller.REGISTERED_GROUPS_COUNTER, 0);
-    	
+
     	assertNoOsgiTasks("After test " + testIndex++);
-    	
+
     	// Reinstall lower version, must work
         {
             resetCounters();
@@ -143,12 +143,12 @@ public class BundleInstallUpgradeDowngra
 
         assertNoOsgiTasks("After test " + testIndex++);
 	}
-	
+
 	   @Test
 	    public void testRemoveAndReadd() throws Exception {
 	        final String symbolicName = "osgi-installer-testbundle";
 	        int testIndex = 0;
-	        
+
 	        {
 	            assertNull("Test bundle must be absent before installing", findBundle(symbolicName));
 	            resetCounters();
@@ -157,19 +157,19 @@ public class BundleInstallUpgradeDowngra
 	            waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
 	            assertBundle("After installing", symbolicName, "1.1", Bundle.ACTIVE);
 	        }
-	        
+
 	        assertNoOsgiTasks("After test " + testIndex++);
-	        
+
             {
                 resetCounters();
-                installer.removeResource(getNonInstallableResource(
+                installer.removeResource(getNonInstallableResourceUrl(
                         getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar")));
                 waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
                 assertNull("Test bundle must be gone", findBundle(symbolicName));
             }
-            
+
             assertNoOsgiTasks("After test " + testIndex++);
-            
+
             {
                 resetCounters();
                 installer.addResource(getInstallableResource(
@@ -177,7 +177,7 @@ public class BundleInstallUpgradeDowngra
                 waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
                 assertBundle("After reinstalling", symbolicName, "1.1", Bundle.ACTIVE);
             }
-            
+
             assertNoOsgiTasks("After test " + testIndex++);
 	   }
 }
\ No newline at end of file

Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundlePrioritiesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundlePrioritiesTest.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundlePrioritiesTest.java (original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundlePrioritiesTest.java Fri Jun 18 09:30:35 2010
@@ -20,7 +20,7 @@ import static org.junit.Assert.assertNul
 
 import java.io.IOException;
 
-import org.apache.sling.osgi.installer.InstallableResource;
+import org.apache.sling.osgi.installer.InstallableResourceFactory;
 import org.apache.sling.osgi.installer.OsgiInstaller;
 import org.junit.After;
 import org.junit.Before;
@@ -36,27 +36,27 @@ public class BundlePrioritiesTest extend
     public static Option[] configuration() {
         return defaultConfiguration();
     }
-    
+
     @Before
     public void setUp() {
         setupInstaller();
     }
-    
+
     @After
     public void tearDown() {
         super.tearDown();
     }
-    
+
     @Test
     /** Use snapshots, it's the only bundles which are updated even if their version doesn't change */
     public void testPrioritiesUsingSnapshots() throws IOException {
         // Install test bundle
         final String symbolicName = "osgi-installer-snapshot-test";
         assertNull("Snapshot test bundle must be absent before installing", findBundle(symbolicName));
-        
-        final int lowPriority = InstallableResource.DEFAULT_PRIORITY - 1;
-        final int highPriority = InstallableResource.DEFAULT_PRIORITY + 1;
-        
+
+        final int lowPriority = InstallableResourceFactory.DEFAULT_PRIORITY - 1;
+        final int highPriority = InstallableResourceFactory.DEFAULT_PRIORITY + 1;
+
         {
             resetCounters();
             installer.addResource(getInstallableResource(
@@ -77,7 +77,7 @@ public class BundlePrioritiesTest extend
                     getTestBundle(BUNDLE_BASE_NAME + "-snap.jar"), "digest3", highPriority));
             waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
         }
-        
+
         assertNoOsgiTasks("At end of test");
     }
 }

Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleStatePreservedTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleStatePreservedTest.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleStatePreservedTest.java (original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleStatePreservedTest.java Fri Jun 18 09:30:35 2010
@@ -35,17 +35,17 @@ public class BundleStatePreservedTest ex
     public static Option[] configuration() {
     	return defaultConfiguration();
     }
-    
+
     @Before
     public void setUp() {
         setupInstaller();
     }
-    
+
     @After
     public void tearDown() {
         super.tearDown();
     }
-    
+
     @Test
     public void testBundleStatePreserved() throws Exception {
     	// Install two bundles, one started, one stopped
@@ -64,10 +64,10 @@ public class BundleStatePreservedTest ex
             assertNotNull("Test bundle B must be found", b);
             b.stop();
         }
-    	
+
         assertBundle("Bundle A must be started", "osgi-installer-testA", null, Bundle.ACTIVE);
         assertBundle("Bundle B must be stopped", "osgi-installer-testB", null, Bundle.RESOLVED);
-    	
+
     	// Execute some OsgiController operations
         installer.addResource(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar")));
         installer.addResource(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.2.jar")));
@@ -75,25 +75,25 @@ public class BundleStatePreservedTest ex
         installer.addResource(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar")));
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
         assertBundle("After installing testbundle", "osgi-installer-testbundle", "1.2", Bundle.ACTIVE);
-    	
+
         // Verify number of registered resources and groups
         assertCounter(OsgiInstaller.REGISTERED_RESOURCES_COUNTER, 5);
         assertCounter(OsgiInstaller.REGISTERED_GROUPS_COUNTER, 3);
-    	
+
         resetCounters();
-        installer.removeResource(getNonInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar")));
+        installer.removeResource(getNonInstallableResourceUrl(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar")));
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
 
         resetCounters();
-        installer.removeResource(getNonInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar")));
+        installer.removeResource(getNonInstallableResourceUrl(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar")));
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-        
+
         resetCounters();
-        installer.removeResource(getNonInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.2.jar")));
+        installer.removeResource(getNonInstallableResourceUrl(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.2.jar")));
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-        
+
         assertNull("testbundle must be gone at end of test", findBundle("osgi-installer-testbundle"));
-        
+
     	// Now check that bundles A and B have kept their states
         assertBundle("Bundle A must still be started", "osgi-installer-testA", null, Bundle.ACTIVE);
         assertBundle("Bundle B must still be stopped", "osgi-installer-testB", null, Bundle.RESOLVED);

Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigInstallTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigInstallTest.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigInstallTest.java (original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigInstallTest.java Fri Jun 18 09:30:35 2010
@@ -43,23 +43,23 @@ import org.osgi.service.cm.Configuration
 @RunWith(JUnit4TestRunner.class)
 
 public class ConfigInstallTest extends OsgiInstallerTestBase implements ConfigurationListener {
-    
+
     private final static long TIMEOUT = 5000L;
     private List<ConfigurationEvent> events = new LinkedList<ConfigurationEvent>();
     private ServiceRegistration serviceRegistration;
-    
+
     @org.ops4j.pax.exam.junit.Configuration
     public static Option[] configuration() {
         return defaultConfiguration();
     }
-    
+
     @Before
     public void setUp() {
         setupInstaller();
         events.clear();
         serviceRegistration = bundleContext.registerService(ConfigurationListener.class.getName(), this, null);
     }
-    
+
     @After
     public void tearDown() {
         super.tearDown();
@@ -68,7 +68,7 @@ public class ConfigInstallTest extends O
         	serviceRegistration = null;
         }
     }
-    
+
     public void configurationEvent(ConfigurationEvent e) {
     	events.add(e);
 	}
@@ -78,39 +78,39 @@ public class ConfigInstallTest extends O
         final Dictionary<String, Object> cfgData = new Hashtable<String, Object>();
         cfgData.put("foo", "bar");
         final String cfgPid = getClass().getSimpleName() + "." + System.currentTimeMillis();
-        final InstallableResource r = getInstallableResource(cfgPid, cfgData); 
-        
+        final InstallableResource r = getInstallableResource(cfgPid, cfgData);
+
         assertNull("Config " + cfgPid + " must not be found before test", findConfiguration(cfgPid));
-        
+
         resetCounters();
         installer.addResource(r);
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-        
+
         Configuration cfg = waitForConfiguration("After installing", cfgPid, TIMEOUT, true);
-        assertEquals("Config value must match", "bar", (String)cfg.getProperties().get("foo"));
-        
+        assertEquals("Config value must match", "bar", cfg.getProperties().get("foo"));
+
         resetCounters();
-        installer.removeResource(new InstallableResource(r.getUrl()));
+        installer.removeResource(r.getUrl());
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
         waitForConfiguration("After removing", cfgPid, TIMEOUT, false);
-        
+
         // Reinstalling with same digest must work
         resetCounters();
         installer.addResource(r);
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
         cfg = waitForConfiguration("After reinstalling", cfgPid, TIMEOUT, true);
-        assertEquals("Config value must match", "bar", (String)cfg.getProperties().get("foo"));
-        
+        assertEquals("Config value must match", "bar", cfg.getProperties().get("foo"));
+
         resetCounters();
-        installer.removeResource(new InstallableResource(r.getUrl()));
+        installer.removeResource(r.getUrl());
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
         waitForConfiguration("After removing for the second time", cfgPid, TIMEOUT, false);
-        
+
     }
-    
+
     @Test
     public void testDeferredConfigInstall() throws Exception {
-    	
+
     	final String cfgName = "org.apache.felix.configadmin";
     	Bundle configAdmin = null;
     	for(Bundle b : bundleContext.getBundles()) {
@@ -121,7 +121,7 @@ public class ConfigInstallTest extends O
     	}
     	assertNotNull(cfgName + " bundle must be found", configAdmin);
     	waitForConfigAdmin(true);
-    	
+
     	final Dictionary<String, Object> cfgData = new Hashtable<String, Object>();
     	cfgData.put("foo", "bar");
     	final String cfgPid = getClass().getSimpleName() + ".deferred." + System.currentTimeMillis();
@@ -138,30 +138,30 @@ public class ConfigInstallTest extends O
         configAdmin.start();
     	waitForConfigAdmin(true);
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-        waitForConfiguration("Config must be installed once ConfigurationAdmin restarts", 
+        waitForConfiguration("Config must be installed once ConfigurationAdmin restarts",
                 cfgPid, TIMEOUT, true);
-    	
+
         configAdmin.stop();
         waitForConfigAdmin(false);
         resetCounters();
-        installer.removeResource(new InstallableResource(r.getUrl()));
+        installer.removeResource(r.getUrl());
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
         sleep(1000L);
         resetCounters();
         configAdmin.start();
         waitForConfigAdmin(true);
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-        waitForConfiguration("Config must be removed once ConfigurationAdmin restarts", 
+        waitForConfiguration("Config must be removed once ConfigurationAdmin restarts",
                 cfgPid, TIMEOUT, false);
     }
-    
+
     @Test
     public void testReinstallSameConfig() throws Exception {
     	final Dictionary<String, Object> cfgData = new Hashtable<String, Object>();
     	cfgData.put("foo", "bar");
     	final String cfgPid = getClass().getSimpleName() + ".reinstall." + System.currentTimeMillis();
     	assertNull("Config " + cfgPid + " must not be found before test", findConfiguration(cfgPid));
-    	
+
     	// Install config directly
     	ConfigurationAdmin ca = waitForConfigAdmin(true);
     	final Configuration c = ca.getConfiguration(cfgPid);
@@ -169,14 +169,14 @@ public class ConfigInstallTest extends O
         waitForConfigValue("After manual installation", cfgPid, TIMEOUT, "foo", "bar");
 		Condition cond = new Condition() { public boolean isTrue() { return events.size() == 1; }};
         waitForCondition("Expected two ConfigurationEvents since beginning of test", TIMEOUT, cond);
-    	
+
         long nOps = installer.getCounters()[OsgiInstaller.OSGI_TASKS_COUNTER];
         installer.addResource(getInstallableResource(cfgPid, cfgData));
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
         assertEquals("Registering a Configuration that's already installed must not generate OSGi tasks",
                 nOps, installer.getCounters()[OsgiInstaller.OSGI_TASKS_COUNTER]);
         assertEquals("Expected one ConfigurationEvent after (ignored) install via OsgiInstaller", 1, events.size());
-    	
+
     	// Reinstalling with a change must be executed
         cfgData.put("foo", "changed");
         installer.addResource(getInstallableResource(cfgPid, cfgData));

Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigPrioritiesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigPrioritiesTest.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigPrioritiesTest.java (original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/ConfigPrioritiesTest.java Fri Jun 18 09:30:35 2010
@@ -16,11 +16,13 @@
  */
 package org.apache.sling.osgi.installer.it;
 
+import static org.junit.Assert.fail;
+
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import static org.junit.Assert.fail;
 import org.apache.sling.osgi.installer.InstallableResource;
+import org.apache.sling.osgi.installer.InstallableResourceFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.runner.RunWith;
@@ -32,22 +34,22 @@ import org.osgi.service.cm.Configuration
 public class ConfigPrioritiesTest extends OsgiInstallerTestBase {
 
     private final static long TIMEOUT = 5000L;
-    
+
     @org.ops4j.pax.exam.junit.Configuration
     public static Option[] configuration() {
         return defaultConfiguration();
     }
-    
+
     @Before
     public void setUp() {
         setupInstaller();
     }
-    
+
     @After
     public void tearDown() {
         super.tearDown();
     }
-    
+
     void assertConfigValue(String pid, String key, String value, long timeoutMsec) throws Exception {
         boolean found = false;
         final String info = pid + ": waiting for " + key + "=" + value;
@@ -59,33 +61,33 @@ public class ConfigPrioritiesTest extend
                 break;
             }
         } while(System.currentTimeMillis() < end);
-        
+
         if(!found) {
             fail("Did not get expected value: " + info);
         }
     }
-    
+
     public void testOverrideConfig() throws Exception {
         final String pid = getClass().getSimpleName() + "." + System.currentTimeMillis();
         final Dictionary<String, Object> data = new Hashtable<String, Object>();
-        
+
         data.put("foo", "a");
-        final InstallableResource a = getInstallableResource(pid, data, InstallableResource.DEFAULT_PRIORITY - 1);
+        final InstallableResource a = getInstallableResource(pid, data, InstallableResourceFactory.DEFAULT_PRIORITY - 1);
         data.put("foo", "b");
-        final InstallableResource b = getInstallableResource(pid, data, InstallableResource.DEFAULT_PRIORITY);
+        final InstallableResource b = getInstallableResource(pid, data, InstallableResourceFactory.DEFAULT_PRIORITY);
         data.put("foo", "c");
-        final InstallableResource c = getInstallableResource(pid, data, InstallableResource.DEFAULT_PRIORITY + 1);
-        
+        final InstallableResource c = getInstallableResource(pid, data, InstallableResourceFactory.DEFAULT_PRIORITY + 1);
+
         installer.addResource(b);
         assertConfigValue(pid, "foo", "b", TIMEOUT);
         installer.addResource(c);
         assertConfigValue(pid, "foo", "c", TIMEOUT);
         installer.addResource(a);
-        installer.removeResource(new InstallableResource(c.getUrl()));
+        installer.removeResource(c.getUrl());
         assertConfigValue(pid, "foo", "b", TIMEOUT);
-        installer.removeResource(new InstallableResource(b.getUrl()));
+        installer.removeResource(b.getUrl());
         assertConfigValue(pid, "foo", "a", TIMEOUT);
-        installer.removeResource(new InstallableResource(a.getUrl()));
+        installer.removeResource(a.getUrl());
         waitForConfiguration("After removing all resources", pid, TIMEOUT, false);
     }
 }

Added: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java?rev=955903&view=auto
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java (added)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java Fri Jun 18 09:30:35 2010
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.osgi.installer.it;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ObjectOutputStream;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.sling.osgi.installer.InstallableResource;
+import org.apache.sling.osgi.installer.InstallableResourceFactory;
+
+public class MockInstallableResource implements InstallableResource {
+
+    private static int counter;
+
+    private final String uri;
+    private final InputStream is;
+    private final String digest;
+    private final InstallableResource.Type type;
+    private final int priority;
+    private final Dictionary<String, Object> d;
+
+    public MockInstallableResource(String uri) {
+        this(uri, "", null);
+    }
+
+    public MockInstallableResource(String uri, String data, String digest) {
+        this.uri = uri;
+        this.is = new ByteArrayInputStream(data.getBytes());
+        this.digest = getNextDigest(digest);
+        this.type = InstallableResource.Type.BUNDLE;
+        this.priority = InstallableResourceFactory.DEFAULT_PRIORITY;
+        this.d = null;
+    }
+
+    public MockInstallableResource(String uri, InputStream is, String digest, InstallableResource.Type type, Integer priority) {
+        this.uri = uri;
+        this.is = is;
+        this.digest = digest;
+        if ( type != null ) {
+            this.type = type;
+        } else {
+            this.type = InstallableResource.Type.BUNDLE;
+        }
+        if ( priority != null ) {
+            this.priority = priority;
+        } else {
+            this.priority = InstallableResourceFactory.DEFAULT_PRIORITY;
+        }
+        this.d = null;
+    }
+
+    public MockInstallableResource(String uri, Dictionary<String, Object> d, String digest, InstallableResource.Type type, Integer priority) {
+        this.uri = uri;
+        this.is = null;
+        if ( type != null ) {
+            this.type = type;
+        } else {
+            this.type = InstallableResource.Type.CONFIG;
+        }
+        if ( priority != null ) {
+            this.priority = priority;
+        } else {
+            this.priority = InstallableResourceFactory.DEFAULT_PRIORITY;
+        }
+        if ( digest != null ) {
+            this.digest = digest;
+        } else {
+            this.digest = computeDigest(d);
+        }
+        this.d = d;
+    }
+
+    static String getNextDigest(String digest) {
+        if(digest != null) {
+            return digest;
+        }
+        synchronized (MockInstallableResource.class) {
+            return String.valueOf(System.currentTimeMillis() + (counter++));
+        }
+    }
+
+    public Dictionary<String, Object> getDictionary() {
+        return this.d;
+    }
+
+    public String getDigest() {
+        return digest;
+    }
+
+    public InputStream getInputStream() {
+        return is;
+    }
+
+    public int getPriority() {
+        return this.priority;
+    }
+
+    public Type getType() {
+        return this.type;
+    }
+
+    public String getUrl() {
+        return this.uri;
+    }
+
+    /** The digest to be used. */
+    private static final String DIGEST_TYPE = "MD5";
+
+    /** convert digest to readable string (http://www.javalobby.org/java/forums/t84420.html) */
+    private static String digestToString(MessageDigest d) {
+        final BigInteger bigInt = new BigInteger(1, d.digest());
+        return new String(bigInt.toString(16));
+    }
+
+    /** Compute digest on all keys of supplied data */
+    private static String computeDigest(Dictionary<String, Object> data) {
+        try {
+            final MessageDigest d = MessageDigest.getInstance(DIGEST_TYPE);
+            final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+            final ObjectOutputStream oos = new ObjectOutputStream(bos);
+
+            final SortedSet<String> sortedKeys = new TreeSet<String>();
+            if(data != null) {
+                for(Enumeration<String> e = data.keys(); e.hasMoreElements(); ) {
+                    final String key = e.nextElement();
+                    sortedKeys.add(key);
+                }
+            }
+            for(String key : sortedKeys) {
+                oos.writeObject(key);
+                oos.writeObject(data.get(key));
+            }
+
+            bos.flush();
+            d.update(bos.toByteArray());
+            return digestToString(d);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

Propchange: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision rev url

Propchange: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/MockInstallableResource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java (original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java Fri Jun 18 09:30:35 2010
@@ -35,6 +35,7 @@ import java.io.InputStream;
 import java.util.Dictionary;
 
 import org.apache.sling.osgi.installer.InstallableResource;
+import org.apache.sling.osgi.installer.InstallableResourceFactory;
 import org.apache.sling.osgi.installer.OsgiInstaller;
 import org.ops4j.pax.exam.Inject;
 import org.ops4j.pax.exam.Option;
@@ -61,19 +62,19 @@ class OsgiInstallerTestBase implements F
 	private long [] counters;
 	public static final long WAIT_FOR_ACTION_TIMEOUT_MSEC = 5000;
     public static final String BUNDLE_BASE_NAME = "org.apache.sling.osgi.installer.it-" + POM_VERSION;
-    
+
     @Inject
     protected BundleContext bundleContext;
-    
+
     public static final String URL_SCHEME = "OsgiInstallerTest";
-    
+
     static abstract class Condition {
     	abstract boolean isTrue() throws Exception;
     	String additionalInfo() { return null; }
     	void onFailure() { }
     	long getMsecBetweenEvaluations() { return 100L; }
     }
-    
+
     @SuppressWarnings("unchecked")
 	protected <T> T getService(Class<T> clazz) {
     	final ServiceReference ref = bundleContext.getServiceReference(clazz.getName());
@@ -82,19 +83,19 @@ class OsgiInstallerTestBase implements F
     	assertNotNull("getService(" + clazz.getName() + ") must find service", result);
     	return result;
     }
-    
+
     public void setupInstaller() {
         installer = getService(OsgiInstaller.class);
         resetCounters();
     }
-    
+
     public void tearDown() {
         if(configAdminTracker != null) {
             configAdminTracker.close();
             configAdminTracker = null;
         }
     }
-    
+
     protected void restartInstaller() throws BundleException {
         final String symbolicName = "org.apache.sling.osgi.installer";
         final Bundle b = findBundle(symbolicName);
@@ -106,7 +107,7 @@ class OsgiInstallerTestBase implements F
         b.start();
         setupInstaller();
     }
-    
+
     protected void generateBundleEvent() throws Exception {
         // install a bundle manually to generate a bundle event
         final File f = getTestBundle("org.apache.sling.osgi.installer.it-" + POM_VERSION + "-testbundle-1.0.jar");
@@ -128,22 +129,22 @@ class OsgiInstallerTestBase implements F
             }
         }
     }
-    
+
     public void frameworkEvent(FrameworkEvent event) {
         if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) {
             packageRefreshEventsCount++;
         }
     }
-    
+
     protected void refreshPackages() {
         bundleContext.addFrameworkListener(this);
         final int MAX_REFRESH_PACKAGES_WAIT_SECONDS = 5;
         final int targetEventCount = packageRefreshEventsCount + 1;
         final long timeout = System.currentTimeMillis() + MAX_REFRESH_PACKAGES_WAIT_SECONDS * 1000L;
-        
+
         final PackageAdmin pa = getService(PackageAdmin.class);
         pa.refreshPackages(null);
-        
+
         try {
             while(true) {
                 if(System.currentTimeMillis() > timeout) {
@@ -158,7 +159,7 @@ class OsgiInstallerTestBase implements F
             bundleContext.removeFrameworkListener(this);
         }
     }
-    
+
     protected Configuration findConfiguration(String pid) throws Exception {
     	final ConfigurationAdmin ca = getService(ConfigurationAdmin.class);
     	if(ca != null) {
@@ -173,7 +174,7 @@ class OsgiInstallerTestBase implements F
     	}
     	return null;
     }
-    
+
     protected void waitForCondition(String info, long timeoutMsec, Condition c) throws Exception {
         final long end = System.currentTimeMillis() + timeoutMsec;
         do {
@@ -182,15 +183,15 @@ class OsgiInstallerTestBase implements F
         	}
         	Thread.sleep(c.getMsecBetweenEvaluations());
         } while(System.currentTimeMillis() < end);
-        
+
         if(c.additionalInfo() != null) {
         	info += " " + c.additionalInfo();
         }
-        
+
         c.onFailure();
         fail("WaitForCondition failed: " + info);
     }
-    
+
     protected void waitForConfigValue(String info, String pid, long timeoutMsec, String key, String value) throws Exception {
         final long end = System.currentTimeMillis() + timeoutMsec;
         do {
@@ -202,14 +203,14 @@ class OsgiInstallerTestBase implements F
         } while(System.currentTimeMillis() < end);
         fail("Did not get " + key + "=" + value + " for config " + pid);
     }
-    
+
     protected Configuration waitForConfiguration(String info, String pid, long timeoutMsec, boolean shouldBePresent) throws Exception {
         if(info == null) {
             info = "";
         } else {
             info += ": ";
         }
-        
+
         Configuration result = null;
         final long end = System.currentTimeMillis() + timeoutMsec;
         do {
@@ -222,7 +223,7 @@ class OsgiInstallerTestBase implements F
             }
             sleep(25);
         } while(System.currentTimeMillis() < end);
-        
+
         if(shouldBePresent && result == null) {
             fail(info + "Configuration not found (" + pid + ")");
         } else if(!shouldBePresent && result != null) {
@@ -230,7 +231,7 @@ class OsgiInstallerTestBase implements F
         }
         return result;
     }
-    
+
     protected Bundle findBundle(String symbolicName) {
     	for(Bundle b : bundleContext.getBundles()) {
     		if(symbolicName.equals(b.getSymbolicName())) {
@@ -239,7 +240,7 @@ class OsgiInstallerTestBase implements F
     	}
     	return null;
     }
-    
+
     protected Bundle assertBundle(String info, String symbolicName, String version, int state) {
         final Bundle b = findBundle(symbolicName);
         if(info == null) {
@@ -258,43 +259,41 @@ class OsgiInstallerTestBase implements F
         }
         return b;
     }
-    
+
     protected File getTestBundle(String bundleName) {
     	return new File(System.getProperty("osgi.installer.base.dir"), bundleName);
     }
-    
+
     protected InstallableResource getInstallableResource(File testBundle) throws IOException {
         return getInstallableResource(testBundle, null);
     }
-    
-    protected InstallableResource getNonInstallableResource(File testBundle) throws IOException {
-    	return new InstallableResource(URL_SCHEME + ":" + testBundle.getAbsolutePath());
+
+    protected String getNonInstallableResourceUrl(File testBundle) throws IOException {
+    	return URL_SCHEME + ":" + testBundle.getAbsolutePath();
     }
-    
+
     protected InstallableResource getInstallableResource(File testBundle, String digest) throws IOException {
-        return getInstallableResource(testBundle, digest, InstallableResource.DEFAULT_PRIORITY);
+        return getInstallableResource(testBundle, digest, InstallableResourceFactory.DEFAULT_PRIORITY);
     }
-    
+
     protected InstallableResource getInstallableResource(File testBundle, String digest, int priority) throws IOException {
         final String url = URL_SCHEME + ":" + testBundle.getAbsolutePath();
         if(digest == null) {
             digest = testBundle.getAbsolutePath() + testBundle.lastModified();
         }
-        final InstallableResource result = new InstallableResource(url, new FileInputStream(testBundle), digest);
-        result.setPriority(priority);
+        final InstallableResource result = new MockInstallableResource(url, new FileInputStream(testBundle), digest, null, priority);
         return result;
     }
-    
+
     protected InstallableResource getInstallableResource(String configPid, Dictionary<String, Object> data) {
-        return getInstallableResource(configPid, data, InstallableResource.DEFAULT_PRIORITY);
+        return getInstallableResource(configPid, data, InstallableResourceFactory.DEFAULT_PRIORITY);
     }
-    
+
     protected InstallableResource getInstallableResource(String configPid, Dictionary<String, Object> data, int priority) {
-        final InstallableResource result = new InstallableResource(URL_SCHEME + ":/" + configPid, data);
-        result.setPriority(priority);
+        final InstallableResource result = new MockInstallableResource(URL_SCHEME + ":/" + configPid, data, null, null, priority);
         return result;
     }
-    
+
     protected ConfigurationAdmin waitForConfigAdmin(boolean shouldBePresent) {
     	ConfigurationAdmin result = null;
         if(configAdminTracker == null) {
@@ -303,7 +302,7 @@ class OsgiInstallerTestBase implements F
                 configAdminTracker.open();
             }
         }
-        
+
     	final int timeout = 5;
     	final long waitUntil = System.currentTimeMillis() + (timeout * 1000L);
     	do {
@@ -312,31 +311,31 @@ class OsgiInstallerTestBase implements F
     		assertEquals("Expected ConfigurationAdmin to be " + (shouldBePresent ? "present" : "absent"),
     				shouldBePresent, isPresent);
     	} while(System.currentTimeMillis() < waitUntil);
-    	
+
     	return result;
     }
-    
+
     protected void resetCounters() {
         final long [] src = installer.getCounters();
         counters = new long[src.length];
         System.arraycopy(installer.getCounters(), 0, counters, 0, src.length);
     }
-    
+
     protected void sleep(long msec) {
         try {
             Thread.sleep(msec);
         } catch(InterruptedException ignored) {
         }
     }
-    
+
     protected void waitForInstallerAction(int counterType, long howMany) {
         waitForInstallerAction(null, counterType, howMany);
     }
-    
+
     protected void waitForInstallerAction(String info, int counterType, long howMany) {
     	waitForInstallerAction(info, counterType, howMany, 0);
     }
-    
+
     /** @param howMany negative values means absolute, instead of relative to current value */
     protected void waitForInstallerAction(String info, int counterType, long howMany, long timeoutMsec) {
         if(info == null) {
@@ -344,17 +343,17 @@ class OsgiInstallerTestBase implements F
         } else {
             info += ": ";
         }
-        
+
         final boolean waitForCycles = counterType == OsgiInstaller.INSTALLER_CYCLES_COUNTER;
-        
+
         long targetValue = howMany <  0 ? -howMany : counters[counterType] + howMany;
         if(waitForCycles) {
             // if waiting for installer cycles, get initial value from
-            // that counter - we know we want to wait from now on, not from an 
+            // that counter - we know we want to wait from now on, not from an
             // earlier resetCounters() call
             targetValue = installer.getCounters()[counterType] + howMany;
         }
-        
+
         final long timeout = timeoutMsec > 0 ? timeoutMsec : WAIT_FOR_ACTION_TIMEOUT_MSEC;
         final long endTime = System.currentTimeMillis() + timeout;
         long lastValue = 0;
@@ -368,31 +367,31 @@ class OsgiInstallerTestBase implements F
             }
             sleep(10);
         }
-        fail(info + "waitForInstallerAction(" + counterType + "," + howMany 
+        fail(info + "waitForInstallerAction(" + counterType + "," + howMany
                 + ") fails after " + WAIT_FOR_ACTION_TIMEOUT_MSEC + " msec"
                 + ", expected value " + targetValue + ", actual " + lastValue);
     }
-    
+
     /** Verify that no OSGi actions are executed in next two installer cycles */
     protected void assertNoOsgiTasks(String info) {
     	final long actionsCounter = installer.getCounters()[OsgiInstaller.OSGI_TASKS_COUNTER];
     	waitForInstallerAction(OsgiInstaller.INSTALLER_CYCLES_COUNTER, 2);
-    	assertEquals(info + ": OSGi tasks counter should not have changed", 
+    	assertEquals(info + ": OSGi tasks counter should not have changed",
     			actionsCounter, installer.getCounters()[OsgiInstaller.OSGI_TASKS_COUNTER]);
     }
-    
+
     public void assertCounter(int index, long value) {
         assertEquals("Expected value matches for counter " + index, value, installer.getCounters()[index]);
     }
-    
+
     protected void log(int level, String msg) {
     	final LogService log = getService(LogService.class);
     	log.log(LogService.LOG_INFO, msg);
     }
-    
+
     public static Option[] defaultConfiguration() {
     	String vmOpt = "-Dosgi.installer.testing";
-    	
+
     	// This runs in the VM that runs the build, but the tests run in another one.
     	// Make all osgi.installer.* system properties available to OSGi framework VM
     	for(Object o : System.getProperties().keySet()) {
@@ -406,17 +405,17 @@ class OsgiInstallerTestBase implements F
     	final String paxDebugLevel = System.getProperty("pax.exam.log.level");
     	final String paxDebugPort = System.getProperty("pax.exam.debug.port");
     	if(paxDebugPort != null && paxDebugPort.length() > 0) {
-        	vmOpt += " -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + paxDebugPort; 
+        	vmOpt += " -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + paxDebugPort;
     	}
-    	
+
         return options(
                 felix(),
                 vmOption(vmOpt),
                 waitForFrameworkStartup(),
-                
+
                 logProfile(),
                 systemProperty( "org.ops4j.pax.logging.DefaultServiceLog.level" ).value(paxDebugLevel),
-                
+
                 provision(
         	            mavenBundle("org.apache.felix", "org.apache.felix.scr"),
         	            mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),

Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RegisterResourcesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RegisterResourcesTest.java?rev=955903&r1=955902&r2=955903&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RegisterResourcesTest.java (original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/RegisterResourcesTest.java Fri Jun 18 09:30:35 2010
@@ -46,17 +46,17 @@ public class RegisterResourcesTest exten
     public static Option[] configuration() {
         return defaultConfiguration();
     }
-    
+
     @Before
     public void setUp() {
         setupInstaller();
     }
-    
+
     @After
     public void tearDown() {
         super.tearDown();
     }
-    
+
     @Test
     public void initialRegistrationTest() throws IOException {
         resetCounters();
@@ -65,18 +65,18 @@ public class RegisterResourcesTest exten
         r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-needsB.jar")));
         r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar")));
         r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.2.jar")));
-        
+
         installer.registerResources(r, URL_SCHEME);
-        
+
         // Wait for worker thread to wake up and become idle once
         waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-        
+
         final String info = "After initial registration";
         assertBundle(info, "osgi-installer-testB", "1.0", Bundle.ACTIVE);
         assertBundle(info, "osgi-installer-needsB", "1.0", Bundle.ACTIVE);
         assertBundle(info, "osgi-installer-testbundle", "1.2", Bundle.ACTIVE);
     }
-    
+
     @Test
     public void removeAndReaddBundlesTest() throws IOException, BundleException {
         {
@@ -86,16 +86,16 @@ public class RegisterResourcesTest exten
             r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-needsB.jar")));
             r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar")));
             r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar")));
-            
+
             installer.registerResources(r, URL_SCHEME);
             waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-            
+
             final String info = "After initial registration";
             assertBundle(info, "osgi-installer-testB", "1.0", Bundle.ACTIVE);
             assertBundle(info, "osgi-installer-needsB", "1.0", Bundle.ACTIVE);
             assertBundle(info, "osgi-installer-testbundle", "1.1", Bundle.ACTIVE);
         }
-        
+
         {
             // Add test 1.2 in between, to make sure it disappears in next registerResources call
             resetCounters();
@@ -103,18 +103,18 @@ public class RegisterResourcesTest exten
             waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
             assertBundle("After adding testbundle V1.2", "osgi-installer-testbundle", "1.2", Bundle.ACTIVE);
         }
-        
+
         {
             // Add a bundle with different URL scheme - must not be removed by registerResources
             resetCounters();
-            installer.addResource(new InstallableResource(
-                    "anotherscheme:testA.jar", 
-                    new FileInputStream(getTestBundle(BUNDLE_BASE_NAME + "-testA-1.0.jar")), 
-                    "digest1"));
+            installer.addResource(new MockInstallableResource(
+                    "anotherscheme:testA.jar",
+                    new FileInputStream(getTestBundle(BUNDLE_BASE_NAME + "-testA-1.0.jar")),
+                    "digest1", null, null));
             waitForInstallerAction(OsgiInstaller.OSGI_TASKS_COUNTER, 2);
             assertBundle("testA bundle added", "osgi-installer-testA", "1.0", Bundle.ACTIVE);
         }
-        
+
         {
             // Simulate later registration where some bundles have disappeared
             // the installer must mark them "not installable" and act accordingly
@@ -122,34 +122,34 @@ public class RegisterResourcesTest exten
             r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-needsB.jar")));
             r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar")));
             r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-snap.jar"), "digest1"));
-            
+
             installer.registerResources(r, URL_SCHEME);
             waitForInstallerAction(OsgiInstaller.INSTALLER_CYCLES_COUNTER, 2);
-            
-            assertBundle("Snapshot bundle must be started", 
+
+            assertBundle("Snapshot bundle must be started",
                     "osgi-installer-snapshot-test", "1.0.0.SNAPSHOT", Bundle.ACTIVE);
             assertNull("Bundle testB must be gone", findBundle("osgi-installer-testB"));
-            final Bundle b = assertBundle("Bundle needsB must still be present", 
+            final Bundle b = assertBundle("Bundle needsB must still be present",
                     "osgi-installer-needsB", "1.0", -1);
             final int state = b.getState();
             assertFalse("Bundle needsB must be stopped as testB is gone (" + state + ")", Bundle.ACTIVE == state);
-            assertBundle("Testbundle must be back to 1.0 as 1.1 and 1.2 is gone", 
+            assertBundle("Testbundle must be back to 1.0 as 1.1 and 1.2 is gone",
                     "osgi-installer-testbundle", "1.0", Bundle.ACTIVE);
             assertBundle("testA bundle should still be present", "osgi-installer-testA", "1.0", Bundle.ACTIVE);
         }
-        
+
         {
             // Re-add the missing bundles and recheck
             installer.addResource(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testB-1.0.jar")));
             installer.addResource(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.2.jar")));
-            
+
             waitForInstallerAction(OsgiInstaller.INSTALLER_CYCLES_COUNTER, 2);
-            
+
             final String info = "After re-adding missing bundles";
             assertBundle(info, "osgi-installer-testB", "1.0", Bundle.ACTIVE);
             assertBundle(info, "osgi-installer-testbundle", "1.2", Bundle.ACTIVE);
             assertBundle(info, "osgi-installer-snapshot-test", "1.0.0.SNAPSHOT", Bundle.ACTIVE);
-            
+
             final Bundle b = findBundle("osgi-installer-needsB");
             b.start();
             assertBundle("After reinstalling testB, needsB must be startable, ",
@@ -157,7 +157,7 @@ public class RegisterResourcesTest exten
             assertBundle("testA bundle should still be present", "osgi-installer-testA", "1.0", Bundle.ACTIVE);
         }
     }
-    
+
     @Test
     public void reAddZeroResourcesTest() throws IOException {
         {
@@ -167,16 +167,16 @@ public class RegisterResourcesTest exten
             r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-needsB.jar")));
             r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.0.jar")));
             r.add(getInstallableResource(getTestBundle(BUNDLE_BASE_NAME + "-testbundle-1.1.jar")));
-            
+
             installer.registerResources(r, URL_SCHEME);
             waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
-            
+
             final String info = "After initial registration";
             assertBundle(info, "osgi-installer-testB", "1.0", Bundle.ACTIVE);
             assertBundle(info, "osgi-installer-needsB", "1.0", Bundle.ACTIVE);
             assertBundle(info, "osgi-installer-testbundle", "1.1", Bundle.ACTIVE);
         }
-        
+
         {
         	resetCounters();
         	installer.registerResources(new LinkedList<InstallableResource>(), URL_SCHEME);



Mime
View raw message