Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2013-02-05 01:29:29 +0000
committerPascal Rapicault2013-02-05 01:34:38 +0000
commitc0d06cc4735ba69c02d5783b602942725339f39f (patch)
tree5adaa245e536d170602585771c83d2caa42ab9d4 /bundles/org.eclipse.equinox.p2.tests.verifier
parent5abf4e9621f428eb2e5cac19c40a715833a24cdd (diff)
downloadrt.equinox.p2-c0d06cc4735ba69c02d5783b602942725339f39f.tar.gz
rt.equinox.p2-c0d06cc4735ba69c02d5783b602942725339f39f.tar.xz
rt.equinox.p2-c0d06cc4735ba69c02d5783b602942725339f39f.zip
Add end to end tests for shared installv20130205-013438
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.verifier')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java70
1 files changed, 67 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
index fd9029c8d..0c53a5489 100644
--- a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
+++ b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
@@ -279,9 +279,11 @@ public class VerifierApplication implements IApplication {
IProfile profile = registry.getProfile(IProfileRegistry.SELF);
if (profile == null)
return createError("SELF profile not available in profile registry."); //$NON-NLS-1$
- IQueryResult results = profile.query(QueryUtil.createIUQuery(Activator.PLUGIN_ID), null);
- if (results.isEmpty())
- return createError(NLS.bind("IU for {0} not found in SELF profile.", Activator.PLUGIN_ID)); //$NON-NLS-1$
+ if (!Boolean.FALSE.toString().equals(properties.get("checkPresenceOfVerifier"))) {
+ IQueryResult results = profile.query(QueryUtil.createIUQuery(Activator.PLUGIN_ID), null);
+ if (results.isEmpty())
+ return createError(NLS.bind("IU for {0} not found in SELF profile.", Activator.PLUGIN_ID)); //$NON-NLS-1$
+ }
return Status.OK_STATUS;
}
@@ -302,7 +304,69 @@ public class VerifierApplication implements IApplication {
if (!temp.isOK())
result.merge(temp);
+ temp = hasProfileFlag();
+ if (!temp.isOK())
+ result.merge(temp);
+
+ temp = checkAbsenceOfBundles();
+ if (!temp.isOK())
+ result.merge(temp);
+
+ temp = checkPresenceOfBundles();
+ if (!temp.isOK())
+ result.merge(temp);
+
return result;
}
+ private IStatus checkAbsenceOfBundles() {
+ MultiStatus result = new MultiStatus(Activator.PLUGIN_ID, IStatus.ERROR, "Some bundles should not be there", null);
+ String unexpectedBundlesString = properties.getProperty("unexpectedBundleList");
+ if (unexpectedBundlesString == null)
+ return Status.OK_STATUS;
+ String[] unexpectedBundles = unexpectedBundlesString.split(",");
+ for (String bsn : unexpectedBundles) {
+ if (containsBundle(bsn)) {
+ result.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, bsn + " should not have been found in the install"));
+ }
+ }
+ if (result.getChildren().length == 0)
+ return Status.OK_STATUS;
+ return result;
+ }
+
+ private IStatus checkPresenceOfBundles() {
+ MultiStatus result = new MultiStatus(Activator.PLUGIN_ID, IStatus.ERROR, "Some bundles should not be there", null);
+ String expectedBundlesString = properties.getProperty("expectedBundleList");
+ if (expectedBundlesString == null)
+ return Status.OK_STATUS;
+ String[] expectedBundles = expectedBundlesString.split(",");
+ for (String bsn : expectedBundles) {
+ if (!containsBundle(bsn)) {
+ result.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, bsn + " is missing from the install"));
+ }
+ }
+ if (result.getChildren().length == 0)
+ return Status.OK_STATUS;
+ return result;
+ }
+
+ private boolean containsBundle(String bsn) {
+ PlatformAdmin platformAdmin = (PlatformAdmin) ServiceHelper.getService(Activator.getBundleContext(), PlatformAdmin.class.getName());
+ State state = platformAdmin.getState(false);
+ return state.getBundle(bsn, null) != null;
+ }
+
+ private IStatus hasProfileFlag() {
+ if (properties.getProperty("checkProfileResetFlag") == null)
+ return Status.OK_STATUS;
+ //Make sure that the profile is already loaded
+ IProfileRegistry reg = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+ reg.getProfile(IProfileRegistry.SELF);
+
+ if (Boolean.valueOf(properties.getProperty("checkProfileResetFlag")).booleanValue() == (agent.getService(IProfileRegistry.SERVICE_SHARED_INSTALL_NEW_TIMESTAMP) != null))
+ return Status.OK_STATUS;
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The flag indicating that a profile has been reset is incorrectly setup");
+ }
+
}

Back to the top