Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2017-01-03 20:05:49 +0000
committerThomas Watson2017-01-03 20:26:39 +0000
commit7546c8d7442baea4203dcf9227273f9f6d1e0fd9 (patch)
tree01f85ad3541f183b988cfd1a133cfeb4485b1f42
parent302ccc4f96f012f41b5d946971a04ef50dd2721e (diff)
downloadrt.equinox.framework-7546c8d7442baea4203dcf9227273f9f6d1e0fd9.tar.gz
rt.equinox.framework-7546c8d7442baea4203dcf9227273f9f6d1e0fd9.tar.xz
rt.equinox.framework-7546c8d7442baea4203dcf9227273f9f6d1e0fd9.zip
Bug 509876 - PlatformAdmin read-only state uses wrong timestamp forI20170105-0320I20170105-0230I20170104-2000I20170104-0800I20170103-2000
State.getTimeStamp() Change-Id: I42c703cfec338f7eb1950d5d9c4d0c222fe792eb Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java4
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java23
2 files changed, 24 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java
index 77113e4f9..3f35cd719 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2016 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2012, 2017 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -72,7 +72,7 @@ public class PlatformAdminImpl implements PlatformAdmin {
long getTimeStamp() {
synchronized (this.monitor) {
- return equinoxContainer.getStorage().getModuleDatabase().getTimestamp();
+ return equinoxContainer.getStorage().getModuleDatabase().getRevisionsTimestamp();
}
}
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java
index c7f4dde32..5bb8d5852 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,6 +19,7 @@ import junit.framework.TestSuite;
import org.eclipse.osgi.service.resolver.*;
import org.eclipse.osgi.tests.OSGiTestsActivator;
import org.osgi.framework.*;
+import org.osgi.framework.startlevel.BundleStartLevel;
import org.osgi.framework.wiring.FrameworkWiring;
public class PlatformAdminBundleTests extends AbstractBundleTests {
@@ -163,4 +164,24 @@ public class PlatformAdminBundleTests extends AbstractBundleTests {
getContext().removeFrameworkListener(errorListener);
}
}
+
+ public void testTimestamp() throws BundleException {
+ PlatformAdmin pa = installer.getPlatformAdmin();
+ // get system state first to ensure it does not have the test bundle
+ State systemState = pa.getState(false);
+
+ long initialTimeStamp = systemState.getTimeStamp();
+ Bundle test = installer.installBundle("test");
+
+ assertTrue("Timestamp has not changed.", initialTimeStamp != systemState.getTimeStamp());
+
+ initialTimeStamp = systemState.getTimeStamp();
+ test.adapt(BundleStartLevel.class).setStartLevel(1000);
+
+ assertTrue("Timestamp has not changed.", initialTimeStamp == systemState.getTimeStamp());
+
+ initialTimeStamp = systemState.getTimeStamp();
+ test.uninstall();
+ assertTrue("Timestamp has not changed.", initialTimeStamp != systemState.getTimeStamp());
+ }
}

Back to the top