incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r996507 - in /sling/trunk/installer/osgi/installer/src: main/java/org/apache/sling/osgi/installer/impl/ main/java/org/apache/sling/osgi/installer/impl/tasks/ test/java/org/apache/sling/osgi/installer/impl/ test/java/org/apache/sling/osgi/in...
Date Mon, 13 Sep 2010 11:54:05 GMT
Author: cziegeler
Date: Mon Sep 13 11:54:05 2010
New Revision: 996507

URL: http://svn.apache.org/viewvc?rev=996507&view=rev
Log:
SLING-1737 : Add state management for resources

Removed:
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/PersistentBundleInfo.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/tasks/PersistentBundleInfoTest.java
Modified:
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResource.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResourceImpl.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleTaskCreator.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SystemBundleUpdateTask.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleResource.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/tasks/BundleTaskCreatorTest.java

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java?rev=996507&r1=996506&r2=996507&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java
Mon Sep 13 11:54:05 2010
@@ -498,6 +498,7 @@ public class OsgiInstallerImpl
             logger.debug("Executing task: {}", t);
             t.execute(ctx);
         }
+        persistentList.save();
     }
 
     /**

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResource.java?rev=996507&r1=996506&r2=996507&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResource.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/RegisteredResource.java
Mon Sep 13 11:54:05 2010
@@ -98,8 +98,6 @@ public interface RegisteredResource exte
      */
     String getEntityId();
 
-    long getSerialNumber();
-
     State getState();
 
     void setState(final State s);

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=996507&r1=996506&r2=996507&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
Mon Sep 13 11:54:05 2010
@@ -59,7 +59,7 @@ public class RegisteredResourceImpl
     private static final String ENTITY_BUNDLE_PREFIX = "bundle:";
     private static final String ENTITY_CONFIG_PREFIX = "config:";
 
-    private static final long serialVersionUID = 4L;
+    private static final long serialVersionUID = 5L;
 
     /** The resource url. */
     private final String url;
@@ -75,8 +75,9 @@ public class RegisteredResourceImpl
 	private final Map<String, Object> attributes = new HashMap<String, Object>();
 	private final File dataFile;
 	private final int priority;
-    private final long serialNumber;
-    private static long serialNumberCounter = System.currentTimeMillis();
+
+	/** Serial number to create unique file names in the data storage. */
+	private static long serialNumberCounter = System.currentTimeMillis();
 
     private final String resourceType;
 
@@ -142,7 +143,6 @@ public class RegisteredResourceImpl
 		this.resourceType = type;
 		this.priority = priority;
         this.dictionary = copy(dict);
-		this.serialNumber = getNextSerialNumber();
 
 		if (resourceType.equals(InstallableResource.TYPE_BUNDLE)) {
             try {
@@ -212,11 +212,11 @@ public class RegisteredResourceImpl
 	    return "RegisteredResource(url=" + this.getURL() +
 	        ", entity=" + this.getEntityId() +
 	        ", state=" + this.state +
-	        ", digest=" + this.getDigest() + ", serialNumber=" + this.getSerialNumber() + ")";
+	        ", digest=" + this.getDigest() + ")";
 	}
 
 	protected File getDataFile(final BundleContext bundleContext) {
-		final String filename = getClass().getSimpleName() + "." + serialNumber;
+		final String filename = getType() + "-resource-" + getNextSerialNumber() + ".ser";
 		return bundleContext.getDataFile(filename);
 	}
 
@@ -261,13 +261,8 @@ public class RegisteredResourceImpl
 	}
 
     /**
-     * @see org.apache.sling.osgi.installer.impl.RegisteredResource#getSerialNumber()
+     * Copy data to local storage.
      */
-    public long getSerialNumber() {
-        return this.serialNumber;
-    }
-
-    /** Copy data to local storage */
 	private void copyToLocalStorage(final InputStream data) throws IOException {
 		final OutputStream os = new BufferedOutputStream(new FileOutputStream(this.dataFile));
 		try {
@@ -282,7 +277,9 @@ public class RegisteredResourceImpl
 		}
 	}
 
