diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.security.tests/src')
8 files changed, 25 insertions, 24 deletions
diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/SecurityTestsActivator.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/SecurityTestsActivator.java index 8da95071f..5bb315c4b 100644 --- a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/SecurityTestsActivator.java +++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/SecurityTestsActivator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -42,11 +42,13 @@ public class SecurityTestsActivator implements BundleActivator { super(); } + @Override public void start(BundleContext context) throws Exception { bundleContext = context; singleton = this; } + @Override public void stop(BundleContext context) throws Exception { bundleContext = null; singleton = null; diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/DefaultPreferencesTest.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/DefaultPreferencesTest.java index 49107ac89..78b1f9ae8 100644 --- a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/DefaultPreferencesTest.java +++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/DefaultPreferencesTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -18,6 +18,7 @@ package org.eclipse.equinox.internal.security.tests.storage; */ public class DefaultPreferencesTest extends SecurePreferencesTest { + @Override protected String getModuleID() { return null; } diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/HighPriorityModule.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/HighPriorityModule.java index 0e5c9910d..7e61da4c5 100644 --- a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/HighPriorityModule.java +++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/HighPriorityModule.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -24,10 +24,12 @@ public class HighPriorityModule extends PasswordProvider { public final static PBEKeySpec PASSWORD = new PBEKeySpec("HighPriorityPassword".toCharArray()); + @Override public PBEKeySpec getPassword(IPreferencesContainer container, int passwordType) { return PASSWORD; } + @Override public boolean retryOnError(Exception e, IPreferencesContainer container) { return false; } diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/LowPriorityModule.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/LowPriorityModule.java index ea642d933..6a47cd7ef 100644 --- a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/LowPriorityModule.java +++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/LowPriorityModule.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -24,10 +24,12 @@ public class LowPriorityModule extends PasswordProvider { public final static PBEKeySpec PASSWORD = new PBEKeySpec("LowPriorityPassword".toCharArray()); + @Override public PBEKeySpec getPassword(IPreferencesContainer container, int passwordType) { return PASSWORD; } + @Override public boolean retryOnError(Exception e, IPreferencesContainer container) { return false; } diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ManualTest.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ManualTest.java index 31f906183..6cf050c14 100644 --- a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ManualTest.java +++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/ManualTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -101,7 +101,7 @@ public class ManualTest { @Test public void testJavaModule() throws IOException, StorageException { // manual test for the Java module - Map<String, Object> options = new HashMap<String, Object>(1); + Map<String, Object> options = new HashMap<>(1); options.put(IProviderHints.REQUIRED_MODULE_ID, JAVA_MODULE_ID); ISecurePreferences storage = SecurePreferencesFactory.open(null, options); ISecurePreferences node = storage.node("/cvs/account1"); diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/StorageAbstractTest.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/StorageAbstractTest.java index 5a6bcadca..0ec2d8e40 100644 --- a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/StorageAbstractTest.java +++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/StorageAbstractTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -33,7 +33,7 @@ public class StorageAbstractTest { final protected String defaultFileName = "secure_storage_test.equinox"; - private List<ISecurePreferences> openPreferences = new ArrayList<ISecurePreferences>(5); // <ISecurePreferences> + private List<ISecurePreferences> openPreferences = new ArrayList<>(5); // <ISecurePreferences> protected String getModuleID() { return null; @@ -72,7 +72,7 @@ public class StorageAbstractTest { } protected Map<String, Object> getOptions(String defaultPassword) { - Map<String, Object> options = new HashMap<String, Object>(); + Map<String, Object> options = new HashMap<>(); if (defaultPassword != null) { PBEKeySpec password = new PBEKeySpec(defaultPassword.toCharArray()); diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/WaitingRegistryListener.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/WaitingRegistryListener.java index 8760a3946..e64f369a9 100644 --- a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/WaitingRegistryListener.java +++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/WaitingRegistryListener.java @@ -115,9 +115,7 @@ public class WaitingRegistryListener extends org.junit.Assert implements IRegist return callbacks; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IRegistryEventListener#added(org.eclipse.core.runtime.IExtension[]) - */ + @Override synchronized public void added(IExtension[] extensions) { extensionsToString(extensions); added = true; @@ -125,9 +123,7 @@ public class WaitingRegistryListener extends org.junit.Assert implements IRegist notify(); } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IRegistryEventListener#removed(org.eclipse.core.runtime.IExtension[]) - */ + @Override synchronized public void removed(IExtension[] extensions) { extensionsToString(extensions); removed = true; @@ -135,9 +131,7 @@ public class WaitingRegistryListener extends org.junit.Assert implements IRegist notify(); } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IRegistryEventListener#added(org.eclipse.core.runtime.IExtensionPoint[]) - */ + @Override synchronized public void added(IExtensionPoint[] extensionPoints) { extPointsToString(extensionPoints); added = true; @@ -145,9 +139,7 @@ public class WaitingRegistryListener extends org.junit.Assert implements IRegist notify(); } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IRegistryEventListener#removed(org.eclipse.core.runtime.IExtensionPoint[]) - */ + @Override synchronized public void removed(IExtensionPoint[] extensionPoints) { extPointsToString(extensionPoints); removed = true; @@ -156,7 +148,7 @@ public class WaitingRegistryListener extends org.junit.Assert implements IRegist } private void extensionsToString(IExtension[] extensions) { - extensionIDs = new ArrayList<String>(extensions.length); + extensionIDs = new ArrayList<>(extensions.length); for (int i = 0; i < extensions.length; i++) { IExtension extension = extensions[i]; extensionIDs.add(extension.getUniqueIdentifier()); @@ -183,7 +175,7 @@ public class WaitingRegistryListener extends org.junit.Assert implements IRegist } private void extPointsToString(IExtensionPoint[] extensionPoints) { - extPointIDs = new ArrayList<String>(extensionPoints.length); + extPointIDs = new ArrayList<>(extensionPoints.length); for (int i = 0; i < extensionPoints.length; i++) extPointIDs.add(extensionPoints[i].getUniqueIdentifier()); } diff --git a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/WinPreferencesTest.java b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/WinPreferencesTest.java index ad3341c48..8c396f75e 100644 --- a/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/WinPreferencesTest.java +++ b/bundles/org.eclipse.equinox.security.tests/src/org/eclipse/equinox/internal/security/tests/storage/WinPreferencesTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -39,10 +39,12 @@ public class WinPreferencesTest extends SecurePreferencesTest { static private final String WIN_MODULE_ID = "org.eclipse.equinox.security.WindowsPasswordProvider"; //$NON-NLS-1$ static private final String WIN_64BIT_MODULE_ID = "org.eclipse.equinox.security.WindowsPasswordProvider64bit"; //$NON-NLS-1$ + @Override protected String getModuleID() { return is64Bit ? WIN_64BIT_MODULE_ID : WIN_MODULE_ID; } + @Override protected Map<String, Object> getOptions() { // Don't specify default password when testing specific password provider return getOptions(null); |