Bug 573950 - Secure storage provider compat break
- fix ObsoletesTest to be ignored on Linux test systems where
LinuxPasswordProvider.isValid() returns false
Change-Id: I35cc8a27387c1e38c88905cb1f0fa977a5c3fb7d
Signed-off-by: Jeff Johnston <jjohnstn@redhat.com>
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.bundles/+/182410
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ObsoletesTest.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ObsoletesTest.java
index 86610b1..8eb3285 100644
--- a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ObsoletesTest.java
+++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ObsoletesTest.java
@@ -17,8 +17,10 @@
import static org.junit.Assert.assertNotNull;
import java.util.List;
+import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.security.storage.friends.InternalExchangeUtils;
import org.eclipse.equinox.internal.security.storage.friends.PasswordProviderDescription;
+import org.eclipse.equinox.internal.security.storage.provider.IValidatingPasswordProvider;
import org.eclipse.equinox.internal.security.tests.SecurityTestsActivator;
import org.junit.Before;
import org.junit.Test;
@@ -27,11 +29,42 @@
public class ObsoletesTest {
- final private static String LINUX_BUNDLE = "org.eclipse.equinox.security.linux";
+ final private static String LINUX_BUNDLE = "org.eclipse.equinox.security.linux"; //$NON-NLS-1$
+ final private static String EXTENSION_POINT = "org.eclipse.equinox.security.secureStorage"; //$NON-NLS-1$
+ final private static String LINUX_PASSWORD_PROVIDER = "org.eclipse.equinox.security.securestorage.linuxkeystoreintegrationjna"; //$NON-NLS-1$
+ final private static String CLASS_NAME = "class"; //$NON-NLS-1$
@Before
public void setUp() {
org.junit.Assume.assumeTrue(hasBundle(LINUX_BUNDLE));
+ IExtensionRegistry registry = RegistryFactory.getRegistry();
+ IExtensionPoint point = registry.getExtensionPoint(EXTENSION_POINT);
+ IExtension[] extensions = point.getExtensions();
+ IExtension linuxExtension = null;
+ for (IExtension extension : extensions) {
+ String moduleID = extension.getUniqueIdentifier();
+ if (moduleID == null) // IDs on those extensions are mandatory; if not specified, ignore the extension
+ continue;
+ moduleID = moduleID.toLowerCase();
+ if (moduleID.equals(LINUX_PASSWORD_PROVIDER)) {
+ linuxExtension = extension;
+ break;
+ }
+ }
+ org.junit.Assume.assumeTrue(linuxExtension != null);
+ IConfigurationElement[] elements = linuxExtension.getConfigurationElements();
+ org.junit.Assume.assumeTrue(elements.length > 0);
+ IConfigurationElement element = elements[0]; // only one module is allowed per extension
+ Object clazz;
+ try {
+ clazz = element.createExecutableExtension(CLASS_NAME);
+ // Bug 537833 - on some Linux systems, the password provider does not work (e.g.
+ // Linux KDE)
+ org.junit.Assume.assumeTrue(
+ clazz instanceof IValidatingPasswordProvider && ((IValidatingPasswordProvider) clazz).isValid());
+ } catch (CoreException e) {
+ org.junit.Assume.assumeNoException(e);
+ }
}
@Test