-	/** Copy given Dictionary */
+	/**
+	 * Copy given Dictionary
+	 */
 	private Dictionary<String, Object> copy(final Dictionary<String, Object> d)
{
 	    if ( d == null ) {
 	        return null;
@@ -473,11 +470,6 @@ public class RegisteredResourceImpl
 
         if (result == 0 && isSnapshot) {
             result = a.getDigest().compareTo(b.getDigest());
-            // For snapshots, compare serial numbers so that snapshots registered
-            // later get priority
-            if ( result != 0 ) {
-                result = Long.valueOf(b.getSerialNumber()).compareTo(a.getSerialNumber());
-            }
         }
 
         return result;

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java?rev=996507&r1=996506&r2=996507&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java
Mon Sep 13 11:54:05 2010
@@ -23,8 +23,6 @@ import org.apache.sling.osgi.installer.i
 import org.apache.sling.osgi.installer.impl.OsgiInstallerTask;
 import org.apache.sling.osgi.installer.impl.RegisteredResource;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
 import org.osgi.service.startlevel.StartLevel;
 
 /** Install a bundle supplied as a RegisteredResource.
@@ -69,8 +67,6 @@ public class BundleInstallTask extends O
                             startLevel, b);
                 }
             }
-            final Version newVersion = new Version((String)getResource().getAttributes().get(Constants.BUNDLE_VERSION));
-            this.creator.getBundleDigestStorage().putInfo(b.getSymbolicName(), getResource().getDigest(),
newVersion.toString());
 
             // mark this resource as installed and to be started
             this.getResource().getAttributes().put(BundleTaskCreator.ATTR_START, "true");

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleTaskCreator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleTaskCreator.java?rev=996507&r1=996506&r2=996507&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleTaskCreator.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleTaskCreator.java
Mon Sep 13 11:54:05 2010
@@ -18,9 +18,6 @@
  */
 package org.apache.sling.osgi.installer.impl.tasks;
 
-import java.io.IOException;
-import java.util.TreeSet;
-
 import org.apache.sling.osgi.installer.impl.OsgiInstallerTask;
 import org.apache.sling.osgi.installer.impl.RegisteredResource;
 import org.osgi.framework.Bundle;
@@ -49,9 +46,6 @@ public class BundleTaskCreator {
     /** Interface of the start level */
     private static String START_LEVEL_NAME = StartLevel.class.getName();
 
-    /** The filename for the digest storage. */
-    private static final String FILE_DIGEST_STORAGE = "bundle-digests.properties";
-
     private static final String MAVEN_SNAPSHOT_MARKER = "SNAPSHOT";
 
     /** Tracker for the package admin. */
@@ -60,9 +54,6 @@ public class BundleTaskCreator {
     /** Tracker for the start level service. */
     private final ServiceTracker startLevelTracker;
 
-    /** The storage for the bundle info. */
-    private final PersistentBundleInfo bundleDigestsStorage;
-
     /** The bundle context. */
     private final BundleContext bundleContext;
 
@@ -76,7 +67,6 @@ public class BundleTaskCreator {
         this.packageAdminTracker.open();
         this.startLevelTracker = new ServiceTracker(bc, START_LEVEL_NAME, null);
         this.startLevelTracker.open();
-        this.bundleDigestsStorage = new PersistentBundleInfo(bc.getDataFile(FILE_DIGEST_STORAGE));
     }
 
     /**
@@ -85,19 +75,6 @@ public class BundleTaskCreator {
     public void deactivate() {
         this.packageAdminTracker.close();
         this.startLevelTracker.close();
-        final TreeSet<String> installedBundlesSymbolicNames = new TreeSet<String>();
-        // do we really want to iterate here? Over all bundles? TODO
-        for(Bundle b : bundleContext.getBundles()) {
-            final String name = b.getSymbolicName();
-            if ( name != null ) {
-                installedBundlesSymbolicNames.add(b.getSymbolicName());
-            }
-        }
-        try {
-            this.bundleDigestsStorage.purgeAndSave(installedBundlesSymbolicNames);
-        } catch (final IOException e) {
-            logger.warn("Service failed to save state.", e);
-        }
     }
 
     public BundleContext getBundleContext() {
@@ -148,8 +125,7 @@ public class BundleTaskCreator {
 		if (toActivate.getState() == RegisteredResource.State.UNINSTALL) {
 		    // Remove corresponding bundle if present and if we installed it
 		    if (info != null
-		        && this.bundleDigestsStorage.getInstalledVersion(symbolicName) != null
-		        && this.bundleDigestsStorage.getDigest(symbolicName).equals(toActivate.getDigest()))
{
+		        && info.version.equals(new Version((String)toActivate.getAttributes().get(Constants.BUNDLE_VERSION)))
) {
 		        result = new BundleRemoveTask(toActivate, this);
 		    } else {
 	            logger.info("Bundle {} was not installed by this module, not removed", symbolicName);
@@ -158,7 +134,7 @@ public class BundleTaskCreator {
 
 		// Install
 		} else {
-		    // check if we should start the bundle
+		    // check if we should start the bundle as we installed it in the previous run
 		    if (info == null) {
 			    // bundle is not installed yet: install
 			    result = new BundleInstallTask(toActivate, this);
@@ -173,17 +149,8 @@ public class BundleTaskCreator {
                     // installed version is lower -> update
                     doUpdate = true;
                 } else if (compare > 0) {
-	                // installed version is higher -> downgrade only if
-                    // we installed that version
-                    final String installedVersion = this.bundleDigestsStorage.getInstalledVersion(info.symbolicName);
-                    if (info.version.toString().equals(installedVersion)) {
-                        doUpdate = true;
-                        logger.info("Bundle " + info.symbolicName + " " + installedVersion
-                                    + " was installed by this module, downgrading to " +
newVersion);
-                    } else {
-                        logger.info("Bundle " + info.symbolicName + " " + installedVersion
-                                    + " was not installed by this module, not downgraded");
-                    }
+                    logger.debug("Bundle " + info.symbolicName + " " + newVersion
+                                + " is not installed, bundle with higher version is already
installed.");
 			    } else if (compare == 0 && this.isSnapshot(newVersion)) {
 			        // installed, same version but SNAPSHOT
 			        doUpdate = true;
@@ -214,12 +181,6 @@ public class BundleTaskCreator {
 	}
 
     /**
-     * Get the digest storage.
-     */
-    public PersistentBundleInfo getBundleDigestStorage() {
-        return this.bundleDigestsStorage;
-    }
-    /**
      * Finds the bundle with given symbolic name in our bundle context.
      */
     public Bundle getMatchingBundle(String bundleSymbolicName) {

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java?rev=996507&r1=996506&r2=996507&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java
Mon Sep 13 11:54:05 2010
@@ -57,10 +57,6 @@ public class BundleUpdateTask extends Os
 
         final Version newVersion = new Version((String)getResource().getAttributes().get(Constants.BUNDLE_VERSION));
 
-        // check for system bundle update
-        if ( Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName) ) {
-            this.creator.getBundleDigestStorage().putInfo(b.getSymbolicName(), getResource().getDigest(),
newVersion.toString());
-        }
         // Do not update if same version, unless snapshot
         boolean snapshot = false;
     	final Version currentVersion = new Version((String)b.getHeaders().get(Constants.BUNDLE_VERSION));
@@ -73,18 +69,6 @@ public class BundleUpdateTask extends Os
     	}
 
     	try {
-            // If snapshot and ready to update, cancel if digest didn't change - as the list
-            // of RegisteredResources is not saved, this might not have been detected earlier,
-            // if the snapshot was installed and the installer was later restarted
-            if (snapshot) {
-                final String oldDigest = this.creator.getBundleDigestStorage().getDigest(symbolicName);
-                if (getResource().getDigest().equals(oldDigest)) {
-                    this.getLogger().debug("Snapshot digest did not change, ignoring update:
{}", getResource());
-                    this.getResource().setState(RegisteredResource.State.INSTALLED);
-                    return;
-                }
-            }
-
             // If the bundle is active before the update - restart it once updated, but
             // in sequence, not right now
             final boolean reactivate = (b.getState() == Bundle.ACTIVE);
@@ -92,7 +76,6 @@ public class BundleUpdateTask extends Os
 
             b.update(getResource().getInputStream());
             ctx.log("Updated bundle {} from resource {}", b, getResource());
-            this.creator.getBundleDigestStorage().putInfo(b.getSymbolicName(), getResource().getDigest(),
newVersion.toString());
 
             if (reactivate) {
                 this.getResource().getAttributes().put(BundleTaskCreator.ATTR_START, "true");

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SystemBundleUpdateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SystemBundleUpdateTask.java?rev=996507&r1=996506&r2=996507&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SystemBundleUpdateTask.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SystemBundleUpdateTask.java
Mon Sep 13 11:54:05 2010
@@ -27,7 +27,6 @@ import org.apache.sling.osgi.installer.i
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
 
 /**
  * Update the system bundle from a RegisteredResource.
@@ -51,7 +50,6 @@ public class SystemBundleUpdateTask exte
         if (b == null) {
             throw new IllegalStateException("Bundle to update (" + symbolicName + ") not
found");
         }
-        final Version newVersion = new Version((String)getResource().getAttributes().get(Constants.BUNDLE_VERSION));
 
         InputStream is = null;
         try {
@@ -61,7 +59,6 @@ public class SystemBundleUpdateTask exte
                         "RegisteredResource provides null InputStream, cannot update bundle:
"
                         + getResource());
             }
-            this.creator.getBundleDigestStorage().putInfo(b.getSymbolicName(), getResource().getDigest(),
newVersion.toString());
             // delayed system bundle update
             final InputStream backgroundIS = is;
             is = null;

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleResource.java?rev=996507&r1=996506&r2=996507&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleResource.java
(original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/MockBundleResource.java
Mon Sep 13 11:54:05 2010
@@ -35,8 +35,6 @@ public class MockBundleResource implemen
 	private State state = State.INSTALL;
 	private final String digest;
 	private final int priority;
-	private final long serialNumber;
-	private static long serialNumberCounter = System.currentTimeMillis();
 
     public MockBundleResource(String symbolicName, String version) {
         this(symbolicName, version, InstallableResource.DEFAULT_PRIORITY);
@@ -47,7 +45,6 @@ public class MockBundleResource implemen
 		attributes.put(Constants.BUNDLE_VERSION, version);
 		digest = symbolicName + "." + version;
 		this.priority = priority;
-		serialNumber = getNextSerialNumber();
 	}
 
     public MockBundleResource(String symbolicName, String version, int priority, String digest)
{
@@ -55,13 +52,6 @@ public class MockBundleResource implemen
         attributes.put(Constants.BUNDLE_VERSION, version);
         this.digest = digest;
         this.priority = priority;
-        serialNumber = getNextSerialNumber();
-    }
-
-    private static long getNextSerialNumber() {
-        synchronized (MockBundleResource.class) {
-            return serialNumberCounter++;
-        }
     }
 
 	@Override
@@ -145,13 +135,6 @@ public class MockBundleResource implemen
     }
 
     /**
-     * @see org.apache.sling.osgi.installer.impl.RegisteredResource#getSerialNumber()
-     */
-    public long getSerialNumber() {
-        return serialNumber;
-    }
-
-    /**
      * @see java.lang.Comparable#compareTo(java.lang.Object)
      */
     public int compareTo(RegisteredResource o) {

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/tasks/BundleTaskCreatorTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/tasks/BundleTaskCreatorTest.java?rev=996507&r1=996506&r2=996507&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/tasks/BundleTaskCreatorTest.java
(original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/tasks/BundleTaskCreatorTest.java
Mon Sep 13 11:54:05 2010
@@ -160,16 +160,7 @@ public class BundleTaskCreatorTest {
             final MockBundleTaskCreator c = new MockBundleTaskCreator();
             c.addBundleInfo(SN, "1.0", Bundle.ACTIVE);
             final SortedSet<OsgiInstallerTask> s = getTasks(r, c);
-            assertEquals("Expected one task, bundle was not installed by us", 1, s.size());
-            assertTrue("Expected a ChangeStateTask", s.first() instanceof ChangeStateTask);
-        }
-
-        {
-            final MockBundleTaskCreator c = new MockBundleTaskCreator();
-            c.getBundleDigestStorage().putInfo(SN, r[0].getDigest(), version);
-            c.addBundleInfo(SN, "1.0", Bundle.ACTIVE);
-            final SortedSet<OsgiInstallerTask> s = getTasks(r, c);
-            assertEquals("Expected one task, as we installed that bundle", 1, s.size());
+            assertEquals("Expected one task, remove bundle", 1, s.size());
             assertTrue("Expected a BundleRemoveTask", s.first() instanceof BundleRemoveTask);
         }
     }
@@ -189,21 +180,12 @@ public class BundleTaskCreatorTest {
             final MockBundleTaskCreator c = new MockBundleTaskCreator();
             c.addBundleInfo(SN, "1.1", Bundle.ACTIVE);
             final SortedSet<OsgiInstallerTask> s = getTasks(r, c);
-            assertEquals("Expected one tasks, bundle was not installed by us",1, s.size());
-            assertTrue("Expected a ChangeStateTask", s.first() instanceof ChangeStateTask);
-        }
-
-        {
-            final MockBundleTaskCreator c = new MockBundleTaskCreator();
-            c.addBundleInfo(SN, "1.1", Bundle.ACTIVE);
-            c.getBundleDigestStorage().putInfo(SN, r[1].getDigest(), "1.1");
-            final SortedSet<OsgiInstallerTask> s = getTasks(r, c);
-            assertEquals("Expected two tasks, as we installed that bundle", 2, s.size());
+            assertEquals("Expected one tasks, bundle was not installed by us", 2, s.size());
             final Iterator<OsgiInstallerTask> i = s.iterator();
             final OsgiInstallerTask first = i.next();
-            assertTrue("Expected a ChangeStateTask:" + first , first instanceof ChangeStateTask);
             final OsgiInstallerTask second = i.next();
-            assertTrue("Expected a BundleRemoveTask: " + second, second instanceof BundleRemoveTask);
+            assertTrue("Expected a ChangeStateTask", first instanceof ChangeStateTask);
+            assertTrue("Expected a BundleRemoveTask", second instanceof BundleRemoveTask);
         }
     }
 
@@ -220,17 +202,16 @@ public class BundleTaskCreatorTest {
        {
             final MockBundleTaskCreator c = new MockBundleTaskCreator();
             c.addBundleInfo(SN, "1.1.0", Bundle.ACTIVE);
-            c.getBundleDigestStorage().putInfo(SN, r[1].getDigest(), "1.1.0");
 
             final SortedSet<OsgiInstallerTask> s = getTasks(r, c);
             assertEquals("Expected two tasks", 2, s.size());
             final Iterator<OsgiInstallerTask> i = s.iterator();
             final OsgiInstallerTask first = i.next();
-            assertTrue("Expected a BundleRemoveTask:" + first , first instanceof BundleRemoveTask);
+            assertTrue("Expected a ChangeStateTask:" + first , first instanceof ChangeStateTask);
             final OsgiInstallerTask second = i.next();
-            assertTrue("Expected a BundleUpdateTask", second instanceof BundleUpdateTask);
-            final BundleUpdateTask t = (BundleUpdateTask)second;
-            assertEquals("Update should be to V1.0", r[0], t.getResource());
+            assertTrue("Expected a BundleRemoveTask", second instanceof BundleRemoveTask);
+            final BundleRemoveTask t = (BundleRemoveTask)second;
+            assertEquals("Remove should be to V1.1", r[1], t.getResource());
         }
     }
 }
\ No newline at end of file



Mime
View raw message