diff options
author | Alexander Kurtakov | 2017-06-21 16:10:50 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-06-21 20:34:38 +0000 |
commit | eba656968c699f1a9415fad59d2b19e8452f9a0a (patch) | |
tree | b7a6e7742d2c1ff9ee660630a188adb89c3884e8 | |
parent | 7f22c5b775e1e0ce90bbf3055fd99b974d1e7414 (diff) | |
download | rt.equinox.p2-eba656968c699f1a9415fad59d2b19e8452f9a0a.tar.gz rt.equinox.p2-eba656968c699f1a9415fad59d2b19e8452f9a0a.tar.xz rt.equinox.p2-eba656968c699f1a9415fad59d2b19e8452f9a0a.zip |
Bug 518587 - Modernize o.e.equinox.p2.testsI20170621-2000
Move to Java 8, enable more warnings and save actions and go through the
codebase to minimize the warnings.
Change-Id: I6283bfeef18e250f5283e80f7bfad38e6ef65415
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
314 files changed, 2196 insertions, 1642 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/.classpath b/bundles/org.eclipse.equinox.p2.tests/.classpath index 098194ca4..eca7bdba8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/.classpath +++ b/bundles/org.eclipse.equinox.p2.tests/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs index c09baa9d1..6f0be1f3c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs @@ -11,13 +11,17 @@ org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -34,7 +38,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod= org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning @@ -54,7 +58,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore @@ -64,7 +68,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning @@ -72,20 +76,22 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled @@ -100,6 +106,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore @@ -107,6 +116,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedImport=error org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=error @@ -119,7 +129,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 diff --git a/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs index cb66dccdf..04ec8c288 100644 --- a/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs +++ b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,3 @@ -#Thu Oct 30 11:24:56 EDT 2008 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_core @@ -15,23 +14,26 @@ sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=true sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true +sp_cleanup.make_variable_declarations_final=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true @@ -39,12 +41,13 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class= sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false @@ -52,8 +55,10 @@ sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true diff --git a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF index 4426349b9..b61475863 100644 --- a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.tests;singleton:=true -Bundle-Version: 1.6.300.qualifier +Bundle-Version: 1.7.0.qualifier Bundle-ClassPath: . Bundle-Activator: org.eclipse.equinox.p2.tests.TestActivator Bundle-Vendor: %providerName @@ -56,7 +56,7 @@ Require-Bundle: org.eclipse.equinox.frameworkadmin, org.eclipse.equinox.p2.operations;bundle-version="2.1.0", org.eclipse.equinox.p2.ui.sdk.scheduler Eclipse-RegisterBuddy: org.eclipse.equinox.p2.artifact.repository -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Eclipse-BundleShape: dir Bundle-ActivationPolicy: lazy Import-Package: javax.xml.parsers, diff --git a/bundles/org.eclipse.equinox.p2.tests/pom.xml b/bundles/org.eclipse.equinox.p2.tests/pom.xml index ea2ff9b69..fa7a8705e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/pom.xml +++ b/bundles/org.eclipse.equinox.p2.tests/pom.xml @@ -16,7 +16,7 @@ <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.tests</artifactId> - <version>1.6.300-SNAPSHOT</version> + <version>1.7.0-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <properties> diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java index a09154a2f..ce1f277e7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractAntProvisioningTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -40,6 +40,7 @@ public class AbstractAntProvisioningTest extends AbstractProvisioningTest { AntTaskElement root, target; File buildScript, logLocation; + @Override public void setUp() throws Exception { super.setUp(); buildScript = new File(getTestFolder(getName()), "build_" + getName() + ".xml"); @@ -47,6 +48,7 @@ public class AbstractAntProvisioningTest extends AbstractProvisioningTest { createBuildScript(); } + @Override public void tearDown() throws Exception { // Delete the build script delete(buildScript.getParentFile()); @@ -179,7 +181,7 @@ public class AbstractAntProvisioningTest extends AbstractProvisioningTest { * Write an element to the buildscript */ private void writeElement(XMLWriter writer, AntTaskElement task) { - // Properties ought to occur in key-value pairs + // Properties ought to occur in key-value pairs assertTrue("Task " + task + " should have an even number of properties", (task.attributes.size() % 2) == 0); // Start tag @@ -229,6 +231,7 @@ public class AbstractAntProvisioningTest extends AbstractProvisioningTest { elements.add(element); } + @Override public String toString() { return name; } @@ -271,7 +274,7 @@ public class AbstractAntProvisioningTest extends AbstractProvisioningTest { } protected static List getArtifactKeys(IQueryResult<IInstallableUnit> ius) { - List<IArtifactKey> keys = new ArrayList<IArtifactKey>(); + List<IArtifactKey> keys = new ArrayList<>(); for (Iterator<IInstallableUnit> iter = ius.iterator(); iter.hasNext();) keys.addAll(iter.next().getArtifacts()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java index 7e051f8d0..a12fab172 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java @@ -1,11 +1,11 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 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 * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: + * + * Contributors: * IBM Corporation - initial API and implementation * Red Hat Inc. - Bug 460967 ******************************************************************************/ @@ -502,7 +502,7 @@ public abstract class AbstractProvisioningTest extends TestCase { } /** - * Create a basic InstallableUnitFragment with the given attributes. + * Create a basic InstallableUnitFragment with the given attributes. * The self and fragment provided capabilities are added to the IU. */ public static IInstallableUnitFragment createIUFragment(IInstallableUnit host, String name, Version version) { @@ -510,7 +510,7 @@ public abstract class AbstractProvisioningTest extends TestCase { } /** - * Create a basic InstallableUnitFragment with the given attributes. + * Create a basic InstallableUnitFragment with the given attributes. * The self and fragment provided capabilities are added to the IU. */ public static IInstallableUnitFragment createIUFragment(IInstallableUnit host, String name, Version version, IRequirement[] required, ITouchpointType tpType, ITouchpointData tpData) { @@ -848,7 +848,7 @@ public abstract class AbstractProvisioningTest extends TestCase { } /** - * Adds a test metadata repository to the system that provides the given units. + * Adds a test metadata repository to the system that provides the given units. * The repository will automatically be removed in the tearDown method. */ protected IMetadataRepository createTestMetdataRepository(IInstallableUnit[] units) { @@ -954,6 +954,7 @@ public abstract class AbstractProvisioningTest extends TestCase { return testFolder; } + @Override protected void runTest() throws Throwable { super.runTest(); @@ -967,6 +968,7 @@ public abstract class AbstractProvisioningTest extends TestCase { /* (non-Javadoc) * @see junit.framework.TestCase#tearDown() */ + @Override protected void tearDown() throws Exception { super.tearDown(); //remove all metadata repositories created by this test @@ -1033,6 +1035,7 @@ public abstract class AbstractProvisioningTest extends TestCase { fail(iu + " should not be present in this plan."); } + @Override protected void setUp() throws Exception { super.setUp(); IMetadataRepositoryManager repoMan = getMetadataRepositoryManager(); @@ -1245,11 +1248,7 @@ public abstract class AbstractProvisioningTest extends TestCase { * Assumes each array does not contain more than one IU with a given name and version. */ public static void assertEquals(String message, IInstallableUnit[] ius1, IInstallableUnit[] ius2) { - TreeSet set = new TreeSet(new Comparator() { - public int compare(Object o1, Object o2) { - return o1.toString().compareTo(o2.toString()); - } - }); + TreeSet set = new TreeSet((o1, o2) -> o1.toString().compareTo(o2.toString())); set.addAll(Arrays.asList(ius2)); for (int i = 0; i < ius1.length; i++) { @@ -1757,6 +1756,7 @@ public abstract class AbstractProvisioningTest extends TestCase { */ public static final class ProvisioningTestRuleAdapter extends AbstractProvisioningTest implements TestRule { + @Override public Statement apply(final Statement base, Description description) { return new Statement() { @Override diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java index a78b89ba0..a274711e8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -31,165 +31,204 @@ public class AbstractWrappedArtifactRepository implements IArtifactRepository { delegate = repo; } + @Override public void addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) { delegate.addDescriptor(descriptor, monitor); } + @Override @Deprecated public void addDescriptor(IArtifactDescriptor descriptor) { delegate.addDescriptor(descriptor); } + @Override public void addDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) { delegate.addDescriptors(descriptors, monitor); } + @Override @Deprecated public void addDescriptors(IArtifactDescriptor[] descriptors) { delegate.addDescriptors(descriptors); } + @Override public boolean contains(IArtifactDescriptor descriptor) { return delegate.contains(descriptor); } + @Override public boolean contains(IArtifactKey key) { return delegate.contains(key); } + @Override public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { return delegate.getArtifact(descriptor, destination, monitor); } + @Override public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { return delegate.getArtifactDescriptors(key); } + @Override public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) { return delegate.getArtifacts(requests, monitor); } + @Override public OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException { return delegate.getOutputStream(descriptor); } + @Override public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { return delegate.getRawArtifact(descriptor, destination, monitor); } + @Override public void removeAll(IProgressMonitor monitor) { delegate.removeAll(monitor); } + @Override @Deprecated public void removeAll() { delegate.removeAll(); } + @Override public void removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) { delegate.removeDescriptor(descriptor, monitor); } + @Override @Deprecated public void removeDescriptor(IArtifactDescriptor descriptor) { delegate.removeDescriptor(descriptor); } + @Override public void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) { delegate.removeDescriptor(key, monitor); } + @Override @Deprecated public void removeDescriptor(IArtifactKey key) { delegate.removeDescriptor(key); } + @Override public void removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) { delegate.removeDescriptors(descriptors, monitor); } + @Override @Deprecated public void removeDescriptors(IArtifactDescriptor[] descriptors) { delegate.removeDescriptors(descriptors); } + @Override public void removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor) { delegate.removeDescriptors(keys, monitor); } + @Override @Deprecated public void removeDescriptors(IArtifactKey[] keys) { delegate.removeDescriptors(keys); } + @Override public String getDescription() { return delegate.getDescription(); } + @Override public URI getLocation() { return delegate.getLocation(); } + @Override public String getName() { return delegate.getName(); } + @Override public Map getProperties() { return delegate.getProperties(); } + @Override public String getProperty(String key) { return delegate.getProperty(key); } + @Override public String getProvider() { return delegate.getProvider(); } + @Override public IProvisioningAgent getProvisioningAgent() { return delegate.getProvisioningAgent(); } + @Override public String getType() { return delegate.getType(); } + @Override public String getVersion() { return delegate.getVersion(); } + @Override public boolean isModifiable() { return delegate.isModifiable(); } + @Override public String setProperty(String key, String value, IProgressMonitor monitor) { return delegate.setProperty(key, value, monitor); } + @Override public String setProperty(String key, String value) { return delegate.setProperty(key, value); } + @Override public Object getAdapter(Class adapter) { return delegate.getAdapter(adapter); } + @Override public IArtifactDescriptor createArtifactDescriptor(IArtifactKey key) { return delegate.createArtifactDescriptor(key); } + @Override public IArtifactKey createArtifactKey(String classifier, String id, Version version) { return delegate.createArtifactKey(classifier, id, version); } + @Override public IQueryable<IArtifactDescriptor> descriptorQueryable() { return delegate.descriptorQueryable(); } + @Override public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) { return delegate.query(query, monitor); } + @Override public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { return delegate.executeBatch(runnable, monitor); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AdditionalCoreMatchers.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AdditionalCoreMatchers.java index 1bd3c120e..337481924 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AdditionalCoreMatchers.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AdditionalCoreMatchers.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 SAP SE and others. + * Copyright (c) 2015, 2017 SAP SE 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 @@ -17,16 +17,18 @@ public class AdditionalCoreMatchers { /** * Creates a matcher matching any collection with the given size. - * + * * @see CoreMatchers#hasItem(Matcher) */ public static <T> Matcher<Collection<? extends T>> hasSize(final int size) { return new TypeSafeMatcher<Collection<? extends T>>() { + @Override public void describeTo(Description description) { description.appendText("a collection with size " + size); } + @Override protected boolean matchesSafely(Collection<? extends T> item) { return item.size() == size; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/GenerateTestData.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/GenerateTestData.java index 3abe8540d..295cb7ff5 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/GenerateTestData.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/GenerateTestData.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 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 @@ -34,8 +34,8 @@ public class GenerateTestData { static File outputFile = null; static Random random = new Random(System.currentTimeMillis()); - Set<TestFeature> features = new HashSet<TestFeature>(); - List<TestBundle> bundles = new ArrayList<TestBundle>(); + Set<TestFeature> features = new HashSet<>(); + List<TestBundle> bundles = new ArrayList<>(); /* * Abstract class representing a feature or a bundle. @@ -45,8 +45,9 @@ public class GenerateTestData { String id; Version version; // use a set to avoid duplicates - Set<TestObject> requires = new HashSet<TestObject>(); + Set<TestObject> requires = new HashSet<>(); + @Override public boolean equals(Object obj) { if (!(obj instanceof TestBundle)) return false; @@ -54,6 +55,7 @@ public class GenerateTestData { return id.equals(other.id) && version.equals(other.version); } + @Override public int hashCode() { return id.hashCode() + version.hashCode(); } @@ -64,6 +66,7 @@ public class GenerateTestData { static class TestBundle extends TestObject { + @Override String getManifest() { StringBuffer manifest = new StringBuffer(); manifest.append("Manifest-Version: 1.0\n"); @@ -90,6 +93,7 @@ public class GenerateTestData { static class TestFeature extends TestObject { + @Override String getManifest() { StringBuffer buffer = new StringBuffer(); buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/MockQueryable.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/MockQueryable.java index d7ea05170..2ecfc6718 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/MockQueryable.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/MockQueryable.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -35,6 +35,7 @@ public class MockQueryable implements IQueryable { } + @Override public IQueryResult query(IQuery query, IProgressMonitor monitor) { return query.perform(items.iterator()); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestActivator.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestActivator.java index 789d4cc8c..cd5979da1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestActivator.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestActivator.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Red Hat Inc. - Bug 460967 @@ -39,6 +39,7 @@ public class TestActivator implements BundleActivator { return log == null ? null : log.getFile(); } + @Override public void start(BundleContext context) throws Exception { TestActivator.context = context; packageAdminRef = context.getServiceReference(PackageAdmin.class); @@ -49,6 +50,7 @@ public class TestActivator implements BundleActivator { AbstractProvisioningTest.startBundle(getBundle("org.eclipse.equinox.simpleconfigurator.manipulator")); } + @Override public void stop(BundleContext context) throws Exception { TestActivator.context = null; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java index eb81e2c03..d4046d6bc 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -45,18 +45,19 @@ public class TestArtifactRepository extends AbstractArtifactRepository { /** * Map of IArtifactKey -> URI (location) */ - Map<IArtifactKey, URI> keysToLocations = new HashMap<IArtifactKey, URI>(); + Map<IArtifactKey, URI> keysToLocations = new HashMap<>(); /** * Map of URI (location) -> byte[] (contents) */ - Map<URI, byte[]> locationsToContents = new HashMap<URI, byte[]>(); + Map<URI, byte[]> locationsToContents = new HashMap<>(); /** * Set of artifact descriptors */ - Set<IArtifactDescriptor> artifactDescriptors = new HashSet<IArtifactDescriptor>(); + Set<IArtifactDescriptor> artifactDescriptors = new HashSet<>(); Transport testhandler = new Transport() { + @Override public IStatus download(URI toDownload, OutputStream target, IProgressMonitor pm) { byte[] contents = locationsToContents.get(toDownload); if (contents == null) @@ -130,6 +131,7 @@ public class TestArtifactRepository extends AbstractArtifactRepository { return request.getResult(); } + @Override public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, requests.length); try { @@ -147,14 +149,17 @@ public class TestArtifactRepository extends AbstractArtifactRepository { setLocation(repoURL); } + @Override public boolean contains(IArtifactDescriptor descriptor) { return keysToLocations.get(descriptor.getArtifactKey()) != null; } + @Override public boolean contains(IArtifactKey key) { return keysToLocations.get(key) != null; } + @Override public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ProcessingStepHandler handler = new ProcessingStepHandler(); destination = handler.createAndLink(getProvisioningAgent(), descriptor.getProcessingSteps(), null, destination, monitor); @@ -162,36 +167,43 @@ public class TestArtifactRepository extends AbstractArtifactRepository { return Status.OK_STATUS; } + @Override public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { return testhandler.download(keysToLocations.get(descriptor.getArtifactKey()), destination, monitor); } + @Override public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { if (!contains(key)) return null; return new IArtifactDescriptor[] {new ArtifactDescriptor(key)}; } + @Override public void addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) { ((ArtifactDescriptor) descriptor).setRepository(this); artifactDescriptors.add(descriptor); keysToLocations.put(descriptor.getArtifactKey(), null); } + @Override public void removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) { removeDescriptor(descriptor.getArtifactKey(), monitor); } + @Override public void removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) { for (IArtifactDescriptor descriptor : descriptors) removeDescriptor(descriptor, monitor); } + @Override public void removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor) { for (IArtifactKey key : keys) removeDescriptor(key, monitor); } + @Override public void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) { for (IArtifactDescriptor nextDescriptor : artifactDescriptors) { if (key.equals(nextDescriptor.getArtifactKey())) @@ -204,25 +216,30 @@ public class TestArtifactRepository extends AbstractArtifactRepository { } } + @Override public void removeAll(IProgressMonitor monitor) { artifactDescriptors.clear(); keysToLocations.clear(); locationsToContents.clear(); } + @Override public boolean isModifiable() { return true; } + @Override public OutputStream getOutputStream(IArtifactDescriptor descriptor) { throw new UnsupportedOperationException("Method is not implemented by this repository"); } + @Override public IQueryable<IArtifactDescriptor> descriptorQueryable() { // TODO Auto-generated method stub return null; } + @Override public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) { // TODO Auto-generated method stub return null; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java index 4329fe065..2a84d24c1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2010, 2011 IBM Corporation and others. + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -37,10 +37,10 @@ public class TestLicenseConsistency extends AbstractProvisioningTest { IInstallableUnit platformFeature = platform.iterator().next(); ILicense platformLicense = platformFeature.getLicenses(null).iterator().next(); - List<IInstallableUnit> noLicense = new ArrayList<IInstallableUnit>(); - List<IInstallableUnit> extraLicense = new ArrayList<IInstallableUnit>(); - List<IInstallableUnit> goodLicense = new ArrayList<IInstallableUnit>(); - List<IInstallableUnit> badLicense = new ArrayList<IInstallableUnit>(); + List<IInstallableUnit> noLicense = new ArrayList<>(); + List<IInstallableUnit> extraLicense = new ArrayList<>(); + List<IInstallableUnit> goodLicense = new ArrayList<>(); + List<IInstallableUnit> badLicense = new ArrayList<>(); checkLicenses(platformLicense, allFeatures, goodLicense, badLicense, noLicense, extraLicense); printReport(goodLicense, badLicense, noLicense, extraLicense); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java index 54b5a56e0..fded4f4bd 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -36,7 +36,7 @@ public class TestMetadataRepository extends AbstractMetadataRepository { private static final String TYPE = "testmetadatarepo"; //$NON-NLS-1$ private static final String VERSION = "1"; //$NON-NLS-1$ private final List units = new ArrayList(); - protected HashSet<IRepositoryReference> repositories = new HashSet<IRepositoryReference>(); + protected HashSet<IRepositoryReference> repositories = new HashSet<>(); private static URI createLocation() { try { @@ -53,9 +53,6 @@ public class TestMetadataRepository extends AbstractMetadataRepository { units.addAll(Arrays.asList(ius)); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addInstallableUnits(java.util.Collection) - */ @Override public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) { units.addAll(installableUnits); @@ -66,24 +63,24 @@ public class TestMetadataRepository extends AbstractMetadataRepository { return (IInstallableUnit) (result.hasNext() ? result.next() : null); } - public Object getAdapter(Class adapter) { + @Override + public <T> T getAdapter(Class<T> adapter) { if (adapter == TestMetadataRepository.class || adapter == IMetadataRepository.class || adapter == IRepository.class) { - return this; + return (T) this; } return null; } + @Override public IQueryResult query(IQuery query, IProgressMonitor monitor) { return query.perform(units.iterator()); } + @Override public void removeAll() { units.clear(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeInstallableUnits(java.util.Collection) - */ @Override public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) { boolean modified = false; @@ -92,6 +89,7 @@ public class TestMetadataRepository extends AbstractMetadataRepository { return modified; } + @Override public void initialize(RepositoryState state) { setName(state.Name); setType(state.Type); @@ -104,6 +102,7 @@ public class TestMetadataRepository extends AbstractMetadataRepository { this.repositories.addAll(Arrays.asList(state.Repositories)); } + @Override public synchronized void addReferences(Collection<? extends IRepositoryReference> references) { assertModifiable(); repositories.addAll(references); @@ -112,6 +111,7 @@ public class TestMetadataRepository extends AbstractMetadataRepository { /** * Returns a collection of {@link RepositoryReference}. */ + @Override public Collection<IRepositoryReference> getReferences() { return repositories; } @@ -121,6 +121,7 @@ public class TestMetadataRepository extends AbstractMetadataRepository { * it is not. This is suitable for use by subclasses when an attempt is made * to write to a repository. */ + @Override protected void assertModifiable() { } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestRepositoryListener.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestRepositoryListener.java index 169da844c..3b06ca3e3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestRepositoryListener.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestRepositoryListener.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -32,6 +32,7 @@ public class TestRepositoryListener implements SynchronousProvisioningListener { this.repoLocation = location; } + @Override public void notify(EventObject o) { if (!(o instanceof RepositoryEvent)) return; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/CompositeRepositoryTaskTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/CompositeRepositoryTaskTest.java index f7c6b5b1a..a44525970 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/CompositeRepositoryTaskTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/CompositeRepositoryTaskTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * SAP AG - repository atomic loading @@ -33,6 +33,7 @@ public class CompositeRepositoryTaskTest extends AbstractAntProvisioningTest { private URI compositeSite; private URI childSite, childSite2; + @Override public void setUp() throws Exception { super.setUp(); // Get a random location to create a repository @@ -41,6 +42,7 @@ public class CompositeRepositoryTaskTest extends AbstractAntProvisioningTest { childSite2 = new URI("memory:/in/memory"); } + @Override public void tearDown() throws Exception { // Remove repository manager references getArtifactRepositoryManager().removeRepository(compositeSite); @@ -104,7 +106,7 @@ public class CompositeRepositoryTaskTest extends AbstractAntProvisioningTest { } /* - * Test adding a child to an existing metadata repository + * Test adding a child to an existing metadata repository */ public void testAddChildToExistingMetadataRepository() { // Create repository diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java index f70be39ae..49a924f3a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -41,6 +41,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest { private URI destinationRepo; private URI artifactRepo, sliceArtifactRepo, sliceRepo, sourceRepo2, zipRepo; + @Override public void setUp() throws Exception { super.setUp(); // Get a random location to create a repository @@ -52,6 +53,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest { zipRepo = getTestData("error loading data", "/testData/mirror/zippedRepo.zip").toURI(); } + @Override public void tearDown() throws Exception { // Remove repository manager references getArtifactRepositoryManager().removeRepository(destinationRepo); @@ -80,7 +82,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest { } /* - * Test that it is possible to mirror when only specifying a Metadata repository + * Test that it is possible to mirror when only specifying a Metadata repository */ public void testMirrorMetadataOnly() { AntTaskElement mirror = createMirrorTask(TYPE_METADATA); @@ -754,7 +756,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest { // set verbose mirror.addAttribute("verbose", String.valueOf(true)); - // Create a comparator element + // Create a comparator element AntTaskElement comparator = new AntTaskElement("comparator"); comparator.addAttribute("comparator", MD5ArtifactComparator.MD5_COMPARATOR_ID); comparator.addElement(getRepositoryElement(baselineLocation.toURI(), null)); @@ -786,7 +788,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest { } private Map<String, String> getSliceProperties() { - Map<String, String> p = new HashMap<String, String>(); + Map<String, String> p = new HashMap<>(); p.put("osgi.os", "win32"); p.put("osgi.ws", "win32"); p.put("osgi.arch", "x86"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java index b94e5c397..85a1d177d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Red Hat, Inc. - fragments support added. @@ -28,12 +28,14 @@ public class Repo2RunnableTaskTests extends AbstractAntProvisioningTest { private URI destination, source; + @Override public void setUp() throws Exception { source = getTestData("Error loading data", "testData/mirror/mirrorSourceRepo1 with space").toURI(); destination = getTestFolder(getName()).toURI(); super.setUp(); } + @Override public void tearDown() throws Exception { getArtifactRepositoryManager().removeRepository(source); getMetadataRepositoryManager().removeRepository(source); @@ -162,7 +164,7 @@ public class Repo2RunnableTaskTests extends AbstractAntProvisioningTest { } /* - * Create an AntTaskElement for the Repo2Runnabletask populated with the default source & destination + * Create an AntTaskElement for the Repo2Runnabletask populated with the default source & destination */ protected AntTaskElement createRepo2RunnableTaskElement(String type) { AntTaskElement task = createRepo2RunnableTaskElement(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/RepoTasksTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/RepoTasksTests.java index 68f95f9eb..e4cc025d2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/RepoTasksTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/RepoTasksTests.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -26,6 +26,7 @@ public class RepoTasksTests extends AbstractAntProvisioningTest { private URI destinationRepo; private URI sourceRepo; + @Override public void setUp() throws Exception { super.setUp(); // Get a random location to create a repository @@ -33,6 +34,7 @@ public class RepoTasksTests extends AbstractAntProvisioningTest { sourceRepo = getTestData("error loading data", "testData/mirror/mirrorSourceRepo2").toURI(); } + @Override public void tearDown() throws Exception { // Remove repository manager references getArtifactRepositoryManager().removeRepository(destinationRepo); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ArtifactRepositoryMock.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ArtifactRepositoryMock.java index ce63a67fe..447a60a7e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ArtifactRepositoryMock.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/ArtifactRepositoryMock.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 compeople AG and others. + * Copyright (c) 2007, 2017 compeople AG 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 @@ -33,6 +33,7 @@ public class ArtifactRepositoryMock implements InvocationHandler { this.artifactResource = artifactResource; } + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (!method.getName().equals("getArtifact")) throw new RuntimeException("Unexpected usage!"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java index f66e38a34..65781aca0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactLockingTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 EclipseSource and others. + * Copyright (c) 2011, 2017 EclipseSource 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,7 +19,6 @@ import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.metadata.Version; -import org.eclipse.equinox.p2.repository.IRunnableWithProgress; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; @@ -31,6 +30,7 @@ public class ArtifactLockingTest extends AbstractProvisioningTest { private SimpleArtifactRepository repo2 = null; private boolean lockingValue = false; + @Override public void setUp() throws Exception { super.setUp(); lockingValue = Activator.getInstance().enableArtifactLocking(); @@ -56,24 +56,17 @@ public class ArtifactLockingTest extends AbstractProvisioningTest { public void testCancelLoad() throws InterruptedException, ProvisionException { this.canContinue = false; final IProgressMonitor progressMonitor = new NullProgressMonitor(); - new Thread(new Runnable() { - public void run() { - status = repo1.executeBatch(new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) throws OperationCanceledException { - try { - canContinue = true; - Thread.sleep(3 * 1000); - repo1.addDescriptor(new SimpleArtifactDescriptor(new ArtifactKey("org.eclipse.test", "test2", Version.create("1.0.0"))), new NullProgressMonitor()); - progressMonitor.setCanceled(true); - Thread.sleep(1000); - } catch (InterruptedException e) { - // Do nothing - } - } - }, new NullProgressMonitor()); + new Thread(() -> status = repo1.executeBatch(monitor -> { + try { + canContinue = true; + Thread.sleep(3 * 1000); + repo1.addDescriptor(new SimpleArtifactDescriptor(new ArtifactKey("org.eclipse.test", "test2", Version.create("1.0.0"))), new NullProgressMonitor()); + progressMonitor.setCanceled(true); + Thread.sleep(1000); + } catch (InterruptedException e) { + // Do nothing } - }).start(); + }, new NullProgressMonitor())).start(); while (!canContinue) { Thread.sleep(100); @@ -92,23 +85,16 @@ public class ArtifactLockingTest extends AbstractProvisioningTest { public void testWaitForLoad() throws InterruptedException, ProvisionException { this.canContinue = false; - new Thread(new Runnable() { - public void run() { - status = repo1.executeBatch(new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) throws OperationCanceledException { - try { - canContinue = true; - Thread.sleep(6 * 1000); - repo1.addDescriptor(new SimpleArtifactDescriptor(new ArtifactKey("org.eclipse.test", "test2", Version.create("1.0.0"))), new NullProgressMonitor()); - - } catch (InterruptedException e) { - // Do nothing - } - } - }, new NullProgressMonitor()); + new Thread(() -> status = repo1.executeBatch(monitor -> { + try { + canContinue = true; + Thread.sleep(6 * 1000); + repo1.addDescriptor(new SimpleArtifactDescriptor(new ArtifactKey("org.eclipse.test", "test2", Version.create("1.0.0"))), new NullProgressMonitor()); + + } catch (InterruptedException e) { + // Do nothing } - }).start(); + }, new NullProgressMonitor())).start(); while (!canContinue) { Thread.sleep(100); @@ -133,43 +119,33 @@ public class ArtifactLockingTest extends AbstractProvisioningTest { final IProgressMonitor progressMonitor = new NullProgressMonitor(); this.keepRunning = true; - new Thread(new Runnable() { - public void run() { - status = repo1.executeBatch(new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) throws OperationCanceledException { - long start = System.currentTimeMillis(); - while (keepRunning) { - long current = System.currentTimeMillis(); - if (current - start > 1000 * 10) { - fail("Test case never finished. Likely keep running was never set to false."); - return; - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // Do nothing - } - } - } - }, new NullProgressMonitor()); + new Thread(() -> status = repo1.executeBatch(monitor -> { + long start = System.currentTimeMillis(); + while (keepRunning) { + long current = System.currentTimeMillis(); + if (current - start > 1000 * 10) { + fail("Test case never finished. Likely keep running was never set to false."); + return; + } + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // Do nothing + } } - }).start(); + }, new NullProgressMonitor())).start(); // Give the execute batch thread a chance to start Thread.sleep(1000); // Create a thread that will stop our progress monitor - Thread t = new Thread(new Runnable() { - - public void run() { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // Do nothing - } - progressMonitor.setCanceled(true); + Thread t = new Thread(() -> { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // Do nothing } + progressMonitor.setCanceled(true); }); t.start(); @@ -186,43 +162,33 @@ public class ArtifactLockingTest extends AbstractProvisioningTest { final IProgressMonitor progressMonitor = new NullProgressMonitor(); this.keepRunning = true; - new Thread(new Runnable() { - public void run() { - status = repo1.executeBatch(new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) throws OperationCanceledException { - long start = System.currentTimeMillis(); - while (keepRunning) { - long current = System.currentTimeMillis(); - if (current - start > 1000 * 10) { - fail("Test case never finished. Likely keep running was never set to false."); - return; - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // Do nothing - } - } - } - }, new NullProgressMonitor()); + new Thread(() -> status = repo1.executeBatch(monitor -> { + long start = System.currentTimeMillis(); + while (keepRunning) { + long current = System.currentTimeMillis(); + if (current - start > 1000 * 10) { + fail("Test case never finished. Likely keep running was never set to false."); + return; + } + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // Do nothing + } } - }).start(); + }, new NullProgressMonitor())).start(); // Give the execute batch thread a chance to start Thread.sleep(1000); // Create a thread that will stop our progress monitor - Thread t = new Thread(new Runnable() { - - public void run() { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // Do nothing - } - progressMonitor.setCanceled(true); + Thread t = new Thread(() -> { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // Do nothing } + progressMonitor.setCanceled(true); }); t.start(); @@ -241,55 +207,42 @@ public class ArtifactLockingTest extends AbstractProvisioningTest { boolean lockAcquired = false; /** - * This tests that two 'executeBatch' operations are not executed in + * This tests that two 'executeBatch' operations are not executed in * parallel, but rather, the second one waits for the first to complete. * @throws InterruptedException */ public void testMultipleExecuteBatch() throws InterruptedException { this.lockAcquired = false; - Thread t1 = new Thread(new Runnable() { - public void run() { - status1 = repo1.executeBatch(new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) throws OperationCanceledException { - try { - if (lockAcquired) - throw new RuntimeException("Lock already acquired"); - lockAcquired = true; - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // Do nothing - } - } finally { - lockAcquired = false; - } - } - }, new NullProgressMonitor()); + Thread t1 = new Thread(() -> status1 = repo1.executeBatch(monitor -> { + try { + if (lockAcquired) + throw new RuntimeException("Lock already acquired"); + lockAcquired = true; + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // Do nothing + } + } finally { + lockAcquired = false; } - }); + }, new NullProgressMonitor())); t1.start(); - Thread t2 = new Thread(new Runnable() { - public void run() { - status2 = repo2.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws OperationCanceledException { - try { - if (lockAcquired) - throw new RuntimeException("Lock already acquired"); - lockAcquired = true; - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // Do nothing - } - } finally { - lockAcquired = false; - } - } - }, new NullProgressMonitor()); + Thread t2 = new Thread(() -> status2 = repo2.executeBatch(monitor -> { + try { + if (lockAcquired) + throw new RuntimeException("Lock already acquired"); + lockAcquired = true; + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // Do nothing + } + } finally { + lockAcquired = false; } - }); + }, new NullProgressMonitor())); t2.start(); t1.join(); @@ -305,21 +258,14 @@ public class ArtifactLockingTest extends AbstractProvisioningTest { */ public void testWait() throws InterruptedException { - new Thread(new Runnable() { - public void run() { - status = repo1.executeBatch(new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) throws OperationCanceledException { - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - // Do nothing - } - - } - }, new NullProgressMonitor()); + new Thread(() -> status = repo1.executeBatch(monitor -> { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + // Do nothing } - }).start(); + + }, new NullProgressMonitor())).start(); // Give the execute batch thread a chance to start Thread.sleep(1000); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactOutputStreamTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactOutputStreamTest.java index e3281977f..3c2870166 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactOutputStreamTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactOutputStreamTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 compeople AG and others. + * Copyright (c) 2007, 2017 compeople AG 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 @@ -34,6 +34,7 @@ public class ArtifactOutputStreamTest extends AbstractProvisioningTest { private File temp = null; private File tempWritableLocation = null; + @Override protected void setUp() throws Exception { super.setUp(); @@ -52,6 +53,7 @@ public class ArtifactOutputStreamTest extends AbstractProvisioningTest { Destination.baos = null; } + @Override protected void tearDown() throws Exception { AbstractProvisioningTest.delete(temp); AbstractProvisioningTest.delete(tempWritableLocation); @@ -140,6 +142,7 @@ public class ArtifactOutputStreamTest extends AbstractProvisioningTest { static IOException ioe = null; static ByteArrayOutputStream baos = null; + @Override public void close() throws IOException { super.close(); if (ioe != null) { @@ -147,6 +150,7 @@ public class ArtifactOutputStreamTest extends AbstractProvisioningTest { } } + @Override public void write(int b) { if (baos != null) baos.write(b); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java index 34045a785..c2b5c2b8a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Red Hat Inc. - Bug 460967 @@ -62,6 +62,7 @@ public class ArtifactRepositoryManagerTest extends AbstractProvisioningTest { return false; } + @Override protected void setUp() throws Exception { super.setUp(); manager = getArtifactRepositoryManager(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryMissingSizeData.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryMissingSizeData.java index 39bd980b4..ca7d4408a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryMissingSizeData.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryMissingSizeData.java @@ -1,20 +1,19 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.artifact.repository; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.net.URI; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.Phase; import org.eclipse.equinox.internal.p2.engine.PhaseSet; import org.eclipse.equinox.internal.p2.engine.phases.Sizing; @@ -39,6 +38,7 @@ public class ArtifactRepositoryMissingSizeData extends AbstractProvisioningTest ProvisioningContext context; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); IMetadataRepositoryManager mmgr = getMetadataRepositoryManager(); @@ -56,6 +56,7 @@ public class ArtifactRepositoryMissingSizeData extends AbstractProvisioningTest engine = getEngine(); } + @Override protected void tearDown() throws Exception { super.tearDown(); getMetadataRepositoryManager().removeRepository(uri); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryWithReferenceDescriptors.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryWithReferenceDescriptors.java index 100beb673..6df6320f7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryWithReferenceDescriptors.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryWithReferenceDescriptors.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -35,6 +35,7 @@ public class ArtifactRepositoryWithReferenceDescriptors extends AbstractProvisio // </repositoryProperties> // </artifact> + @Override protected void setUp() throws Exception { super.setUp(); repo = createArtifactRepository(getTempFolder().toURI(), null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java index 1f863e802..7073c172a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -47,14 +47,12 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI artifactXML = new URI(repositoryFile.toURI().toString() + "/artifacts.xml"); - IStatus status = repo.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - repo.addDescriptor(createDescriptor("foo", "foo", Version.emptyVersion)); - try { - assertFalse("1.0", fileContainsString(artifactXML, "foo")); - } catch (IOException e) { - fail("0.99"); - } + IStatus status = repo.executeBatch(monitor -> { + repo.addDescriptor(createDescriptor("foo", "foo", Version.emptyVersion)); + try { + assertFalse("1.0", fileContainsString(artifactXML, "foo")); + } catch (IOException e) { + fail("0.99"); } }, new NullProgressMonitor()); assertTrue(status.isOK()); @@ -76,6 +74,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI artifactXML = new URI(repositoryFile.toURI().toString() + "/artifacts.xml"); IStatus status = repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { repo.addDescriptor(createDescriptor("foo", "foo", Version.emptyVersion)); repo.addDescriptor(createDescriptor("bar", "bar", Version.emptyVersion)); @@ -112,6 +111,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI artifactXML = new URI(repositoryFile.toURI().toString() + "/artifacts.xml"); IStatus status = repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { repo.addDescriptor(createDescriptor("foo", "foo", Version.emptyVersion)); repo.addDescriptor(createDescriptor("bar", "bar", Version.emptyVersion)); @@ -139,6 +139,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI artifactXML = new URI(repositoryFile.toURI().toString() + "/artifacts.xml"); IStatus status = repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { IArtifactDescriptor foo = createDescriptor("foo", "foo", Version.emptyVersion); repo.addDescriptor(foo); @@ -167,6 +168,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI artifactXML = new URI(repositoryFile.toURI().toString() + "/artifacts.xml"); IStatus status = repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { repo.addDescriptor(createDescriptor("1", "1", Version.emptyVersion)); repo.addDescriptor(createDescriptor("2", "2", Version.emptyVersion)); @@ -209,6 +211,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); IStatus status = repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { // empty } @@ -231,11 +234,13 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest super(getAgent(), repositoryName, location, properties); } + @Override public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { executeBatch = true; return super.executeBatch(runnable, monitor); } + @Override public void save() { if (executeBatch) throw new RuntimeException("foo"); @@ -254,11 +259,13 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest super(manager, location, repositoryName, properties); } + @Override public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { executeBatch = true; return super.executeBatch(runnable, monitor); } + @Override public void save() { if (executeBatch) throw new RuntimeException("foo"); @@ -266,13 +273,14 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest } /* - * This tests that exceptions are properly propagated for a SimpleArtifactRepository + * This tests that exceptions are properly propagated for a SimpleArtifactRepository */ public void testBatchProcessingExceptionsSimple() { try { SimpleArtifactRepository simpleArtifactRepository = new FailingSimpleArtifactRepository("foo", new URI("http://foo.bar"), null); IStatus status = simpleArtifactRepository.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { throw new RuntimeException("bar"); } @@ -294,6 +302,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest SimpleArtifactRepository simpleArtifactRepository = new FailingSimpleArtifactRepository("foo", new URI("http://foo.bar"), null); IStatus status = simpleArtifactRepository.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { // empty } @@ -318,6 +327,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest monitor.setCanceled(true); IStatus status = repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { if (monitor.isCanceled()) throw new OperationCanceledException(); @@ -339,6 +349,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest IStatus status = compositeArtifactRepository.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { throw new RuntimeException("bar"); } @@ -360,6 +371,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest FailingCompositeArtifactRepository compositeArtifactRepository = new FailingCompositeArtifactRepository(getArtifactRepositoryManager(), "foo", new URI("http://foo.bar"), null); IStatus status = compositeArtifactRepository.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { // empty } @@ -384,11 +396,13 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest super(getAgent(), repositoryName, location, properties); } + @Override public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { executeBatch = true; return super.executeBatch(runnable, monitor); } + @Override public void save() { if (executeBatch) didSave = true; @@ -403,6 +417,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest try { TrackSavignSimpleArtifactRepository simpleArtifactRepository = new TrackSavignSimpleArtifactRepository("foo", new URI("http://foo.bar"), null); simpleArtifactRepository.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { //do nothing; } @@ -421,6 +436,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest try { TrackSavignSimpleArtifactRepository simpleArtifactRepository = new TrackSavignSimpleArtifactRepository("foo", new URI("http://foo.bar"), null); simpleArtifactRepository.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { throw new RuntimeException(); } @@ -442,6 +458,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { throw new RuntimeException(); } @@ -457,7 +474,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest } /* - * This test ensure that the simple artifact repository disables the + * This test ensure that the simple artifact repository disables the * save flag during the batch process */ public void testDisableSaveFlagDuringExecutionSimple() { @@ -467,6 +484,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); final SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { Field field; try { @@ -503,6 +521,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); CompositeArtifactRepository repo = (CompositeArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, properties); repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { throw new RuntimeException(); } @@ -527,6 +546,7 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); final CompositeArtifactRepository repo = (CompositeArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, properties); repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { Field field; try { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java index 0457ce0da..d6d6cd7bd 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug265577.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -32,6 +32,7 @@ public class Bug265577 extends AbstractProvisioningTest { ProvisioningContext context; IEngine engine; + @Override public void setUp() throws Exception { super.setUp(); profile = createProfile(Bug265577.class.getName()); @@ -102,7 +103,7 @@ public class Bug265577 extends AbstractProvisioningTest { assertTrue(status.getMessage(), status.isOK()); } - // Return expected error message for the attempt to retrieve an artifact if it is a folder from inside a jar + // Return expected error message for the attempt to retrieve an artifact if it is a folder from inside a jar private String getJarFolderMessage(IArtifactKey key) { return "Artifact " + key.toString() + " is a folder but the repository is an archive or remote location."; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug351944.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug351944.java index a511fc0d1..aa9e033f9 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug351944.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug351944.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 Wind River and others. + * Copyright (c) 2011, 2017 Wind River 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 - * + * * Contributors: * Wind River - initial API and implementation *******************************************************************************/ @@ -64,7 +64,7 @@ public class Bug351944 extends AbstractProvisioningTest { IQueryResult<IArtifactKey> allArtifactKeys = repo.query(ArtifactKeyQuery.ALL_KEYS, new NullProgressMonitor()); Set<IArtifactKey> keySet = allArtifactKeys.toUnmodifiableSet(); - Collection<IArtifactRequest> requests = new ArrayList<IArtifactRequest>(); + Collection<IArtifactRequest> requests = new ArrayList<>(); for (IArtifactKey key : keySet) requests.add(artifactRepositoryManager.createMirrorRequest(key, repo, null, null)); @@ -90,7 +90,7 @@ public class Bug351944 extends AbstractProvisioningTest { * @return */ private IArtifactRequest[] getRequestsForRepository(IArtifactRepository repository, IArtifactRequest[] requestsToProcess) { - ArrayList<IArtifactRequest> applicable = new ArrayList<IArtifactRequest>(); + ArrayList<IArtifactRequest> applicable = new ArrayList<>(); for (IArtifactRequest request : requestsToProcess) { if (repository.contains(request.getArtifactKey())) applicable.add(request); @@ -100,7 +100,7 @@ public class Bug351944 extends AbstractProvisioningTest { private IArtifactRequest[] getRequestsForRepository2(IArtifactRepository repository, IArtifactRequest[] requestsToProcess) { Set<IArtifactKey> keys = repository.query(ArtifactKeyQuery.ALL_KEYS, new NullProgressMonitor()).toSet(); - ArrayList<IArtifactRequest> applicable = new ArrayList<IArtifactRequest>(); + ArrayList<IArtifactRequest> applicable = new ArrayList<>(); for (IArtifactRequest request : requestsToProcess) { if (keys.contains(request.getArtifactKey())) applicable.add(request); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java index 506408afd..74f9399a8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -49,6 +49,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest { private int childCount = 0; + @Override protected void tearDown() throws Exception { super.tearDown(); //repository location is not used by all tests @@ -1019,7 +1020,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest { } /* - * Test a retry request by a child composite repository + * Test a retry request by a child composite repository */ public void testChildRetryRequest() { class BadMirrorSite extends TestArtifactRepository { @@ -1030,16 +1031,19 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest { addToRepositoryManager(); } + @Override public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream out, IProgressMonitor monitor) { if (++downloadAttempts == 1) return new MultiStatus(Activator.ID, CODE_RETRY, new IStatus[] {new Status(IStatus.ERROR, "Test", "Test - Download interrupted")}, "Retry another mirror", null); return Status.OK_STATUS; } + @Override public boolean contains(IArtifactDescriptor desc) { return true; } + @Override public boolean contains(IArtifactKey desc) { return true; } @@ -1095,16 +1099,19 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest { super(getAgent(), location); } + @Override public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream out, IProgressMonitor monitor) { super.getArtifact(descriptor, out, monitor); return new Status(IStatus.ERROR, "Test", "Test - Download interrupted"); } + @Override public void addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) { super.addDescriptor(descriptor, monitor); super.addArtifact(descriptor.getArtifactKey(), contents); } + @Override public OutputStream getOutputStream(IArtifactDescriptor descriptor) { try { return new FileOutputStream(location); @@ -1364,10 +1371,12 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest { protected IArtifactRepository createChild() { try { TestArtifactRepository repo = new TestArtifactRepository(getAgent(), new URI("memory:/in/memory/" + childCount++)) { + @Override public boolean contains(IArtifactDescriptor desc) { return true; } + @Override public boolean contains(IArtifactKey desc) { return true; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java index 39a355c21..cc030807f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/FoldersRepositoryTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Red Hat Inc. - Bug 460967 @@ -41,11 +41,13 @@ public class FoldersRepositoryTest extends TestCase { super(""); } + @Override protected void setUp() throws Exception { IProvisioningAgent agent = ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class); manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); } + @Override protected void tearDown() throws Exception { manager = null; if (testRepo != null) @@ -67,12 +69,7 @@ public class FoldersRepositoryTest extends TestCase { File sourceFolder = new File(FileLocator.toFileURL(sourceBase).getPath()); AbstractProvisioningTest.copy("0.99", sourceFolder, pluginsFolder); - FileFilter filter = new FileFilter() { - - public boolean accept(File pathname) { - return !pathname.getName().equals("CVS"); - } - }; + FileFilter filter = pathname -> !pathname.getName().equals("CVS"); File[] fileList = pluginsFolder.listFiles(filter); assertEquals(2, fileList.length); for (int i = 0; i < fileList.length; i++) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/JarURLArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/JarURLArtifactRepositoryTest.java index 74b46ce99..76b8e7953 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/JarURLArtifactRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/JarURLArtifactRepositoryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 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 @@ -36,11 +36,13 @@ public class JarURLArtifactRepositoryTest extends TestCase { super(""); } + @Override protected void setUp() throws Exception { IProvisioningAgent agent = ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class); manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); } + @Override protected void tearDown() throws Exception { manager = null; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/LocationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/LocationTest.java index 0ff0cbe6f..cb517677e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/LocationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/LocationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -8,50 +8,52 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.equinox.p2.tests.artifact.repository;
-
-import java.io.File;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest;
-import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
-import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
-import org.eclipse.equinox.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
-import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
-import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
-
-public class LocationTest extends AbstractProvisioningTest {
- private static final String testDataLocation = "testData/artifactRepo/packedSiblingsWithUUID";
- private File targetLocation;
- private IArtifactRepository targetRepository, sourceRepository;
-
- public void setUp() throws Exception {
- super.setUp();
- targetLocation = File.createTempFile("target", ".repo");
- targetLocation.delete();
- targetLocation.mkdirs();
- targetRepository = new SimpleArtifactRepository(getAgent(), "TargetRepo", targetLocation.toURI(), null);
-
- IArtifactRepositoryManager mgr = getArtifactRepositoryManager();
- sourceRepository = mgr.loadRepository((getTestData("EmptyJar repo", testDataLocation).toURI()), null);
-
- }
-
- protected void tearDown() throws Exception {
- getArtifactRepositoryManager().removeRepository(targetLocation.toURI());
- getArtifactRepositoryManager().removeRepository(sourceRepository.getLocation());
- AbstractProvisioningTest.delete(targetLocation);
- super.tearDown();
- }
-
- public void testLocation() throws Exception {
- IArtifactKey key = new ArtifactKey("osgi.bundle", "org.springframework.ide.eclipse", Version.parseVersion("2.3.2.201003220227-RELEASE"));
- assertTrue(sourceRepository.contains(key));
- MirrorRequest req = new MirrorRequest(key, targetRepository, null, null, getTransport());
- req.perform(sourceRepository, new NullProgressMonitor());
- IStatus status = req.getResult();
- assertTrue(status.getMessage(), status.isOK());
- }
-}
+package org.eclipse.equinox.p2.tests.artifact.repository; + +import java.io.File; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest; +import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository; +import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; +import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; +import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; + +public class LocationTest extends AbstractProvisioningTest { + private static final String testDataLocation = "testData/artifactRepo/packedSiblingsWithUUID"; + private File targetLocation; + private IArtifactRepository targetRepository, sourceRepository; + + @Override + public void setUp() throws Exception { + super.setUp(); + targetLocation = File.createTempFile("target", ".repo"); + targetLocation.delete(); + targetLocation.mkdirs(); + targetRepository = new SimpleArtifactRepository(getAgent(), "TargetRepo", targetLocation.toURI(), null); + + IArtifactRepositoryManager mgr = getArtifactRepositoryManager(); + sourceRepository = mgr.loadRepository((getTestData("EmptyJar repo", testDataLocation).toURI()), null); + + } + + @Override + protected void tearDown() throws Exception { + getArtifactRepositoryManager().removeRepository(targetLocation.toURI()); + getArtifactRepositoryManager().removeRepository(sourceRepository.getLocation()); + AbstractProvisioningTest.delete(targetLocation); + super.tearDown(); + } + + public void testLocation() throws Exception { + IArtifactKey key = new ArtifactKey("osgi.bundle", "org.springframework.ide.eclipse", Version.parseVersion("2.3.2.201003220227-RELEASE")); + assertTrue(sourceRepository.contains(key)); + MirrorRequest req = new MirrorRequest(key, targetRepository, null, null, getTransport()); + req.perform(sourceRepository, new NullProgressMonitor()); + IStatus status = req.getResult(); + assertTrue(status.getMessage(), status.isOK()); + } +} diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MD5Tests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MD5Tests.java index 7c09e2854..d4bbedb84 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MD5Tests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MD5Tests.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,6 +27,7 @@ public class MD5Tests extends AbstractProvisioningTest { File testRepo = null; IArtifactRepository repo = null; + @Override protected void setUp() throws Exception { super.setUp(); testRepo = getTestData("Repository with MD5", "testData/artifactRepo/simpleWithMD5"); @@ -62,6 +63,7 @@ public class MD5Tests extends AbstractProvisioningTest { } } + @Override protected void tearDown() throws Exception { getArtifactRepositoryManager().removeRepository(testRepo.toURI()); super.tearDown(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java index 43263df1c..6f7b52424 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -41,6 +41,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { IArtifactRepository targetRepository, sourceRepository; URI destination, failedOptimized, pakedRepositoryLocation; + @Override public void setUp() throws Exception { super.setUp(); targetLocation = File.createTempFile("target", ".repo"); @@ -55,6 +56,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { destination = getTempFolder().toURI(); } + @Override protected void tearDown() throws Exception { getArtifactRepositoryManager().removeRepository(destination); getArtifactRepositoryManager().removeRepository(failedOptimized); @@ -67,7 +69,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { public void testInvalidZipFileInTheSource() { IArtifactKey key = new ArtifactKey("org.eclipse.update.feature", "HelloWorldFeature", Version.createOSGi(1, 0, 0)); - Map<String, String> targetProperties = new HashMap<String, String>(); + Map<String, String> targetProperties = new HashMap<>(); targetProperties.put("artifact.folder", "true"); MirrorRequest request = new MirrorRequest(key, targetRepository, null, targetProperties, (Transport) getAgent().getService(Transport.SERVICE_NAME)); request.perform(sourceRepository, new NullProgressMonitor()); @@ -78,7 +80,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { public void testMissingArtifact() { IArtifactKey key = new ArtifactKey("org.eclipse.update.feature", "Missing", Version.createOSGi(1, 0, 0)); - Map<String, String> targetProperties = new HashMap<String, String>(); + Map<String, String> targetProperties = new HashMap<>(); targetProperties.put("artifact.folder", "true"); MirrorRequest request = new MirrorRequest(key, targetRepository, null, targetProperties, getTransport()); request.perform(sourceRepository, new NullProgressMonitor()); @@ -86,7 +88,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { assertTrue(request.getResult().matches(IStatus.ERROR)); } - // Test that if MirrorRequest fails to download a packed artifact it attempts the canonical version + // Test that if MirrorRequest fails to download a packed artifact it attempts the canonical version public void testFailToCanonical() { RemoteRepo src = new RemoteRepo((SimpleArtifactRepository) sourceRepository); @@ -99,7 +101,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { assertTrue("Number of downloads differs from expected attempts.", src.downloadCount == 2); } - // Test that SimpleArtifactRepository & MirrorRequest use mirrors in the event of a failure. + // Test that SimpleArtifactRepository & MirrorRequest use mirrors in the event of a failure. public void testMirrorFailOver() { OrderedMirrorSelector selector = new OrderedMirrorSelector(sourceRepository); try { @@ -138,7 +140,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { IArtifactKey key = (IArtifactKey) keys.iterator().next(); MirrorRequest req = new MirrorRequest(key, targetRepository, null, null, getTransport()); - // Set Status sequence + // Set Status sequence seq.add(new Status(IStatus.ERROR, "Activator", "Message")); seq.add(new Status(IStatus.WARNING, "Activator", "Message")); req.perform(source, new NullProgressMonitor()); @@ -147,7 +149,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { // Remove key from repo so the same one can be used targetRepository.removeDescriptor(key); - // Set Status sequence + // Set Status sequence req = new MirrorRequest(key, targetRepository, null, null, getTransport()); seq.add(new Status(IStatus.WARNING, "Activator", "Message")); @@ -158,7 +160,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { // Remove key from repo so the same one can be used targetRepository.removeDescriptor(key); - // Set Status sequence + // Set Status sequence req = new MirrorRequest(key, targetRepository, null, null, getTransport()); seq.add(new Status(IStatus.INFO, "Activator", "Message")); @@ -168,12 +170,13 @@ public class MirrorRequestTest extends AbstractProvisioningTest { } /* - * + * */ public void testFailedOptimizedMissingCanonical() { try { IArtifactRepository source = new AbstractWrappedArtifactRepository(getArtifactRepositoryManager().loadRepository(failedOptimized, new NullProgressMonitor())) { + @Override public URI getLocation() { try { return new URI("http://nowhere"); @@ -211,6 +214,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { super(repo); } + @Override public URI getLocation() { // Lie about the location so packed files are used try { @@ -220,6 +224,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { } } + @Override public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { try { destination.write(new byte[] {1, 1, 2}); @@ -260,6 +265,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { delegate = repo; } + @Override public synchronized URI getLocation() { try { return new URI("http://test/"); @@ -270,39 +276,48 @@ public class MirrorRequestTest extends AbstractProvisioningTest { } } + @Override public boolean contains(IArtifactDescriptor descriptor) { return delegate.contains(descriptor); } + @Override public boolean contains(IArtifactKey key) { return delegate.contains(key); } + @Override public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { downloadCount++; return delegate.getArtifact(descriptor, destination, monitor); } + @Override public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { return delegate.getArtifactDescriptors(key); } + @Override public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) { return delegate.getArtifacts(requests, monitor); } + @Override public OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException { return delegate.getOutputStream(descriptor); } + @Override public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { return delegate.getRawArtifact(descriptor, destination, monitor); } + @Override public IQueryable<IArtifactDescriptor> descriptorQueryable() { return delegate.descriptorQueryable(); } + @Override public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) { return delegate.query(query, monitor); } @@ -329,7 +344,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { mirrors = computeMirrors("file:///" + getTestData("Mirror Location", testDataLocation + '/' + repo.getProperties().get(IRepository.PROP_MIRRORS_URL)).toString().replace('\\', '/')); } - // Hijack the source repository's MirrorSelector + // Hijack the source repository's MirrorSelector private void setSelector() { Field mirrorField = null; try { @@ -424,7 +439,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { || mirrorsURL.startsWith("https://") //$NON-NLS-1$ || mirrorsURL.startsWith("file://") //$NON-NLS-1$ || mirrorsURL.startsWith("ftp://") //$NON-NLS-1$ - || mirrorsURL.startsWith("jar://"))) //$NON-NLS-1$ + || mirrorsURL.startsWith("jar://"))) //$NON-NLS-1$ fail("Error processing mirrors URL: " + mirrorsURL, e); //$NON-NLS-1$ return null; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest2.java index b0f6869f4..11698959c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest2.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 WindRiver Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2011, 2017 WindRiver 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 - * + * * Contributors: * WindRiver Corporation - initial API and implementation *******************************************************************************/ @@ -53,6 +53,7 @@ public class MirrorRequestTest2 extends AbstractTestServerClientCase { sourceRepository = (SimpleArtifactRepository) mgr.loadRepository(location, null); } + @Override public void tearDown() throws Exception { IArtifactRepositoryManager mgr = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME); mgr.removeRepository(targetLocation.toURI()); @@ -121,45 +122,54 @@ public class MirrorRequestTest2 extends AbstractTestServerClientCase { @Override public synchronized Map<String, String> getProperties() { - Map<String, String> newProperties = new HashMap<String, String>(super.getProperties()); + Map<String, String> newProperties = new HashMap<>(super.getProperties()); newProperties.put(IRepository.PROP_MIRRORS_URL, getBaseURL() + "/mirrorrequest/mirrors.xml"); newProperties.put(IRepository.PROP_MIRRORS_BASE_URL, getBaseURL() + "/mirrorrequest"); return newProperties; } + @Override public boolean contains(IArtifactDescriptor descriptor) { return delegate.contains(descriptor); } + @Override public boolean contains(IArtifactKey key) { return delegate.contains(key); } + @Override public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { downloadCount++; return delegate.getArtifact(descriptor, destination, monitor); } + @Override public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { return delegate.getArtifactDescriptors(key); } + @Override public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) { return delegate.getArtifacts(requests, monitor); } + @Override public OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException { return delegate.getOutputStream(descriptor); } + @Override public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { return delegate.getRawArtifact(descriptor, destination, monitor); } + @Override public IQueryable<IArtifactDescriptor> descriptorQueryable() { return delegate.descriptorQueryable(); } + @Override public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) { return delegate.query(query, monitor); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorSelectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorSelectorTest.java index 7202b0fc7..37a48d13e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorSelectorTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorSelectorTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * martin.kirst@s1998.tu-chemnitz.de - fixed and improved sort algorithm tests @@ -16,9 +16,6 @@ import junit.framework.TestCase; import org.eclipse.equinox.internal.p2.artifact.repository.MirrorSelector; import org.eclipse.equinox.internal.p2.artifact.repository.MirrorSelector.MirrorInfo; -/** - * - */ public class MirrorSelectorTest extends TestCase { private List<MirrorInfo> originals; @@ -31,7 +28,7 @@ public class MirrorSelectorTest extends TestCase { // This is the expected order of mirrors, // doesn't matter how often you're resorting ;-) - originals = new ArrayList<MirrorSelector.MirrorInfo>(); + originals = new ArrayList<>(); MirrorInfo mi = null; mi = new MirrorInfo("http://ftp.wh2.tu-dresden.de/pub/mirrors/eclipse/", 3); @@ -271,17 +268,17 @@ public class MirrorSelectorTest extends TestCase { // This way we hopefully get sure, that contract of Comparator#compareTo // is fulfilled. for (int x = 0; x < 1000; x++) { - ArrayList<MirrorInfo> templist = new ArrayList<MirrorInfo>(originals); + ArrayList<MirrorInfo> templist = new ArrayList<>(originals); Collections.shuffle(templist); MirrorInfo[] mirrors = templist.toArray(new MirrorInfo[originals.size()]); Arrays.sort(mirrors, comparator); assertList(originals, mirrors); /* * ================================================================ - * - * Because of + * + * Because of * Bug 317785 - Synchronization problem in mirror selection - * + * * We need an implementation of TimSort for this test. * But because of incompatibility of EPL and GPL, the TimSort * algorithm was removed. diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java index b3a24ec35..7d0fbe176 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 compeople AG and others. + * Copyright (c) 2007, 2017 compeople AG 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 @@ -40,6 +40,7 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest { private File repositoryFile = null; private URI repositoryURI = null; + @Override protected void tearDown() throws Exception { super.tearDown(); //repository location is not used by all tests @@ -173,6 +174,7 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest { this.myStatus = status; } + @Override public void close() throws IOException { setStatus(myStatus); super.close(); @@ -213,7 +215,7 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest { status = repo.getRawArtifact(descriptor, okStep, new NullProgressMonitor()); out.close(); - // The first warning step and the error step should be collected + // The first warning step and the error step should be collected assertFalse(status.isOK()); assertTrue("Unexpected Severity", status.matches(IStatus.ERROR)); assertEquals(2, status.getChildren().length); @@ -287,26 +289,32 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest { this.artifactKey = key; } + @Override public IArtifactKey getArtifactKey() { return artifactKey; } + @Override public IProcessingStepDescriptor[] getProcessingSteps() { return steps; } + @Override public Map getProperties() { return properties; } + @Override public String getProperty(String key) { return properties.getProperty(key); } + @Override public IArtifactRepository getRepository() { return null; } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -330,6 +338,7 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest { return true; } + @Override public int hashCode() { String format = getProperty(FORMAT); @@ -384,6 +393,7 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest { long start = System.currentTimeMillis(); repo.executeBatch(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws OperationCanceledException { for (int i = 0; i < 10000; i++) { ArtifactDescriptor d = new ArtifactDescriptor(new ArtifactKey("osgi.bundle", "a" + i, Version.create("1.0.0"))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Adder.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Adder.java index 013a93dc3..b39fa0b18 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Adder.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Adder.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2007, 2010 compeople AG and others. +* Copyright (c) 2007, 2017 compeople AG 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 @@ -33,6 +33,7 @@ public class Adder extends ProcessingStep { this.operand = operand; } + @Override public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) { super.initialize(agent, descriptor, context); try { @@ -44,10 +45,12 @@ public class Adder extends ProcessingStep { } } + @Override public void write(int b) throws IOException { getDestination().write(b + operand); } + @Override public void close() throws IOException { super.close(); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ByteShifter.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ByteShifter.java index 35b040a2d..48f27896e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ByteShifter.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ByteShifter.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2007, 2010 compeople AG and others. +* Copyright (c) 2007, 2017 compeople AG 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 @@ -40,7 +40,7 @@ public class ByteShifter extends ProcessingStep { return; int code; - // if there is a descriptor, decide if the "bad case" is an error or info. If no + // if there is a descriptor, decide if the "bad case" is an error or info. If no // descriptor then default to error. if (descriptor != null) code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO; @@ -52,6 +52,7 @@ public class ByteShifter extends ProcessingStep { setStatus(new Status(code, Activator.ID, "ByteShifter operand invalid: " + operand)); } + @Override public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) { super.initialize(agent, descriptor, context); try { @@ -64,10 +65,12 @@ public class ByteShifter extends ProcessingStep { basicInitialize(descriptor); } + @Override public void write(int b) throws IOException { getDestination().write(b == -1 ? b : b << operand); } + @Override public IStatus getStatus() { return Status.OK_STATUS; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Counter.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Counter.java index 0be982ecc..4314a10ad 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Counter.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Counter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 @@ -40,7 +40,7 @@ public class Counter extends ProcessingStep { return; int code; - // if there is a descriptor, decide if the "bad case" is an error or info. If no + // if there is a descriptor, decide if the "bad case" is an error or info. If no // descriptor then default to error. if (descriptor != null) code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO; @@ -52,6 +52,7 @@ public class Counter extends ProcessingStep { setStatus(new Status(code, Activator.ID, "Counter size not set")); } + @Override public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) { super.initialize(agent, descriptor, context); String data = descriptor.getData(); @@ -72,11 +73,13 @@ public class Counter extends ProcessingStep { basicInitialize(descriptor); } + @Override public void write(int b) throws IOException { total++; getDestination().write(b); } + @Override public void close() throws IOException { super.close(); if (total != size) diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Multiplier.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Multiplier.java index d7dfff306..92f14251c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Multiplier.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/Multiplier.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2007, 2010 compeople AG and others. +* Copyright (c) 2007, 2017 compeople AG 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 @@ -33,6 +33,7 @@ public class Multiplier extends ProcessingStep { this.operand = operand; } + @Override public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) { super.initialize(agent, descriptor, context); try { @@ -44,10 +45,12 @@ public class Multiplier extends ProcessingStep { } } + @Override public void write(int b) throws IOException { getDestination().write(b == -1 ? b : b * operand); } + @Override public void close() throws IOException { super.close(); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java index b7d7aa35b..4489afac3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2007, 2010 compeople AG and others. +* Copyright (c) 2007, 2017 compeople AG 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 @@ -218,11 +218,13 @@ public class ProcessingStepHandlerTest extends AbstractProvisioningTest { public void testPSHgetStatusOK() { ProcessingStep ok1, ok2; ok1 = new ProcessingStep() { + @Override public IStatus getStatus() { return Status.OK_STATUS; } }; ok2 = new ProcessingStep() { + @Override public IStatus getStatus() { return Status.OK_STATUS; } @@ -239,24 +241,28 @@ public class ProcessingStepHandlerTest extends AbstractProvisioningTest { public void testPSHgetStatus() { ProcessingStep ok, info, warning, error; ok = new ProcessingStep() { + @Override public IStatus getStatus() { return Status.OK_STATUS; } }; info = new ProcessingStep() { + @Override public IStatus getStatus() { return new Status(IStatus.INFO, "ID", "INFO"); } }; warning = new ProcessingStep() { + @Override public IStatus getStatus() { return new Status(IStatus.WARNING, "ID", "WARNING"); } }; error = new ProcessingStep() { + @Override public IStatus getStatus() { return new Status(IStatus.ERROR, "ID", "ERROR"); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepTest.java index 15948b184..ba7005f60 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 compeople AG and others. + * Copyright (c) 2007, 2017 compeople AG 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 @@ -23,6 +23,7 @@ public class ProcessingStepTest extends TestCase { private boolean flushed; private boolean closed; + @Override protected void setUp() throws Exception { super.setUp(); ps = new ProcessingStep() {}; @@ -67,9 +68,11 @@ public class ProcessingStepTest extends TestCase { public void testFlush() throws IOException { OutputStream destination = new OutputStream() { + @Override public void write(int b) { } + @Override public void flush() { flushed = true; } @@ -82,9 +85,11 @@ public class ProcessingStepTest extends TestCase { public void testCloseSimpleOutputStreamAsDestination() throws IOException { OutputStream destination = new OutputStream() { + @Override public void write(int b) { } + @Override public void close() { closed = true; } @@ -96,6 +101,7 @@ public class ProcessingStepTest extends TestCase { public void testCloseProcessingStepAsDestination() throws IOException { OutputStream destination = new ProcessingStep() { + @Override public void close() { closed = true; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java index 647ec941a..7a0b61c2a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -9,8 +9,6 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.core; -import org.eclipse.equinox.p2.query.MatchQuery; - import java.util.*; import junit.framework.TestCase; import org.eclipse.equinox.p2.query.*; @@ -18,7 +16,7 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; /** * This tests both Compound and Composite queries - * + * */ public class AggregateQueryTest extends TestCase { @@ -40,6 +38,7 @@ public class AggregateQueryTest extends TestCase { public void testSymmetry() { IQuery getLatest = new ContextQuery() { + @Override public Collector perform(Iterator iterator) { Collector result = new Collector(); List list = new ArrayList(); @@ -54,6 +53,7 @@ public class AggregateQueryTest extends TestCase { IQuery getAllBut3 = new ContextQuery() { + @Override public Collector perform(Iterator iterator) { Collector result = new Collector(); while (iterator.hasNext()) { @@ -90,6 +90,7 @@ public class AggregateQueryTest extends TestCase { public void testNonSymmetry() { IQuery getLatest = new ContextQuery() { + @Override public Collector perform(Iterator iterator) { Collector result = new Collector(); List list = new ArrayList(); @@ -104,6 +105,7 @@ public class AggregateQueryTest extends TestCase { IQuery getAllBut3 = new ContextQuery() { + @Override public Collector perform(Iterator iterator) { Collector result = new Collector(); @@ -129,6 +131,7 @@ public class AggregateQueryTest extends TestCase { public void testIntersection() { IQuery ABC = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (candidate.equals("A") || candidate.equals("B") || candidate.equals("C")) return true; @@ -137,6 +140,7 @@ public class AggregateQueryTest extends TestCase { }; IQuery BCDE = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (candidate.equals("B") || candidate.equals("C") || candidate.equals("D") || candidate.equals("E")) return true; @@ -153,6 +157,7 @@ public class AggregateQueryTest extends TestCase { public void testIntersection2() { IQuery ABC = new ContextQuery() { + @Override public Collector perform(Iterator iterator) { Collector result = new Collector(); while (iterator.hasNext()) { @@ -165,6 +170,7 @@ public class AggregateQueryTest extends TestCase { }; IQuery BCDE = new ContextQuery() { + @Override public Collector perform(Iterator iterator) { Collector result = new Collector(); while (iterator.hasNext()) { @@ -185,6 +191,7 @@ public class AggregateQueryTest extends TestCase { public void testUnion() { IQuery ABC = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (candidate.equals("A") || candidate.equals("B") || candidate.equals("C")) return true; @@ -193,6 +200,7 @@ public class AggregateQueryTest extends TestCase { }; IQuery BCDE = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (candidate.equals("B") || candidate.equals("C") || candidate.equals("D") || candidate.equals("E")) return true; @@ -212,6 +220,7 @@ public class AggregateQueryTest extends TestCase { public void testUnion2() { IQuery ABC = new ContextQuery() { + @Override public Collector perform(Iterator iterator) { Collector result = new Collector(); while (iterator.hasNext()) { @@ -224,6 +233,7 @@ public class AggregateQueryTest extends TestCase { }; IQuery BCDE = new ContextQuery() { + @Override public Collector perform(Iterator iterator) { Collector result = new Collector(); while (iterator.hasNext()) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java index a43211702..00256f36d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2017 Cloudsmith Inc. 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 @@ -39,9 +39,10 @@ public class BackupTest extends AbstractProvisioningTest { * </ul> * </ul> */ + @Override public void setUp() { // create some test files under user.home - // do not want them under /tmp as it may be on its own file system (and even + // do not want them under /tmp as it may be on its own file system (and even // be an in-memory file system). // String userHome = System.getProperty("user.home"); @@ -80,6 +81,7 @@ public class BackupTest extends AbstractProvisioningTest { } } + @Override public void tearDown() { fullyDelete(sourceDir); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java index c54a86c02..3b8c5b112 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java @@ -1,18 +1,16 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * EclipseSource - ongoing development *******************************************************************************/ package org.eclipse.equinox.p2.tests.core; -import org.eclipse.equinox.p2.query.MatchQuery; - import java.util.*; import org.eclipse.equinox.p2.query.*; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; @@ -51,6 +49,7 @@ public class CollectorTest extends AbstractProvisioningTest { List list = Arrays.asList(s); IQuery numeric = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (((String) candidate).compareTo("0") > 0 && ((String) candidate).compareTo("8") < 0) { return true; @@ -60,6 +59,7 @@ public class CollectorTest extends AbstractProvisioningTest { }; IQuery fourOrFiveOrABC = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (((String) candidate).equals("4") || ((String) candidate).equals("5") || ((String) candidate).equals("A") || ((String) candidate).equals("B") || ((String) candidate).equals("C")) { return true; @@ -81,6 +81,7 @@ public class CollectorTest extends AbstractProvisioningTest { List list = Arrays.asList(s); IQuery numeric = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (((String) candidate).compareTo("0") > 0 && ((String) candidate).compareTo("8") < 0) { return true; @@ -90,6 +91,7 @@ public class CollectorTest extends AbstractProvisioningTest { }; IQuery fourOrFiveOrABC = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (((String) candidate).equals("4") || ((String) candidate).equals("5") || ((String) candidate).equals("A") || ((String) candidate).equals("B") || ((String) candidate).equals("C")) { return true; @@ -114,6 +116,7 @@ public class CollectorTest extends AbstractProvisioningTest { List list = Arrays.asList(s); IQuery eightOrNine = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (((String) candidate).compareTo("8") > 0 && ((String) candidate).compareTo("9") < 0) { return true; @@ -123,6 +126,7 @@ public class CollectorTest extends AbstractProvisioningTest { }; IQuery fourOrFiveOrABC = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (((String) candidate).equals("4") || ((String) candidate).equals("5") || ((String) candidate).equals("A") || ((String) candidate).equals("B") || ((String) candidate).equals("C")) { return true; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java index 8bc3de4b1..de898fb31 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -9,8 +9,6 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.core; -import org.eclipse.equinox.p2.query.MatchQuery; - import java.util.Arrays; import java.util.Iterator; import junit.framework.TestCase; @@ -30,11 +28,13 @@ public class CompoundQueryableTest extends TestCase { private int assignedWork = 0; private int amountWorked = 0; + @Override public void beginTask(String name, int totalWork) { super.beginTask(name, totalWork); this.assignedWork += totalWork; } + @Override public void worked(int work) { amountWorked += work; } @@ -47,6 +47,7 @@ public class CompoundQueryableTest extends TestCase { return this.isDone; } + @Override public void done() { super.done(); this.isDone = true; @@ -60,6 +61,7 @@ public class CompoundQueryableTest extends TestCase { IQueryable<Integer> queryable1 = new IQueryable<Integer>() { Integer[] elements = new Integer[] {1, 2, 3, 4, 5}; + @Override public IQueryResult<Integer> query(IQuery<Integer> query, IProgressMonitor monitor) { IQueryResult<Integer> collector; try { @@ -76,6 +78,7 @@ public class CompoundQueryableTest extends TestCase { IQueryable<Integer> queryable2 = new IQueryable<Integer>() { Integer[] elements = new Integer[] {4, 6, 8, 10, 12}; + @Override public IQueryResult<Integer> query(IQuery<Integer> query, IProgressMonitor monitor) { IQueryResult<Integer> collector; try { @@ -92,6 +95,7 @@ public class CompoundQueryableTest extends TestCase { IQueryable queryable3 = new IQueryable() { Integer[] elements = new Integer[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; + @Override public IQueryResult query(IQuery query, IProgressMonitor monitor) { IQueryResult collector; try { @@ -107,6 +111,7 @@ public class CompoundQueryableTest extends TestCase { IQuery matchQuery = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (candidate instanceof Integer) { int x = ((Integer) candidate).intValue(); @@ -118,6 +123,7 @@ public class CompoundQueryableTest extends TestCase { }; IQuery matchMod4query = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (candidate instanceof Integer) { int x = ((Integer) candidate).intValue(); @@ -130,6 +136,7 @@ public class CompoundQueryableTest extends TestCase { IQuery contextQuery = new ContextQuery() { + @Override public Collector perform(Iterator iterator) { Collector result = new Collector(); while (iterator.hasNext()) { @@ -144,6 +151,7 @@ public class CompoundQueryableTest extends TestCase { }; IQuery greatestNumberQuery = new ContextQuery() { + @Override public Collector perform(Iterator iterator) { Collector result = new Collector(); int greatest = Integer.MIN_VALUE; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ContextQuery.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ContextQuery.java index 061b90caf..0e403e28e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ContextQuery.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ContextQuery.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -18,33 +18,35 @@ import org.eclipse.equinox.p2.query.IQueryResult; * ContextQuery is the abstract superclass for Queries that require the entire * input to evaluate the results. Queries must consider the group of elements before * processing the results. <P> - * - * ContextQueries must also be transitive. That is, if run on a subset of the - * input, the order in which they are executed must not matter. If there is the + * + * ContextQueries must also be transitive. That is, if run on a subset of the + * input, the order in which they are executed must not matter. If there is the * need for a non-transitive query, please see: * https://bugs.eclipse.org/bugs/show_bug.cgi?id=261403 * <p> - * Users of this query must call {@link #perform(Iterator)} to compute + * Users of this query must call {@link #perform(Iterator)} to compute * the results. <P> * This class may be subclassed by clients. Subclasses should specify the type * of object they support querying on. Subclasses are also encouraged to clearly * specify their match algorithm, and expose the parameters involved in the match * computation, to allow {@link IQueryable} implementations to optimize their * execution of the query. <P> - * + * * @since 2.0 */ public abstract class ContextQuery<T> implements IQuery<T> { /** - * Evaluates the query for a specific input. - * + * Evaluates the query for a specific input. + * * @param iterator The elements for which to evaluate the query on * @return The results of the query. The collector returned must be * the collector passed in. */ + @Override public abstract IQueryResult<T> perform(Iterator<T> iterator); + @Override public IExpression getExpression() { return null; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java index 6bbbd46cd..357995cf3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/IUListFormatterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 SAP AG and others. + * Copyright (c) 2014, 2017 SAP AG 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 @@ -31,9 +31,9 @@ public class IUListFormatterTest extends TestCase { public void testFormat_MultipleIUs() { IUListFormatter format = new IUListFormatter("${id}=${version},${org.eclipse.equinox.p2.name}"); String result = format.format(asList(// - createIU("iu1", "1.0.0", "name", null),// + createIU("iu1", "1.0.0", "name", null), // createIU("iu2", "2.0.0", "name2", null)// - )); + )); assertEquals("iu1=1.0.0,name" + System.getProperty("line.separator") + "iu2=2.0.0,name2", result); } @@ -51,7 +51,7 @@ public class IUListFormatterTest extends TestCase { public static void main(String[] args) { IUListFormatter format = new IUListFormatter("${id=${version"); - List<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(20000); + List<IInstallableUnit> ius = new ArrayList<>(20000); for (int i = 0; i < 20000; i++) { ius.add(createIU("iu_" + i, "1.0.0", 30)); } @@ -65,7 +65,7 @@ public class IUListFormatterTest extends TestCase { expect(iu.getId()).andStubReturn(id); expect(iu.getVersion()).andStubReturn(Version.create(version)); - final Map<String, String> properties = new HashMap<String, String>(3, 1); + final Map<String, String> properties = new HashMap<>(3, 1); properties.put(IInstallableUnit.PROP_NAME, name); properties.put(IInstallableUnit.PROP_DESCRIPTION, description); expect(iu.getProperties()).andStubReturn(properties); @@ -80,7 +80,7 @@ public class IUListFormatterTest extends TestCase { expect(iu.getId()).andStubReturn(id); expect(iu.getVersion()).andStubReturn(Version.create(version)); - final Map<String, String> properties = new HashMap<String, String>(propCount, 1); + final Map<String, String> properties = new HashMap<>(propCount, 1); for (int i = 0; i < propCount; i++) { properties.put("prop_" + i, "propValue_" + i); } @@ -98,6 +98,7 @@ public class IUListFormatterTest extends TestCase { this.map = map; } + @Override public T answer() throws Throwable { return map.get(getCurrentArguments()[0]); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OracleTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OracleTest.java index 1f3c10eca..89ace3ac1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OracleTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OracleTest.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This + * 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 http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.director; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; @@ -27,6 +26,7 @@ public class OracleTest extends AbstractProvisioningTest { IDirector director; IProfile profile; + @Override protected void setUp() throws Exception { IRequirement[] requires = createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "C", new VersionRange("[1.0.0, 2.0.0)")); a1 = createIU("A", requires, true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OracleTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OracleTest2.java index e15e4de50..877e1aed6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OracleTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/OracleTest2.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This + * 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 http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.director; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; @@ -27,6 +26,7 @@ public class OracleTest2 extends AbstractProvisioningTest { IDirector director; IProfile profile; + @Override protected void setUp() throws Exception { IRequirement[] requires = createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "C", new VersionRange("[1.0.0, 2.0.0)")); a1 = createIU("A", requires, true); @@ -61,14 +61,14 @@ public class OracleTest2 extends AbstractProvisioningTest { /* I'm not sure what this test should look like now * - + public void testInstallA1() { assertEquals(director.install(new IInstallableUnit[] {a1}, profile, null).getSeverity(), IStatus.OK); - + createTestMetdataRepository(new IInstallableUnit[] {a2, c2, b1}); Collection brokenEntryPoint = (Collection) new Oracle().canInstall(new IInstallableUnit[] {b1}, profile, null); // assertNotNull(brokenEntryPoint.getProperty("entryPoint")); - + new Oracle().hasUpdate(a1); System.out.println(new Oracle().canInstall(new IInstallableUnit[] {b1}, (IInstallableUnit[]) brokenEntryPoint.toArray(new IInstallableUnit[brokenEntryPoint.size()]), profile, null)); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/ReplacePlanTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/ReplacePlanTest.java index 82619e362..4b72fb962 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/ReplacePlanTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/ReplacePlanTest.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.director; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -36,6 +35,7 @@ public class ReplacePlanTest extends AbstractProvisioningTest { IPlanner planner; IProfile profile; + @Override protected void setUp() throws Exception { //base IU that others require f1 = createIU("f1", DEFAULT_VERSION, true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java index fd108210f..ca2bd3d1a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/RollbackTest.java @@ -1,20 +1,19 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.director; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.net.URI; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.director.DirectorActivator; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.p2.core.IAgentLocation; import org.eclipse.equinox.p2.core.ProvisionException; @@ -36,6 +35,7 @@ public class RollbackTest extends AbstractProvisioningTest { private IProfile profile; private IDirector director; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", DEFAULT_VERSION, true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/SingletonTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/SingletonTest.java index 50007a251..ea6bfee7c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/SingletonTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/SingletonTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 @@ -10,10 +10,9 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.director; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -33,6 +32,7 @@ public class SingletonTest extends AbstractProvisioningTest { IDirector director; IProfile profile; + @Override protected void setUp() throws Exception { f1 = createIU("f1", Version.createOSGi(1, 0, 0), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/UninstallTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/UninstallTest.java index 991eee880..768de967d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/UninstallTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/UninstallTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 @@ -11,7 +11,6 @@ package org.eclipse.equinox.p2.tests.director; import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -22,6 +21,7 @@ public class UninstallTest extends AbstractProvisioningTest { private IProfile profile; private IDirector director; + @Override protected void setUp() throws Exception { a1 = createIU("A", DEFAULT_VERSION, true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/UpdateTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/UpdateTest.java index e80029af3..61e1f54db 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/UpdateTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/director/UpdateTest.java @@ -1,17 +1,16 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This + * 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 http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.director; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -29,6 +28,7 @@ public class UpdateTest extends AbstractProvisioningTest { IPlanner planner; IProfile profile; + @Override protected void setUp() throws Exception { String f1Id = getName() + "f1"; f1 = createIU(f1Id, DEFAULT_VERSION, true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/AbstractDirectoryWatcherTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/AbstractDirectoryWatcherTest.java index 3ee4d559e..df8c71c70 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/AbstractDirectoryWatcherTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/AbstractDirectoryWatcherTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -29,9 +29,7 @@ public abstract class AbstractDirectoryWatcherTest extends AbstractProvisioningT super(name); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#tearDown() - */ + @Override protected void tearDown() throws Exception { super.tearDown(); for (Iterator iter = toRemove.iterator(); iter.hasNext();) diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/DirectoryWatcherTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/DirectoryWatcherTest.java index f9da12a0a..b5cd016f4 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/DirectoryWatcherTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/DirectoryWatcherTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 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 @@ -65,6 +65,7 @@ public class DirectoryWatcherTest extends AbstractProvisioningTest { final List list = Collections.synchronizedList(new ArrayList()); DirectoryChangeListener listener = new DirectoryChangeListener() { + @Override public boolean added(File file) { if (file.getName().equals("CVS")) return false; @@ -72,10 +73,12 @@ public class DirectoryWatcherTest extends AbstractProvisioningTest { return true; } + @Override public boolean changed(File file) { return false; } + @Override public boolean removed(File file) { if (file.getName().equals("CVS")) return false; @@ -83,18 +86,22 @@ public class DirectoryWatcherTest extends AbstractProvisioningTest { return true; } + @Override public boolean isInterested(File file) { return true; } + @Override public Long getSeenFile(File file) { return null; } + @Override public void startPoll() { } + @Override public void stopPoll() { } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java index 10a903fc5..78a5440b7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -36,7 +36,7 @@ class TestRepositoryWatcher extends DirectoryWatcher { */ public static TestRepositoryWatcher createWatcher(File folder) { RepositoryListener listener = new RepositoryListener(AbstractProvisioningTest.getUniqueString(), null); - Map<String, String> props = new Hashtable<String, String>(); + Map<String, String> props = new Hashtable<>(); props.put(DirectoryWatcher.DIR, folder.getAbsolutePath()); props.put(DirectoryWatcher.POLL, "500"); TestRepositoryWatcher result = new TestRepositoryWatcher(props, TestActivator.getContext()); @@ -51,9 +51,6 @@ class TestRepositoryWatcher extends DirectoryWatcher { super(props, context); } - /* (non-Javadoc) - * @see org.eclipse.equinox.internal.provisional.p2.directorywatcher.DirectoryWatcher#addListener(org.eclipse.equinox.internal.provisional.p2.directorywatcher.DirectoryChangeListener) - */ public synchronized void addListener(RepositoryListener repoListener) { super.addListener(repoListener); this.listener = repoListener; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java index 9b590f96a..f41b2fb1e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/embeddedequinox/EmbeddedEquinox.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 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 @@ -76,6 +76,7 @@ public class EmbeddedEquinox { this.embeddedBundleLoader = parent; } + @Override protected Class findClass(String name) throws ClassNotFoundException { if (name.startsWith("org.osgi.framework.") || name.startsWith("org.osgi.resource.")) // TODO this should call findClass; but then have to use reflection!! @@ -83,6 +84,7 @@ public class EmbeddedEquinox { return super.findClass(name); } + @Override public URL findResource(String name) { if (name.startsWith("org/osgi/framework/") || name.startsWith("org/osgi/resource/")) // TODO this should call findResource; but then have to use reflection!! @@ -90,6 +92,7 @@ public class EmbeddedEquinox { return super.findResource(name); } + @Override public Enumeration findResources(String name) throws IOException { if (name.startsWith("org/osgi/framework/") || name.startsWith("org/osgi/resource/")) // TODO this should call findResources; but then have to use reflection!! diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/CertificateCheckerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/CertificateCheckerTest.java index 24d992b9a..ec4866b73 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/CertificateCheckerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/CertificateCheckerTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -28,14 +28,17 @@ public class CertificateCheckerTest extends AbstractProvisioningTest { public boolean unsignedReturnValue = true; public boolean wasPrompted = false; + @Override public AuthenticationInfo getUsernamePassword(String location) { return null; } + @Override public AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo) { return null; } + @Override public TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail) { wasPrompted = true; return new TrustInfo(null, false, unsignedReturnValue); @@ -48,6 +51,7 @@ public class CertificateCheckerTest extends AbstractProvisioningTest { File unsigned; private ProvisioningAgent testAgent; + @Override protected void setUp() throws Exception { serviceUI = new CertificateTestService(); testAgent = new ProvisioningAgent(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DebugHelperTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DebugHelperTest.java index c6f9133c7..abcc2b71c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DebugHelperTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DebugHelperTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2015 Mykola Nikishov. + * Copyright (c) 2015, 2017 Mykola Nikishov 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 @@ -18,7 +18,7 @@ import org.junit.Assert; public class DebugHelperTest extends TestCase { public void testFormatParametersContainsNullValue() { - HashMap<String, Object> parameters = new HashMap<String, Object>(); + HashMap<String, Object> parameters = new HashMap<>(); parameters.put("key", null); String result = DebugHelper.formatParameters(parameters); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DownloadManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DownloadManagerTest.java index b2da77b33..484c5e809 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DownloadManagerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/DownloadManagerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 @@ -133,14 +133,17 @@ public class DownloadManagerTest extends AbstractProvisioningTest { private IArtifactRequest createArtifactRequest() { IArtifactRequest request = new IArtifactRequest() { + @Override public IArtifactKey getArtifactKey() { return null; } + @Override public void perform(IArtifactRepository sourceRepository, IProgressMonitor monitor) { //do nothing } + @Override public IStatus getResult() { return Status.OK_STATUS; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java index d96fe7a4f..39cd4820c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -26,10 +26,10 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; /** * Simple test of the engine API. - * + * * Note: * Currently you MUST have previously generated metadata from a 3.3.1 install. - * There are ordering dependencies for the tests temporarily + * There are ordering dependencies for the tests temporarily */ public class EngineTest extends AbstractProvisioningTest { @@ -45,26 +45,31 @@ public class EngineTest extends AbstractProvisioningTest { this(name, false); } + @Override protected IStatus completeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) { operandCount--; return super.completeOperand(profile, operand, parameters, monitor); } + @Override protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { phaseCount--; return super.completePhase(monitor, profile, parameters); } + @Override protected IStatus initializeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) { operandCount++; return super.initializeOperand(profile, operand, parameters, monitor); } + @Override protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { phaseCount++; return super.initializePhase(monitor, profile, parameters); } + @Override protected List<ProvisioningAction> getActions(Operand operand) { return null; } @@ -79,11 +84,13 @@ public class EngineTest extends AbstractProvisioningTest { super("NPE"); } + @Override protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { super.completePhase(monitor, profile, parameters); throw new NullPointerException(); } + @Override protected List<ProvisioningAction> getActions(Operand operand) { return null; } @@ -98,13 +105,16 @@ public class EngineTest extends AbstractProvisioningTest { this(false); } + @Override protected List<ProvisioningAction> getActions(Operand operand) { ProvisioningAction action = new ProvisioningAction() { + @Override public IStatus undo(Map parameters) { throw new NullPointerException(); } + @Override public IStatus execute(Map parameters) { throw new NullPointerException(); } @@ -148,6 +158,7 @@ public class EngineTest extends AbstractProvisioningTest { return directory.delete(); } + @Override protected void setUp() throws Exception { engine = getEngine(); testProvisioning = new File(System.getProperty("java.io.tmpdir"), "testProvisioning"); @@ -155,6 +166,7 @@ public class EngineTest extends AbstractProvisioningTest { testProvisioning.mkdir(); } + @Override protected void tearDown() throws Exception { engine = null; deleteDirectory(testProvisioning); @@ -756,40 +768,49 @@ public class EngineTest extends AbstractProvisioningTest { public void testIncompatibleProfile() { IProfile profile = new IProfile() { + @Override public IQueryResult<IInstallableUnit> available(IQuery<IInstallableUnit> query, IProgressMonitor monitor) { - return new Collector<IInstallableUnit>(); + return new Collector<>(); } + @Override public Map getInstallableUnitProperties(IInstallableUnit iu) { return null; } + @Override public String getInstallableUnitProperty(IInstallableUnit iu, String key) { return null; } + @Override public String getProfileId() { return null; } + @Override public Map getProperties() { return null; } + @Override public String getProperty(String key) { return null; } + @Override public IProvisioningAgent getProvisioningAgent() { return getAgent(); } + @Override public long getTimestamp() { return 0; } + @Override public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) { - return new Collector<IInstallableUnit>(); + return new Collector<>(); } }; try { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/InstructionParserTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/InstructionParserTest.java index 00147e924..736b2c7dc 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/InstructionParserTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/InstructionParserTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -32,6 +32,7 @@ public class InstructionParserTest extends AbstractProvisioningTest { return TOUCHPOINT_TYPE; } + @Override public String qualifyAction(String actionId) { return "instructionparsertest." + actionId; } @@ -39,10 +40,12 @@ public class InstructionParserTest extends AbstractProvisioningTest { } public static class TestAction extends ProvisioningAction { + @Override public IStatus execute(Map parameters) { return null; } + @Override public IStatus undo(Map parameters) { return null; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ParameterizedProvisioningActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ParameterizedProvisioningActionTest.java index 1fa318d3e..d8053e762 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ParameterizedProvisioningActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ParameterizedProvisioningActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -23,11 +23,13 @@ public class ParameterizedProvisioningActionTest extends AbstractProvisioningTes String value; ProvisioningAction action = new ProvisioningAction() { + @Override public IStatus execute(Map parameters) { value = (String) parameters.get("test"); return null; } + @Override public IStatus undo(Map parameters) { return null; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseApplicabilityTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseApplicabilityTest.java index 0baec8e8d..ca53f0864 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseApplicabilityTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseApplicabilityTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -35,6 +35,7 @@ public class PhaseApplicabilityTest extends AbstractProvisioningTest { IInstallableUnit iuXv2 = createIU("iuX", Version.create("2.0.0")); Collect collectPhase = new Collect(1) { + @Override protected boolean isApplicable(InstallableUnitOperand op) { return super.isApplicable(op); } @@ -51,6 +52,7 @@ public class PhaseApplicabilityTest extends AbstractProvisioningTest { IInstallableUnit iuXv2 = createIU("iuX", Version.create("2.0.0")); Sizing sizingPhase = new Sizing(1) { + @Override protected boolean isApplicable(InstallableUnitOperand op) { return super.isApplicable(op); } @@ -67,6 +69,7 @@ public class PhaseApplicabilityTest extends AbstractProvisioningTest { IInstallableUnit iuXv2 = createIU("iuX", Version.create("2.0.0")); Unconfigure unconfigurePhase = new Unconfigure(1) { + @Override protected boolean isApplicable(InstallableUnitOperand op) { return super.isApplicable(op); } @@ -83,6 +86,7 @@ public class PhaseApplicabilityTest extends AbstractProvisioningTest { IInstallableUnit iuXv2 = createIU("iuX", Version.create("2.0.0")); Uninstall uninstallPhase = new Uninstall(1) { + @Override protected boolean isApplicable(InstallableUnitOperand op) { return super.isApplicable(op); } @@ -99,6 +103,7 @@ public class PhaseApplicabilityTest extends AbstractProvisioningTest { IInstallableUnit iuXv2 = createIU("iuX", Version.create("2.0.0")); Install installPhase = new Install(1) { + @Override protected boolean isApplicable(InstallableUnitOperand op) { return super.isApplicable(op); } @@ -115,6 +120,7 @@ public class PhaseApplicabilityTest extends AbstractProvisioningTest { IInstallableUnit iuXv2 = createIU("iuX", Version.create("2.0.0")); Configure configurePhase = new Configure(1) { + @Override protected boolean isApplicable(InstallableUnitOperand op) { return super.isApplicable(op); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java index 0117d6c45..9a5898b78 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -110,6 +110,7 @@ public class PhaseSetTest extends AbstractProvisioningTest { URI repoLoc = getTestData("Load test data.", "/testData/pausefeature").toURI(); final PhaseSet phaseSet = (PhaseSet) PhaseSetFactory.createDefaultPhaseSet(); pause = new PauseJob("pause") { + @Override protected IStatus run(IProgressMonitor monitor) { if (!phaseSet.pause()) return new Status(IStatus.ERROR, TestActivator.PI_PROV_TESTS, "pause() failed."); @@ -144,6 +145,7 @@ public class PhaseSetTest extends AbstractProvisioningTest { CountDownLatch latch = new CountDownLatch(1); boolean canStart = false; + @Override public void notify(EventObject o) { if (o instanceof BeginOperationEvent) { canStart = true; @@ -242,6 +244,7 @@ public class PhaseSetTest extends AbstractProvisioningTest { } } pause = new PauseJob("pause") { + @Override protected IStatus run(IProgressMonitor monitor) { if (!phaseSet.pause()) return new Status(IStatus.INFO, TestActivator.PI_PROV_TESTS, "pause() failed."); @@ -268,6 +271,7 @@ public class PhaseSetTest extends AbstractProvisioningTest { class ProvListener implements ProvisioningListener { boolean hasDownloadEvent = false; + @Override public void notify(EventObject o) { if (o instanceof DownloadProgressEvent) hasDownloadEvent = true; @@ -279,6 +283,7 @@ public class PhaseSetTest extends AbstractProvisioningTest { try { pause = new PauseJob("pause") { + @Override protected IStatus run(IProgressMonitor monitor) { while (!listener.hasDownloadEvent) { try { @@ -298,7 +303,7 @@ public class PhaseSetTest extends AbstractProvisioningTest { try { Thread.sleep(2000); } catch (InterruptedException e) { - // + // } setPause(true); return Status.OK_STATUS; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java index 0ccdbe100..aec43669a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -60,28 +60,33 @@ public class PhaseTest extends AbstractProvisioningTest { super(phaseId, weight); } + @Override protected IStatus completeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { completeOperand = true; return super.completeOperand(profile, operand, parameters, monitor); } + @Override protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { parameters.put("TestPhase.initializeOperand", "true"); initializeOperand = true; return super.initializeOperand(profile, operand, parameters, monitor); } + @Override protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { completePhase = true; return super.completePhase(monitor, profile, parameters); } + @Override protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { parameters.put("TestPhase.initializePhase", "true"); initializePhase = true; return super.initializePhase(monitor, profile, parameters); } + @Override protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) { IInstallableUnit unit = operand.second(); List<ProvisioningAction> parsedActions = getActions(unit, phaseId); @@ -111,10 +116,12 @@ public class PhaseTest extends AbstractProvisioningTest { super(""); } + @Override protected void setUp() throws Exception { engine = getEngine(); } + @Override protected void tearDown() throws Exception { super.tearDown(); engine = null; @@ -165,6 +172,7 @@ public class PhaseTest extends AbstractProvisioningTest { public void testInitCompletePhase() { TestPhase phase = new TestPhase() { + @Override protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { assertFalse(parameters.containsKey("TestPhase.initializePhase")); assertFalse(completePhase); @@ -174,6 +182,7 @@ public class PhaseTest extends AbstractProvisioningTest { return null; } + @Override protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { assertTrue(parameters.containsKey("TestPhase.initializePhase")); assertFalse(completePhase); @@ -195,6 +204,7 @@ public class PhaseTest extends AbstractProvisioningTest { public void testInitCompleteOperand() { TestPhase phase = new TestPhase() { + @Override protected IStatus completeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) { assertTrue(parameters.containsKey("TestPhase.initializeOperand")); assertFalse(completeOperand); @@ -204,6 +214,7 @@ public class PhaseTest extends AbstractProvisioningTest { return null; } + @Override protected IStatus initializeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) { assertFalse(parameters.containsKey("TestPhase.initializeOperand")); assertFalse(completeOperand); @@ -226,6 +237,7 @@ public class PhaseTest extends AbstractProvisioningTest { public void testGetProfileDataArea() { TestPhase phase = new TestPhase() { + @Override protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { File profileDataArea = (File) parameters.get("profileDataDirectory"); assertTrue(profileDataArea.isDirectory()); @@ -240,6 +252,7 @@ public class PhaseTest extends AbstractProvisioningTest { return super.initializePhase(monitor, profile, parameters); } + @Override protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { File profileDataArea = (File) parameters.get("profileDataDirectory"); assertTrue(profileDataArea.isDirectory()); @@ -263,10 +276,12 @@ public class PhaseTest extends AbstractProvisioningTest { public static class TestAction extends ProvisioningAction { + @Override public IStatus execute(Map parameters) { return null; } + @Override public IStatus undo(Map parameters) { return null; } @@ -275,6 +290,7 @@ public class PhaseTest extends AbstractProvisioningTest { public void testGetAction() { final ArrayList actionsList1 = new ArrayList(); InstallableUnitPhase phase1 = new InstallableUnitPhase("test", 1) { + @Override protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) { List<ProvisioningAction> actions = getActions(operand.second(), "test1"); actionsList1.addAll(actions); @@ -283,6 +299,7 @@ public class PhaseTest extends AbstractProvisioningTest { }; final ArrayList actionsList2 = new ArrayList(); InstallableUnitPhase phase2 = new InstallableUnitPhase("test", 1) { + @Override protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) { List<ProvisioningAction> actions = getActions(operand.second(), "test2"); actionsList2.addAll(actions); @@ -349,6 +366,7 @@ public class PhaseTest extends AbstractProvisioningTest { class TestListener implements ProvisioningListener { boolean collectEvent = false; + @Override public void notify(EventObject o) { if (o instanceof CollectEvent) collectEvent = true; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfilePreferencesTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfilePreferencesTest.java index da9dfd70c..b1ac67366 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfilePreferencesTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfilePreferencesTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -32,6 +32,7 @@ import org.osgi.service.prefs.Preferences; public class ProfilePreferencesTest extends AbstractProvisioningTest { private IPreferencesService prefServ; + @Override protected void setUp() throws Exception { super.setUp(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java index a28eb7e69..9fb913f22 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileRegistryTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -72,12 +72,14 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { } } + @Override protected void setUp() throws Exception { getServices(); //ensure we start in a clean state registry.removeProfile(PROFILE_NAME); } + @Override protected void tearDown() throws Exception { super.tearDown(); ungetServices(); @@ -107,7 +109,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { public void testPropertyPeristence() throws ProvisionException { assertNull(registry.getProfile(PROFILE_NAME)); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put("test", "test"); Profile profile = (Profile) registry.addProfile(PROFILE_NAME, properties); assertTrue(profile.getProperties().containsKey("test")); @@ -153,7 +155,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { } public void testIUPropertyPeristence() throws ProvisionException { - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put("test", "test"); assertNull(registry.getProfile(PROFILE_NAME)); Profile profile = (Profile) registry.addProfile(PROFILE_NAME); @@ -186,7 +188,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { public void testTimestampedProfiles() throws ProvisionException { assertNull(registry.getProfile(PROFILE_NAME)); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put("test", "test"); Profile profile = (Profile) registry.addProfile(PROFILE_NAME, properties); long oldtimestamp = profile.getTimestamp(); @@ -213,7 +215,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { public void testIsCurrent() throws Exception { assertNull(registry.getProfile(PROFILE_NAME)); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put("test", "test"); Profile profile = (Profile) registry.addProfile(PROFILE_NAME, properties); @@ -300,11 +302,11 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { simpleRgy.lockProfile(simpleProfile); simpleRgy.unlockProfile(simpleProfile); // Create a lock file to confirm locking - + File lockDirectory = new File(getResourceAsBundleRelFile("testData/engineTest/SimpleRegistry/"), SIMPLE_PROFILE + ".profile"); File lockFile = new File(lockDirectory, ".lock"); assertTrue("Lock file does not exist", lockFile.exists()); - + ProfileLock profileLock = new ProfileLock(lockDirectory); boolean locked = profileLock.lock(); try { @@ -341,6 +343,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { simpleRgy.lockProfile(simpleProfile); final Object lock = new Object(); Thread t1 = new Thread() { + @Override public void run() { try { simpleRgy.unlockProfile(simpleProfile); @@ -362,6 +365,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { } } Thread t2 = new Thread() { + @Override public void run() { try { simpleRgy.lockProfile(simpleProfile); @@ -556,12 +560,14 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { } File profileFolder = new File(folder, getName() + ".profile"); File[] filesFound = profileFolder.listFiles(new FileFilter() { + @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".profile"); } }); assertEquals(1, filesFound.length); filesFound = profileFolder.listFiles(new FileFilter() { + @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".profile.gz"); } @@ -606,6 +612,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { } File profileFolder = new File(folder, getName() + ".profile"); profileFolder.listFiles(new FileFilter() { + @Override public boolean accept(File pathname) { if (pathname.getName().endsWith(".profile")) assertEquals("2.0." + currentValue, EngineActivator.PROFILE_FORMAT_UNCOMPRESSED, currentValue); @@ -647,6 +654,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { File profileFolder = new File(folder, getName() + ".profile"); File[] filesFound = profileFolder.listFiles(new FileFilter() { + @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".profile.gz"); } @@ -656,7 +664,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { public void testRemoveProfileTimestamps() throws ProvisionException { assertNull(registry.getProfile(PROFILE_NAME)); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put("test", "test"); Profile profile = (Profile) registry.addProfile(PROFILE_NAME, properties); assertTrue(profile.getProperties().containsKey("test")); @@ -697,7 +705,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { long[] states = registry.listProfileTimestamps(profile.getProfileId()); long goodTimestamp = states[0]; long badTimestamp = goodTimestamp + 1; - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put("foo", "bar"); // Test invalid arguments handled as per contract @@ -786,7 +794,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { assertNull(registry.getProfile(PROFILE_NAME)); Profile profile = (Profile) registry.addProfile(PROFILE_NAME); - Map<String, String> profileProperties = new HashMap<String, String>(); + Map<String, String> profileProperties = new HashMap<>(); profileProperties.put("profileFoo", "profileBar"); profile.addProperties(profileProperties); @@ -796,8 +804,8 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { long[] states = registry.listProfileTimestamps(profile.getProfileId()); assertEquals(2, registry.listProfileTimestamps(profile.getProfileId()).length); - Map<String, String> stateProperties1 = new HashMap<String, String>(); - Map<String, String> stateProperties2 = new HashMap<String, String>(); + Map<String, String> stateProperties1 = new HashMap<>(); + Map<String, String> stateProperties2 = new HashMap<>(); stateProperties1.put("one", "two"); stateProperties1.put("a", "b"); @@ -844,7 +852,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { assertEquals(0, result.size()); // Force the states to be pruned by causing a new state to be written. - Map<String, String> stateProperties3 = new HashMap<String, String>(); + Map<String, String> stateProperties3 = new HashMap<>(); stateProperties3.put("AmIPruned", "yes"); registry.setProfileStateProperties(profile.getProfileId(), states[1], stateProperties3); @@ -868,7 +876,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { assertNull(registry.getProfile(PROFILE_NAME)); Profile profile = (Profile) registry.addProfile(PROFILE_NAME); - Map<String, String> profileProperties = new HashMap<String, String>(); + Map<String, String> profileProperties = new HashMap<>(); profileProperties.put("profileFoo", "profileBar"); profile.addProperties(profileProperties); @@ -877,8 +885,8 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { long[] states = registry.listProfileTimestamps(profile.getProfileId()); - Map<String, String> stateProperties1 = new HashMap<String, String>(); - Map<String, String> stateProperties2 = new HashMap<String, String>(); + Map<String, String> stateProperties1 = new HashMap<>(); + Map<String, String> stateProperties2 = new HashMap<>(); stateProperties1.put("one", "two"); stateProperties1.put("a", "b"); @@ -923,7 +931,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { assertNull(registry.getProfile(getName())); Profile profile = (Profile) registry.addProfile(getName()); - Map<String, String> profileProperties = new HashMap<String, String>(); + Map<String, String> profileProperties = new HashMap<>(); profileProperties.put("profileFoo", "profileBar"); profile.addProperties(profileProperties); @@ -932,8 +940,8 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { long[] states = registry.listProfileTimestamps(profile.getProfileId()); - Map<String, String> stateProperties1 = new HashMap<String, String>(); - Map<String, String> stateProperties2 = new HashMap<String, String>(); + Map<String, String> stateProperties1 = new HashMap<>(); + Map<String, String> stateProperties2 = new HashMap<>(); stateProperties1.put("one", "two"); stateProperties1.put("a", "b"); @@ -991,7 +999,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { assertNull(registry.getProfile(getName())); Profile profile = (Profile) registry.addProfile(getName()); - Map<String, String> profileProperties = new HashMap<String, String>(); + Map<String, String> profileProperties = new HashMap<>(); profileProperties.put("profileFoo", "profileBar"); profile.addProperties(profileProperties); @@ -1000,8 +1008,8 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { long[] states = registry.listProfileTimestamps(profile.getProfileId()); - Map<String, String> stateProperties1 = new HashMap<String, String>(); - Map<String, String> stateProperties2 = new HashMap<String, String>(); + Map<String, String> stateProperties1 = new HashMap<>(); + Map<String, String> stateProperties2 = new HashMap<>(); stateProperties1.put("one", "two"); stateProperties1.put("a", "b"); @@ -1044,7 +1052,7 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { assertNull(registry.getProfile(getName())); Profile profile = (Profile) registry.addProfile(getName()); - Map<String, String> profileProperties = new HashMap<String, String>(); + Map<String, String> profileProperties = new HashMap<>(); profileProperties.put("profileFoo", "profileBar"); profile.addProperties(profileProperties); @@ -1053,8 +1061,8 @@ public class ProfileRegistryTest extends AbstractProvisioningTest { long[] states = registry.listProfileTimestamps(profile.getProfileId()); - Map<String, String> stateProperties1 = new HashMap<String, String>(); - Map<String, String> stateProperties2 = new HashMap<String, String>(); + Map<String, String> stateProperties1 = new HashMap<>(); + Map<String, String> stateProperties2 = new HashMap<>(); stateProperties1.put("one", "two"); stateProperties1.put("a", "b"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java index d7ff11bbc..425fbec3c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -62,7 +62,7 @@ public class ProfileTest extends AbstractProvisioningTest { public void testAddRemoveProperty() throws ProvisionException { IProfileRegistry registry = getProfileRegistry(); assertNull(registry.getProfile(PROFILE_NAME)); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put("test", "test"); Profile profile = (Profile) registry.addProfile(PROFILE_NAME, properties); assertTrue(profile.getProperties().containsKey("test")); @@ -111,7 +111,7 @@ public class ProfileTest extends AbstractProvisioningTest { profile.addInstallableUnit(createIU("test")); assertNull(profile.getInstallableUnitProperty(createIU("test"), "test")); assertNull(profile.removeInstallableUnitProperty(createIU("test"), "test")); - Map<String, String> iuProperties = new HashMap<String, String>(); + Map<String, String> iuProperties = new HashMap<>(); iuProperties.put("test", "test"); profile.addInstallableUnitProperties(createIU("test"), iuProperties); assertEquals("test", profile.getInstallableUnitProperty(createIU("test"), "test")); @@ -130,14 +130,17 @@ public class ProfileTest extends AbstractProvisioningTest { profile.addInstallableUnit(createIU("test")); assertEquals(1, queryResultSize(profile.available(QueryUtil.createIUAnyQuery(), null))); profile.setSurrogateProfileHandler(new ISurrogateProfileHandler() { + @Override public IProfile createProfile(String id) { return null; } + @Override public boolean isSurrogate(IProfile profile) { return false; } + @Override public IQueryResult queryProfile(IProfile profile, IQuery query, IProgressMonitor monitor) { return new Collector(); } @@ -211,6 +214,7 @@ public class ProfileTest extends AbstractProvisioningTest { super(rootName, rootHandler); } + @Override public void processingInstruction(String target, String data) throws SAXException { if (PROFILE_TEST_TARGET.equals(target)) { Version profileTestVersion = extractPIVersion(target, data); @@ -226,9 +230,11 @@ public class ProfileTest extends AbstractProvisioningTest { private ProfilesHandler profilesHandler; IProfile[] profiles; + @Override protected void handleRootAttributes(Attributes attributes) { } + @Override public void startElement(String name, Attributes attributes) { if (PROFILES_ELEMENT.equals(name)) { if (profilesHandler == null) { @@ -241,6 +247,7 @@ public class ProfileTest extends AbstractProvisioningTest { } } + @Override protected void finished() { if (isValidXML()) { if (profilesHandler != null) { @@ -308,6 +315,7 @@ public class ProfileTest extends AbstractProvisioningTest { profileMap.put(profileId, profile); } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(PROFILE_ELEMENT)) { new ProfilesProfileHandler(this, attributes, profileHandlers); @@ -327,6 +335,7 @@ public class ProfileTest extends AbstractProvisioningTest { handleRootAttributes(attributes); } + @Override protected void finished() { if (isValidXML()) { profileHandlers.put(getProfileId(), this); @@ -334,10 +343,12 @@ public class ProfileTest extends AbstractProvisioningTest { } } + @Override protected String getErrorMessage() { return "Error parsing profile string"; } + @Override protected Object getRootObject() { Map result = new HashMap(); for (int i = 0; i < profiles.length; i++) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningContextTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningContextTest.java index f0c242b5a..a85eb2093 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningContextTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningContextTest.java @@ -1,20 +1,19 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Code 9 - ongoing development *******************************************************************************/ package org.eclipse.equinox.p2.tests.engine; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.net.URI; import java.util.Collections; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.engine.ProvisioningContext; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -38,6 +37,7 @@ public class ProvisioningContextTest extends AbstractProvisioningTest { protected IMetadataRepository repoA, repoB, repoC; URI uriA, uriB, uriC; + @Override protected void setUp() throws Exception { super.setUp(); uriA = getTestData("A", testDataFileLocation + "A").toURI(); @@ -59,6 +59,7 @@ public class ProvisioningContextTest extends AbstractProvisioningTest { repoB.addReferences(Collections.singletonList(new RepositoryReference(repoC.getLocation(), null, IRepository.TYPE_METADATA, IRepository.ENABLED))); } + @Override protected void tearDown() throws Exception { getArtifactRepositoryManager().removeRepository(uriA); getArtifactRepositoryManager().removeRepository(uriB); @@ -74,7 +75,7 @@ public class ProvisioningContextTest extends AbstractProvisioningTest { context.setArtifactRepositories(new URI[0]); IQueryable<IInstallableUnit> queryable = context.getMetadata(getMonitor()); assertEquals("Only IUs from A", A_UNITCOUNT, queryable.query(QueryUtil.ALL_UNITS, getMonitor()).toUnmodifiableSet().size()); - IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); + IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); IArtifactRepository[] followed = context.getArtifactRepositories(getMonitor()).query(all, getMonitor()).toArray(IArtifactRepository.class); // The immediate artifact repo reference was followed assertEquals("1 separately located artifact repos", 1, followed.length); @@ -91,7 +92,7 @@ public class ProvisioningContextTest extends AbstractProvisioningTest { assertTrue("should find B", units.length > 0); units = queryable.query(QueryUtil.createIUQuery("C"), getMonitor()).toArray(IInstallableUnit.class); assertTrue("should find C", units.length > 0); - IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); + IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); IArtifactRepository[] followed = context.getArtifactRepositories(getMonitor()).query(all, getMonitor()).toArray(IArtifactRepository.class); // The artifact repo reference was followed assertEquals("3 artifact repos", 3, followed.length); @@ -107,7 +108,7 @@ public class ProvisioningContextTest extends AbstractProvisioningTest { assertTrue("should find B", units.length > 0); units = queryable.query(QueryUtil.createIUQuery("C"), getMonitor()).toArray(IInstallableUnit.class); assertFalse("should not find C", units.length > 0); - IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); + IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); IArtifactRepository[] followed = context.getArtifactRepositories(getMonitor()).query(all, getMonitor()).toArray(IArtifactRepository.class); assertEquals("two artifact repos", 2, followed.length); @@ -124,7 +125,7 @@ public class ProvisioningContextTest extends AbstractProvisioningTest { assertTrue("should find B", units.length > 0); units = queryable.query(QueryUtil.createIUQuery("C"), getMonitor()).toArray(IInstallableUnit.class); assertTrue("should find C", units.length > 0); - IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); + IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); IArtifactRepository[] followed = context.getArtifactRepositories(getMonitor()).query(all, getMonitor()).toArray(IArtifactRepository.class); assertEquals("three artifact repos", 3, followed.length); @@ -140,7 +141,7 @@ public class ProvisioningContextTest extends AbstractProvisioningTest { assertTrue("should find B", units.length > 0); units = queryable.query(QueryUtil.createIUQuery("C"), getMonitor()).toArray(IInstallableUnit.class); assertTrue("should find C", units.length > 0); - IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); + IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); IArtifactRepository[] followed = context.getArtifactRepositories(getMonitor()).query(all, getMonitor()).toArray(IArtifactRepository.class); assertEquals("three artifact repos", 3, followed.length); @@ -157,7 +158,7 @@ public class ProvisioningContextTest extends AbstractProvisioningTest { assertTrue("should find B", units.length > 0); units = queryable.query(QueryUtil.createIUQuery("C"), getMonitor()).toArray(IInstallableUnit.class); assertTrue("should find C", units.length > 0); - IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); + IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); IArtifactRepository[] followed = context.getArtifactRepositories(getMonitor()).query(all, getMonitor()).toArray(IArtifactRepository.class); assertEquals("three artifact repos", 3, followed.length); @@ -168,7 +169,7 @@ public class ProvisioningContextTest extends AbstractProvisioningTest { context.setArtifactRepositories(new URI[0]); context.setMetadataRepositories(new URI[0]); context.getMetadata(getMonitor()); - IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); + IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); IArtifactRepository[] followed = context.getArtifactRepositories(getMonitor()).query(all, getMonitor()).toArray(IArtifactRepository.class); assertEquals("1.1", 0, followed.length); } @@ -179,7 +180,7 @@ public class ProvisioningContextTest extends AbstractProvisioningTest { context.setArtifactRepositories(new URI[0]); context.setMetadataRepositories(new URI[0]); context.getMetadata(getMonitor()); - IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); + IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); IArtifactRepository[] followed = context.getArtifactRepositories(getMonitor()).query(all, getMonitor()).toArray(IArtifactRepository.class); assertEquals("1.1", 0, followed.length); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest.java index 963a5c0cb..7a0b3fb72 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2012 Wind River and others. + * Copyright (c) 2012, 2017 Wind River 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 - * + * * Contributors: * Wind River - initial API and implementation *******************************************************************************/ @@ -44,6 +44,7 @@ public class ProvisioningEventTest extends AbstractProvisioningTest { private IEngine engine; private File testProvisioning; + @Override @Before public void setUp() throws Exception { engine = getEngine(); @@ -52,6 +53,7 @@ public class ProvisioningEventTest extends AbstractProvisioningTest { testProvisioning.mkdir(); } + @Override @After public void tearDown() throws Exception { engine = null; @@ -66,6 +68,7 @@ public class ProvisioningEventTest extends AbstractProvisioningTest { boolean mirrorEevent = false; CountDownLatch latch = new CountDownLatch(1); + @Override public void notify(EventObject o) { if (o instanceof CollectEvent) { if (((CollectEvent) o).getType() == CollectEvent.TYPE_OVERALL_START && ((CollectEvent) o).getRepository() == null) { @@ -115,10 +118,11 @@ public class ProvisioningEventTest extends AbstractProvisioningTest { class ProvTestListener implements ProvisioningListener { String publishUnWantedPhaseEvent = null; int publishUnWantedPhaseType = 0; - List<String> phaseStartEventToBePublised = new ArrayList<String>(Arrays.asList(phaseSets)); - List<String> phaseEndEventToBePublised = new ArrayList<String>(Arrays.asList(phaseSets)); + List<String> phaseStartEventToBePublised = new ArrayList<>(Arrays.asList(phaseSets)); + List<String> phaseEndEventToBePublised = new ArrayList<>(Arrays.asList(phaseSets)); CountDownLatch latch = new CountDownLatch(1); + @Override public void notify(EventObject o) { if (o instanceof PhaseEvent) { PhaseEvent event = (PhaseEvent) o; @@ -170,6 +174,7 @@ public class ProvisioningEventTest extends AbstractProvisioningTest { int postUnConfigureEvent = 0; CountDownLatch latch = new CountDownLatch(2); + @Override public void notify(EventObject o) { if (o instanceof InstallableUnitEvent) { InstallableUnitEvent event = (InstallableUnitEvent) o; @@ -204,8 +209,8 @@ public class ProvisioningEventTest extends AbstractProvisioningTest { args.put("enabled", "true"); new RemoveRepositoryAction().execute(args); - Map<String, ITouchpointInstruction> data = new HashMap<String, ITouchpointInstruction>(); - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, ITouchpointInstruction> data = new HashMap<>(); + Map<String, String> parameters = new HashMap<>(); parameters.put("location", testLocation); parameters.put("type", Integer.toString(IRepository.TYPE_ARTIFACT)); parameters.put("name", "Juno"); @@ -260,6 +265,7 @@ public class ProvisioningEventTest extends AbstractProvisioningTest { int postUnConfigureEventForUndo = 0; CountDownLatch latch = new CountDownLatch(1); + @Override public void notify(EventObject o) { if (o instanceof InstallableUnitEvent) { InstallableUnitEvent event = (InstallableUnitEvent) o; @@ -297,11 +303,11 @@ public class ProvisioningEventTest extends AbstractProvisioningTest { IProfile profile = createProfile("testConfigureEvent"); IProvisioningPlan plan = engine.createPlan(profile, null); - Map<String, ITouchpointInstruction> data = new HashMap<String, ITouchpointInstruction>(); + Map<String, ITouchpointInstruction> data = new HashMap<>(); data.put(PhaseSetFactory.PHASE_CONFIGURE, MetadataFactory.createTouchpointInstruction("instructionparsertest.goodAction()", null)); IInstallableUnit testIU = createResolvedIU(createIU(iuId, Version.create("1.0.0"), null, new IRequirement[0], BUNDLE_CAPABILITY, NO_PROPERTIES, ITouchpointType.NONE, new TouchpointData(data), false)); plan.addInstallableUnit(testIU); - data = new HashMap<String, ITouchpointInstruction>(1); + data = new HashMap<>(1); data.put(PhaseSetFactory.PHASE_CONFIGURE, new TouchpointInstruction("alwaysFail();", null)); plan.addInstallableUnit(createResolvedIU(createEclipseIU(failureIU, Version.create("1.0.0"), new IRequirement[0], new TouchpointData(data)))); IStatus result = engine.perform(plan, PhaseSetFactory.createDefaultPhaseSet(), new NullProgressMonitor()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest2.java index 3e8d6bc98..fc061cd04 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProvisioningEventTest2.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2012 Wind River and others. + * Copyright (c) 2012, 2017 Wind River 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 - * + * * Contributors: * Wind River - initial API and implementation *******************************************************************************/ @@ -44,6 +44,7 @@ public class ProvisioningEventTest2 extends AbstractTestServerClientCase { boolean notifiedDownloadProgressEvent = false; CountDownLatch latch = new CountDownLatch(1); + @Override public void notify(EventObject o) { if (o instanceof DownloadProgressEvent) { notifiedDownloadProgressEvent = true; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/SurrogateProfileHandlerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/SurrogateProfileHandlerTest.java index e546302ca..3aff7348a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/SurrogateProfileHandlerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/SurrogateProfileHandlerTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -51,6 +51,7 @@ public class SurrogateProfileHandlerTest extends AbstractProvisioningTest { registry = null; } + @Override protected void setUp() throws Exception { getServices(); //ensure we start in a clean state @@ -61,6 +62,7 @@ public class SurrogateProfileHandlerTest extends AbstractProvisioningTest { registryField.set(handler, registry); } + @Override protected void tearDown() throws Exception { super.tearDown(); ungetServices(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/TouchpointTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/TouchpointTest.java index a7cd0616b..86eae8e42 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/TouchpointTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/TouchpointTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 @@ -37,21 +37,25 @@ public class TouchpointTest extends AbstractProvisioningTest { testTouchpoint = this; } + @Override public IStatus completeOperand(IProfile profile, Map parameters) { completeOperand++; return super.completeOperand(profile, parameters); } + @Override public IStatus completePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map touchpointParameters) { completePhase++; return super.completePhase(monitor, profile, phaseId, touchpointParameters); } + @Override public IStatus initializeOperand(IProfile profile, Map parameters) { initializeOperand++; return super.initializeOperand(profile, parameters); } + @Override public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map touchpointParameters) { initializePhase++; return super.initializePhase(monitor, profile, phaseId, touchpointParameters); @@ -66,6 +70,7 @@ public class TouchpointTest extends AbstractProvisioningTest { } public static class OperandTestTouchpoint extends TestTouchpoint { + @Override public IStatus completeOperand(IProfile profile, Map parameters) { assertEquals(1, initializeOperand); assertEquals(0, completeOperand); @@ -75,6 +80,7 @@ public class TouchpointTest extends AbstractProvisioningTest { return null; } + @Override public IStatus initializeOperand(IProfile profile, Map parameters) { assertEquals(0, initializeOperand); assertEquals(0, completeOperand); @@ -85,12 +91,14 @@ public class TouchpointTest extends AbstractProvisioningTest { return null; } + @Override public String qualifyAction(String actionId) { return "operandtest." + actionId; } } public static class PhaseTestTouchpoint extends TestTouchpoint { + @Override public IStatus completePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map parameters) { assertEquals(1, initializePhase); assertEquals(0, completePhase); @@ -100,6 +108,7 @@ public class TouchpointTest extends AbstractProvisioningTest { return null; } + @Override public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map parameters) { assertEquals(0, initializePhase); assertEquals(0, completePhase); @@ -110,6 +119,7 @@ public class TouchpointTest extends AbstractProvisioningTest { return null; } + @Override public String qualifyAction(String actionId) { return "phasetest." + actionId; } @@ -125,10 +135,12 @@ public class TouchpointTest extends AbstractProvisioningTest { super(""); } + @Override protected void setUp() throws Exception { engine = getEngine(); } + @Override protected void tearDown() throws Exception { engine = null; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest.java index 9df16a597..69af5a8a7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2012 Landmark Graphics Corporation + * Copyright (c) 2012, 2017 Landmark Graphics Corporation * 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 - * + * * Contributors: * Landmark Graphics Corporation - initial API and implementation *******************************************************************************/ @@ -78,12 +78,12 @@ public class VariableTest extends AbstractProvisioningTest { private static int count = 0; private static final int failAt = 3; - public static ArrayList<String> inputValues = new ArrayList<String>(); - public static ArrayList<String> undoValues = new ArrayList<String>(); + public static ArrayList<String> inputValues = new ArrayList<>(); + public static ArrayList<String> undoValues = new ArrayList<>(); public static void reinitForNextTest() { - inputValues = new ArrayList<String>(); - undoValues = new ArrayList<String>(); + inputValues = new ArrayList<>(); + undoValues = new ArrayList<>(); failMode = false; count = 0; } @@ -108,8 +108,9 @@ public class VariableTest extends AbstractProvisioningTest { return Status.OK_STATUS; } + @Override public Value<String> getResult() { - return new Value<String>(result); + return new Value<>(result); } } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest2.java index 940c174ca..ddf6e0611 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest2.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2013 Landmark Graphics Corporation + * Copyright (c) 2013, 2017 Landmark Graphics Corporation * 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 - * + * * Contributors: * Landmark Graphics Corporation - initial API and implementation *******************************************************************************/ @@ -53,7 +53,7 @@ public class VariableTest2 extends AbstractProvisioningTest { public static class Action extends ProvisioningAction { public static Object result; - public static ArrayList<Object> inputValues = new ArrayList<Object>(); + public static ArrayList<Object> inputValues = new ArrayList<>(); @Override public IStatus execute(Map<String, Object> parameters) { @@ -62,8 +62,9 @@ public class VariableTest2 extends AbstractProvisioningTest { return Status.OK_STATUS; } + @Override public Value<Object> getResult() { - return new Value<Object>(result); + return new Value<>(result); } @Override diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest3.java index a7913c879..a00a3063e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/VariableTest3.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2013 Landmark Graphics Corporation + * Copyright (c) 2013, 2017 Landmark Graphics Corporation * 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 - * + * * Contributors: * Landmark Graphics Corporation - initial API and implementation *******************************************************************************/ @@ -59,8 +59,8 @@ public class VariableTest3 extends AbstractProvisioningTest { public static class Action extends ProvisioningAction { public static Object result; - public static ArrayList<Object> expectedInputValues = new ArrayList<Object>(); - public static ArrayList<Object> expectedReturnValues = new ArrayList<Object>(); + public static ArrayList<Object> expectedInputValues = new ArrayList<>(); + public static ArrayList<Object> expectedReturnValues = new ArrayList<>(); public static int invocationCounter = 0; @Override @@ -71,10 +71,11 @@ public class VariableTest3 extends AbstractProvisioningTest { return Status.OK_STATUS; } + @Override public Value<Object> getResult() { if (Value.NO_VALUE == result) return Value.NO_VALUE; - return new Value<Object>(result); + return new Value<>(result); } @Override diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationArtifactRepositoryFactoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationArtifactRepositoryFactoryTest.java index ae04174de..b8a63831b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationArtifactRepositoryFactoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationArtifactRepositoryFactoryTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -31,11 +31,13 @@ public class ExtensionLocationArtifactRepositoryFactoryTest extends AbstractProv super(name); } + @Override protected void tearDown() throws Exception { delete(tempDirectory); super.tearDown(); } + @Override protected void setUp() throws Exception { super.setUp(); String tempDir = System.getProperty("java.io.tmpdir"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationMetadataRepositoryFactoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationMetadataRepositoryFactoryTest.java index 945b37ca5..23490026d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationMetadataRepositoryFactoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/extensionlocation/ExtensionLocationMetadataRepositoryFactoryTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -30,11 +30,13 @@ public class ExtensionLocationMetadataRepositoryFactoryTest extends AbstractProv super(name); } + @Override protected void tearDown() throws Exception { delete(tempDirectory); super.tearDown(); } + @Override protected void setUp() throws Exception { super.setUp(); String tempDir = System.getProperty("java.io.tmpdir"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java index e2cdc0399..9185a5e97 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/AbstractEnd2EndTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 IBM Corporation and others. + * Copyright (c) 2011, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Red Hat Inc. - Bug 460967 @@ -46,6 +46,7 @@ public abstract class AbstractEnd2EndTest extends AbstractProvisioningTest { private ServiceTracker fwAdminTracker; private IProvisioningAgent end2endAgent = null; + @Override protected void setUp() throws Exception { ServiceReference<IProvisioningAgentProvider> sr = TestActivator.context.getServiceReference(IProvisioningAgentProvider.class); IProvisioningAgentProvider agentFactory = TestActivator.context.getService(sr); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest35.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest35.java index af7a3e425..ff9a71913 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest35.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest35.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -22,6 +22,7 @@ import org.eclipse.equinox.p2.metadata.VersionedId; */ public class End2EndTest35 extends AbstractEnd2EndTest { + @Override protected void validateInstallContent(File installFolder) { FrameworkAdmin fwkAdmin = getEquinoxFrameworkAdmin(); Manipulator manipulator = fwkAdmin.getManipulator(); @@ -53,14 +54,17 @@ public class End2EndTest35 extends AbstractEnd2EndTest { } + @Override protected URI getRepositoryLocation() { return URI.create("http://download.eclipse.org/eclipse/updates/3.5"); } + @Override protected VersionedId getPlatform() { return new VersionedId("org.eclipse.platform.ide", "3.5.0.I20090611-1540"); } + @Override protected VersionedId getPlatformSource() { return new VersionedId("org.eclipse.platform.source.feature.group", "3.5.0.v20090611a-9gEeG1HFtQcmRThO4O3aR_fqSMvJR2sJ"); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest36.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest36.java index f65ab416b..6bf2152ed 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest36.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest36.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -22,6 +22,7 @@ import org.eclipse.equinox.p2.metadata.VersionedId; */ public class End2EndTest36 extends AbstractEnd2EndTest { + @Override protected void validateInstallContent(File installFolder) { FrameworkAdmin fwkAdmin = getEquinoxFrameworkAdmin(); Manipulator manipulator = fwkAdmin.getManipulator(); @@ -53,14 +54,17 @@ public class End2EndTest36 extends AbstractEnd2EndTest { } + @Override protected URI getRepositoryLocation() { return URI.create("http://download.eclipse.org/eclipse/updates/3.6"); } + @Override protected VersionedId getPlatform() { return new VersionedId("org.eclipse.platform.ide", "3.6.2.M20110210-1200"); } + @Override protected VersionedId getPlatformSource() { return new VersionedId("org.eclipse.platform.source.feature.group", "3.6.2.r362_v20110210-9gF78Gs1FrIGnHDHWkEcopoN8AmxeZflGDGKQi"); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest37.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest37.java index b28ad2c4d..e259dd941 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest37.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTest37.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -22,6 +22,7 @@ import org.eclipse.equinox.p2.metadata.VersionedId; */ public class End2EndTest37 extends AbstractEnd2EndTest { + @Override protected void validateInstallContent(File installFolder) { FrameworkAdmin fwkAdmin = getEquinoxFrameworkAdmin(); Manipulator manipulator = fwkAdmin.getManipulator(); @@ -53,14 +54,17 @@ public class End2EndTest37 extends AbstractEnd2EndTest { } + @Override protected URI getRepositoryLocation() { return URI.create("http://download.eclipse.org/eclipse/updates/3.7"); } + @Override protected VersionedId getPlatform() { return new VersionedId("org.eclipse.platform.ide", "3.7.0.I20110613-1736"); } + @Override protected VersionedId getPlatformSource() { return new VersionedId("org.eclipse.platform.source.feature.group", "3.7.0.v20110530-9gF7UHNFFt4cwE-pkZDJ7oz-mj4OSEIlu9SEv0f"); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTestCurrent.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTestCurrent.java index dea0dc4ce..bd94b405f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTestCurrent.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/full/End2EndTestCurrent.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -31,6 +31,7 @@ public class End2EndTestCurrent extends AbstractEnd2EndTest { URI repositoryLocation; VersionedId platform, platformSource; + @Override protected void validateInstallContent(File installFolder) { FrameworkAdmin fwkAdmin = getEquinoxFrameworkAdmin(); Manipulator manipulator = fwkAdmin.getManipulator(); @@ -62,6 +63,7 @@ public class End2EndTestCurrent extends AbstractEnd2EndTest { } + @Override protected URI getRepositoryLocation() { if (repositoryLocation == null) { String repository = TestActivator.getContext().getProperty("org.eclipse.equinox.p2.tests.current.build.repo"); @@ -87,6 +89,7 @@ public class End2EndTestCurrent extends AbstractEnd2EndTest { return (IInstallableUnit) result.iterator().next(); } + @Override protected VersionedId getPlatform() { if (platform == null) { IInstallableUnit iu = getIU("org.eclipse.platform.ide"); @@ -95,6 +98,7 @@ public class End2EndTestCurrent extends AbstractEnd2EndTest { return platform; } + @Override protected VersionedId getPlatformSource() { if (platformSource == null) { IInstallableUnit iu = getIU("org.eclipse.platform.source.feature.group"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java index 3e59bc018..d9d3b5553 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java @@ -1,17 +1,15 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.generator; -import org.osgi.framework.Bundle; - import java.io.File; import java.io.PrintStream; import java.util.Map; @@ -28,11 +26,13 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.tests.*; import org.eclipse.osgi.util.NLS; +import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; public class GeneratorTests extends AbstractProvisioningTest { protected class TestGeneratorApplication extends GeneratorApplication { + @Override protected Object launchApplication(Map<String, Object> applicationMap) { try { String appId = (String) applicationMap.get(APP_ID); @@ -79,7 +79,7 @@ public class GeneratorTests extends AbstractProvisioningTest { //this also covers 220494 File rootFolder = getTestFolder("artifactsDeleted"); - //copy some bundles over + //copy some bundles over File plugins = new File(rootFolder, "plugins"); plugins.mkdir(); @@ -94,7 +94,7 @@ public class GeneratorTests extends AbstractProvisioningTest { continue; } // tycho surefire uses rather "-" instead of "_" (maven convention). PDE uses "_". We need to be P2 compatible. - copy("1.0 Populating input bundles.", bundleFile, new File(plugins, bundle.getSymbolicName() + "_" + bundle.getVersion() + ".jar" )); + copy("1.0 Populating input bundles.", bundleFile, new File(plugins, bundle.getSymbolicName() + "_" + bundle.getVersion() + ".jar")); } String[] arguments = new String[] {"-metadataRepository", rootFolder.toURL().toExternalForm().toString(), "-artifactRepository", rootFolder.toURL().toExternalForm().toString(), "-source", rootFolder.getAbsolutePath(), "-publishArtifacts", "-noDefaultIUs"}; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/jarprocessor/JarProcessorTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/jarprocessor/JarProcessorTests.java index 9de605067..ea046c13a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/jarprocessor/JarProcessorTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/jarprocessor/JarProcessorTests.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -16,7 +16,8 @@ import org.eclipse.equinox.internal.p2.jarprocessor.PackStep; import org.eclipse.equinox.internal.p2.jarprocessor.verifier.Verifier; import org.eclipse.equinox.internal.p2.jarprocessor.verifier.VerifyStep; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; -import org.eclipse.internal.provisional.equinox.p2.jarprocessor.*; +import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessor; +import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExecutor; import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExecutor.Options; public class JarProcessorTests extends AbstractProvisioningTest { @@ -25,7 +26,7 @@ public class JarProcessorTests extends AbstractProvisioningTest { if (!VerifyStep.canVerify()) return; - // run verify on + // run verify on File workingDir = getTestFolder("testVerifyStep"); Verifier verifier = new Verifier() { @@ -40,15 +41,12 @@ public class JarProcessorTests extends AbstractProvisioningTest { JarProcessor processor = new JarProcessor(); processor.setWorkingDirectory(workingDirectory.getAbsolutePath()); - FileFilter filter = new FileFilter() { - public boolean accept(File pathname) { - String name = pathname.getName(); - if (pathname.isFile() && name.endsWith(".jar")) - if ((name.indexOf("source") == -1) && name.startsWith("org.eclipse.equinox.p2")) - return true; - return false; - } - + FileFilter filter = pathname -> { + String name = pathname.getName(); + if (pathname.isFile() && name.endsWith(".jar")) + if ((name.indexOf("source") == -1) && name.startsWith("org.eclipse.equinox.p2")) + return true; + return false; }; for (int i = 0; i < input.length; i++) { File inputFile = new File(input[i]); @@ -90,15 +88,13 @@ public class JarProcessorTests extends AbstractProvisioningTest { String install = Platform.getInstallLocation().getURL().getPath(); File plugins = new File(install, "plugins"); - File[] files = plugins.listFiles(new FileFilter() { - public boolean accept(File pathname) { - String name = pathname.getName(); - if (pathname.isFile() && name.endsWith(".jar") && name.indexOf(".source") == -1) { - if (name.startsWith("org.eclipse.core.c") || name.startsWith("org.eclipse.core.r")) - return true; - } - return false; + File[] files = plugins.listFiles((FileFilter) pathname -> { + String name = pathname.getName(); + if (pathname.isFile() && name.endsWith(".jar") && name.indexOf(".source") == -1) { + if (name.startsWith("org.eclipse.core.c") || name.startsWith("org.eclipse.core.r")) + return true; } + return false; }); input.mkdirs(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java index 34a0277f7..81055139a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/FragmentMethodTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,6 +27,7 @@ public class FragmentMethodTest extends TestCase { Collection<IProvidedCapability> iu1Caps; Collection<IProvidedCapability> iu3Caps; + @Override protected void setUp() throws Exception { super.setUp(); iu1 = createIU("iu.test1"); @@ -46,6 +47,7 @@ public class FragmentMethodTest extends TestCase { } } + @Override protected void tearDown() throws Exception { iu1 = null; iu3 = null; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java index aafb748b3..cbf48b80f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPatchPersistenceTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -123,7 +123,7 @@ public class IUPatchPersistenceTest extends AbstractProvisioningTest { class IUStringWriter extends MetadataWriter { - public IUStringWriter(ByteArrayOutputStream stream) throws IOException { + public IUStringWriter(ByteArrayOutputStream stream) { super(stream, new ProcessingInstruction[] {ProcessingInstruction.makeTargetVersionInstruction(IU_TEST_TARGET, IU_TEST_VERSION)}); } @@ -166,6 +166,7 @@ public class IUPatchPersistenceTest extends AbstractProvisioningTest { super(rootName, rootHandler); } + @Override public void processingInstruction(String target, String data) throws SAXException { if (IU_TEST_TARGET.equals(target)) { Version iuTestVersion = extractPIVersion(target, data); @@ -191,10 +192,12 @@ public class IUPatchPersistenceTest extends AbstractProvisioningTest { return iu; } + @Override protected void handleRootAttributes(Attributes attributes) { parseAttributes(attributes, noAttributes, noAttributes); } + @Override public void startElement(String name, Attributes attributes) { if (INSTALLABLE_UNIT_ELEMENT.equals(name)) { if (iuHandler == null) { @@ -207,6 +210,7 @@ public class IUPatchPersistenceTest extends AbstractProvisioningTest { } } + @Override protected void finished() { if (isValidXML()) { if (iuHandler != null && singleton.size() == 1) { @@ -216,10 +220,12 @@ public class IUPatchPersistenceTest extends AbstractProvisioningTest { } } + @Override protected String getErrorMessage() { return "Error parsing installable unit string"; } + @Override protected Object getRootObject() { return theIU; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java index 3be906192..e9bb65236 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/IUPersistenceTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -35,6 +35,7 @@ public class IUPersistenceTest extends AbstractProvisioningTest { super(rootName, rootHandler); } + @Override public void processingInstruction(String target, String data) throws SAXException { if (IU_TEST_TARGET.equals(target)) { Version iuTestVersion = extractPIVersion(target, data); @@ -56,6 +57,7 @@ public class IUPersistenceTest extends AbstractProvisioningTest { super(); } + @Override protected void finished() { if (isValidXML()) { if (iuHandler != null && singleton.size() == 1) { @@ -68,10 +70,12 @@ public class IUPersistenceTest extends AbstractProvisioningTest { return iu; } + @Override protected void handleRootAttributes(Attributes attributes) { parseAttributes(attributes, noAttributes, noAttributes); } + @Override public void startElement(String name, Attributes attributes) { if (INSTALLABLE_UNIT_ELEMENT.equals(name)) { if (iuHandler == null) { @@ -91,10 +95,12 @@ public class IUPersistenceTest extends AbstractProvisioningTest { super(context, bundleId); } + @Override protected String getErrorMessage() { return "Error parsing installable unit string"; } + @Override protected Object getRootObject() { return theIU; } @@ -120,7 +126,7 @@ public class IUPersistenceTest extends AbstractProvisioningTest { class IUStringWriter extends MetadataWriter { - public IUStringWriter(ByteArrayOutputStream stream) throws IOException { + public IUStringWriter(ByteArrayOutputStream stream) { super(stream, new ProcessingInstruction[] {ProcessingInstruction.makeTargetVersionInstruction(IU_TEST_TARGET, IU_TEST_VERSION)}); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java index e16070ea6..1e8935456 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/MultipleIUAndFragmentTest.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.metadata; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Collection; import java.util.Iterator; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.query.IQueryable; import org.eclipse.equinox.p2.query.QueryUtil; @@ -31,6 +30,7 @@ public class MultipleIUAndFragmentTest extends AbstractProvisioningTest { Collection result; + @Override protected void tearDown() throws Exception { super.tearDown(); iu1 = null; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistFragment.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistFragment.java index e5a4ecf6a..45194587c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistFragment.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistFragment.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype, Inc and others. + * Copyright (c) 2010, 2017 Sonatype, Inc 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ @@ -23,11 +23,11 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; public class PersistFragment extends AbstractProvisioningTest { public void testPersistFragmentIn35Repo() throws ProvisionException { - //Pre 3.6, the host requirements were also persisted as part of the requirements + //Pre 3.6, the host requirements were also persisted as part of the requirements IInstallableUnitFragment fragment = createIUFragment(createEclipseIU("A"), "MyHost", Version.createOSGi(1, 0, 0)); File repoFolder = getTempFolder(); IMetadataRepository repo = createMetadataRepository(repoFolder.toURI(), null); - Collection<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(); + Collection<IInstallableUnit> ius = new ArrayList<>(); ius.add(fragment); repo.addInstallableUnits(ius); @@ -40,7 +40,7 @@ public class PersistFragment extends AbstractProvisioningTest { assertNoContents(new File(repoFolder, "content.xml"), new String[] {"generation='2'"}); } - //Verify that in a 3.6 formatted IU, the host requirements are not persisted as part of the requirements + //Verify that in a 3.6 formatted IU, the host requirements are not persisted as part of the requirements public void testPersistFragmentIn36Repo() throws ProvisionException { String orExpression = "providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.eclipse.mylyn34' || pc.name == 'org.eclipse.mylyn35'))"; IExpression expr = ExpressionUtil.parse(orExpression); @@ -50,7 +50,7 @@ public class PersistFragment extends AbstractProvisioningTest { IInstallableUnitFragment fragment = createIUFragment(createEclipseIU("A"), "MyHost", Version.createOSGi(1, 0, 0), new IRequirement[] {orRequirement}, null, null); File repoFolder = getTempFolder(); IMetadataRepository repo = createMetadataRepository(repoFolder.toURI(), null); - Collection<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(); + Collection<IInstallableUnit> ius = new ArrayList<>(); ius.add(fragment); repo.addInstallableUnits(ius); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistNegation.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistNegation.java index 02c4c9c86..31ecdabb4 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistNegation.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/PersistNegation.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype, Inc and others. + * Copyright (c) 2010, 2017 Sonatype, Inc 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ @@ -39,7 +39,7 @@ public class PersistNegation extends AbstractProvisioningTest { IInstallableUnit iu1 = MetadataFactory.createInstallableUnit(iud1); File tmpFolder = getTempFolder(); IMetadataRepository repo = getMetadataRepositoryManager().createRepository(tmpFolder.toURI(), "NegationRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); - ArrayList<IInstallableUnit> iu = new ArrayList<IInstallableUnit>(); + ArrayList<IInstallableUnit> iu = new ArrayList<>(); iu.add(iu1); repo.addInstallableUnits(iu); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/expression/FilterTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/expression/FilterTest.java index caee126eb..9a1d86717 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/expression/FilterTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/expression/FilterTest.java @@ -4,7 +4,7 @@ * 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -30,7 +30,7 @@ public class FilterTest extends TestCase { return; } this.dictionary = dictionary; - List<String> keyList = new ArrayList<String>(dictionary.size()); + List<String> keyList = new ArrayList<>(dictionary.size()); for (Iterator<String> e = dictionary.keySet().iterator(); e.hasNext();) { String key = e.next(); for (Iterator i = keyList.iterator(); i.hasNext();) { @@ -43,14 +43,17 @@ public class FilterTest extends TestCase { this.keys = keyList.toArray(new String[keyList.size()]); } + @Override public int compareTo(Object reference) { throw new UnsupportedOperationException(); } + @Override public Bundle getBundle() { return null; } + @Override public Object getProperty(String k) { for (int i = 0, length = keys.length; i < length; i++) { String key = keys[i]; @@ -61,21 +64,20 @@ public class FilterTest extends TestCase { return null; } + @Override public String[] getPropertyKeys() { return keys.clone(); } + @Override public Bundle[] getUsingBundles() { throw new UnsupportedOperationException(); } + @Override public boolean isAssignableTo(Bundle bundle, String className) { throw new UnsupportedOperationException(); } - - public Dictionary getProperties() { - return new Hashtable(dictionary); - } } private static class SampleComparable implements Comparable { @@ -85,10 +87,12 @@ public class FilterTest extends TestCase { this.value = Integer.parseInt(value); } + @Override public boolean equals(Object o) { return o instanceof SampleComparable && value == ((SampleComparable) o).value; } + @Override public int compareTo(Object o) { return value - ((SampleComparable) o).value; } @@ -112,7 +116,7 @@ public class FilterTest extends TestCase { public void testComparable() throws Exception { IFilterExpression f1 = ExpressionUtil.parseLDAP("(comparable=42)"); //$NON-NLS-1$ Object comp; - Map<String, Object> hash = new HashMap<String, Object>(); + Map<String, Object> hash = new HashMap<>(); comp = new SampleComparable("42"); //$NON-NLS-1$ hash.put("comparable", comp); //$NON-NLS-1$ @@ -125,7 +129,7 @@ public class FilterTest extends TestCase { assertTrue("does not match filter", f1.match(new DictionaryServiceReference(hash))); //$NON-NLS-1$ IFilterExpression f2 = ExpressionUtil.parseLDAP("(comparable=42)"); //$NON-NLS-1$ - hash = new Hashtable<String, Object>(); + hash = new Hashtable<>(); comp = new SampleComparable("42"); //$NON-NLS-1$ hash.put("comparable", comp); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java index d87658d2f..afbb003b0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AllServerTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2016 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2017 Cloudsmith Inc. 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 @@ -170,12 +170,14 @@ public class AllServerTests extends TestCase { public static class DelegatingAuthService extends UIServices { + @Override public AuthenticationInfo getUsernamePassword(String location) { if (hookedAuthDialog != null) return hookedAuthDialog.getUsernamePassword(location); return null; } + @Override public AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo) { if (hookedAuthDialog != null) return hookedAuthDialog.getUsernamePassword(location, previousInfo); @@ -185,6 +187,7 @@ public class AllServerTests extends TestCase { /** * Not used */ + @Override public TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail) { return new TrustInfo(null, false, true); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AuthTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AuthTest.java index baf3252bb..5b65f0422 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AuthTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/AuthTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010, Cloudsmith Inc. + * Copyright (c) 2006, 2017 Cloudsmith Inc. and others. * The code, documentation and other materials contained herein have been * licensed under the Eclipse Public License - v 1.0 by the copyright holder * listed above, as the Initial Contributor under such license. The text of @@ -24,6 +24,7 @@ public class AuthTest extends ServerBasedTestCase { private URI repoLoc; protected String authTestFailMessage; + @Override public void setUp() throws Exception { super.setUp(); PRIVATE_REPO = super.getBaseURL() + "/private/mdr/composite/one"; @@ -83,11 +84,13 @@ public class AuthTest extends ServerBasedTestCase { public class AladdinNotSavedService extends UIServices { public int counter = 0; + @Override public AuthenticationInfo getUsernamePassword(String location) { counter++; return new AuthenticationInfo("Aladdin", "open sesame", false); } + @Override public AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo) { counter++; assertEquals("Aladdin", previousInfo.getUserName()); @@ -99,6 +102,7 @@ public class AuthTest extends ServerBasedTestCase { /** * Not used */ + @Override public TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail) { return new TrustInfo(null, false, true); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/BatchExecuteMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/BatchExecuteMetadataRepositoryTest.java index 425c5e1ad..5e3ef3241 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/BatchExecuteMetadataRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/BatchExecuteMetadataRepositoryTest.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -33,7 +33,7 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest protected Collection<IInstallableUnit> createIUInCollection(String id, Version version) { IInstallableUnit iu = createIU(id, version); - Collection<IInstallableUnit> result = new ArrayList<IInstallableUnit>(1); + Collection<IInstallableUnit> result = new ArrayList<>(1); result.add(iu); return result; } @@ -62,14 +62,12 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI contentXML = new URI(repositoryFile.toURI().toString() + "/content.xml"); - IStatus status = repo.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - repo.addInstallableUnits(createIUInCollection("foo", Version.emptyVersion)); - try { - assertFalse("1.0", fileContainsString(contentXML, "foo")); - } catch (IOException e) { - fail("0.99"); - } + IStatus status = repo.executeBatch(monitor -> { + repo.addInstallableUnits(createIUInCollection("foo", Version.emptyVersion)); + try { + assertFalse("1.0", fileContainsString(contentXML, "foo")); + } catch (IOException e) { + fail("0.99"); } }, new NullProgressMonitor()); assertTrue(status.isOK()); @@ -90,18 +88,16 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI contentXML = new URI(repositoryFile.toURI().toString() + "/content.xml"); - IStatus status = repo.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - repo.addInstallableUnits(createIUInCollection("foo", Version.emptyVersion)); - repo.addInstallableUnits(createIUInCollection("bar", Version.emptyVersion)); - repo.addInstallableUnits(createIUInCollection("baz", Version.emptyVersion)); - try { - assertFalse("1.0", fileContainsString(contentXML, "foo")); - assertFalse("1.0", fileContainsString(contentXML, "bar")); - assertFalse("1.0", fileContainsString(contentXML, "baz")); - } catch (IOException e) { - fail("0.99"); - } + IStatus status = repo.executeBatch(monitor -> { + repo.addInstallableUnits(createIUInCollection("foo", Version.emptyVersion)); + repo.addInstallableUnits(createIUInCollection("bar", Version.emptyVersion)); + repo.addInstallableUnits(createIUInCollection("baz", Version.emptyVersion)); + try { + assertFalse("1.0", fileContainsString(contentXML, "foo")); + assertFalse("1.0", fileContainsString(contentXML, "bar")); + assertFalse("1.0", fileContainsString(contentXML, "baz")); + } catch (IOException e) { + fail("0.99"); } }, new NullProgressMonitor()); assertTrue(status.isOK()); @@ -126,12 +122,10 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI contentXML = new URI(repositoryFile.toURI().toString() + "/content.xml"); - IStatus status = repo.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - repo.addInstallableUnits(createIUInCollection("foo", Version.emptyVersion)); - repo.addInstallableUnits(createIUInCollection("bar", Version.emptyVersion)); - throw new RuntimeException(); - } + IStatus status = repo.executeBatch(monitor -> { + repo.addInstallableUnits(createIUInCollection("foo", Version.emptyVersion)); + repo.addInstallableUnits(createIUInCollection("bar", Version.emptyVersion)); + throw new RuntimeException(); }, new NullProgressMonitor()); assertFalse(status.isOK()); assertEquals("1.0", 1, repo.query(QueryUtil.createIUQuery("foo"), new NullProgressMonitor()).toSet().size()); @@ -153,13 +147,11 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI contentXML = new URI(repositoryFile.toURI().toString() + "/content.xml"); - IStatus status = repo.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - Collection<IInstallableUnit> foo = createIUInCollection("foo", Version.emptyVersion); - repo.addInstallableUnits(foo); - repo.addInstallableUnits(createIUInCollection("bar", Version.emptyVersion)); - repo.removeInstallableUnits(foo); - } + IStatus status = repo.executeBatch(monitor -> { + Collection<IInstallableUnit> foo = createIUInCollection("foo", Version.emptyVersion); + repo.addInstallableUnits(foo); + repo.addInstallableUnits(createIUInCollection("bar", Version.emptyVersion)); + repo.removeInstallableUnits(foo); }, new NullProgressMonitor()); assertTrue(status.isOK()); assertEquals("1.0", 0, repo.query(QueryUtil.createIUQuery("foo"), new NullProgressMonitor()).toSet().size()); @@ -181,16 +173,14 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest Map properties = new HashMap(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); final URI contentXML = new URI(repositoryFile.toURI().toString() + "/content.xml"); - IStatus status = repo.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - repo.addInstallableUnits(createIUInCollection("1", Version.emptyVersion)); - repo.addInstallableUnits(createIUInCollection("2", Version.emptyVersion)); - repo.addInstallableUnits(createIUInCollection("3", Version.emptyVersion)); - Collection<IInstallableUnit> foo = createIUInCollection("foo", Version.emptyVersion); - repo.addInstallableUnits(foo); - repo.addInstallableUnits(createIUInCollection("bar", Version.emptyVersion)); - repo.removeInstallableUnits(foo); - } + IStatus status = repo.executeBatch(monitor -> { + repo.addInstallableUnits(createIUInCollection("1", Version.emptyVersion)); + repo.addInstallableUnits(createIUInCollection("2", Version.emptyVersion)); + repo.addInstallableUnits(createIUInCollection("3", Version.emptyVersion)); + Collection<IInstallableUnit> foo = createIUInCollection("foo", Version.emptyVersion); + repo.addInstallableUnits(foo); + repo.addInstallableUnits(createIUInCollection("bar", Version.emptyVersion)); + repo.removeInstallableUnits(foo); }, new NullProgressMonitor()); assertTrue(status.isOK()); assertEquals("1.0", 4, repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()).toSet().size()); @@ -209,10 +199,8 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest repositoryURI = repositoryFile.toURI(); Map properties = new HashMap(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); - IStatus status = repo.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - // empty - } + IStatus status = repo.executeBatch(monitor -> { + // empty }, new NullProgressMonitor()); assertTrue(status.isOK()); } catch (Exception e) { @@ -232,11 +220,13 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest super(getAgent()); } + @Override public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { executeBatch = true; return super.executeBatch(runnable, monitor); } + @Override public void save() { if (executeBatch) throw new RuntimeException("foo"); @@ -244,16 +234,14 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest } /* - * This tests that exceptions are properly propagated for a SimpleMetadataRepository + * This tests that exceptions are properly propagated for a SimpleMetadataRepository */ public void testBatchProcessingExceptionsSimple() { try { LocalMetadataRepository simpleMetadataRepository = new FailingSimpleMetadataRepository(); - IStatus status = simpleMetadataRepository.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - throw new RuntimeException("bar"); - } + IStatus status = simpleMetadataRepository.executeBatch(monitor -> { + throw new RuntimeException("bar"); }, new NullProgressMonitor()); assertFalse(status.isOK()); assertEquals("foo", status.getException().getMessage()); @@ -271,10 +259,8 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest try { LocalMetadataRepository simpleMetadataRepository = new FailingSimpleMetadataRepository(); - IStatus status = simpleMetadataRepository.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - // empty - } + IStatus status = simpleMetadataRepository.executeBatch(monitor -> { + // empty }, new NullProgressMonitor()); assertFalse(status.isOK()); assertEquals("foo", status.getException().getMessage()); @@ -296,11 +282,13 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest super(getAgent()); } + @Override public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { executeBatch = true; return super.executeBatch(runnable, monitor); } + @Override public void save() { if (executeBatch) didSave = true; @@ -314,10 +302,8 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest public void testBatchProcessingTrackSaving() { try { TrackSavignSimpleMetadataRepository simpleMetadataRepository = new TrackSavignSimpleMetadataRepository(); - simpleMetadataRepository.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - //do nothing; - } + simpleMetadataRepository.executeBatch(monitor -> { + //do nothing; }, new NullProgressMonitor()); assertTrue(simpleMetadataRepository.didSave); } catch (Exception e) { @@ -332,10 +318,8 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest public void testBatchProcessingTrackSavingException() { try { TrackSavignSimpleMetadataRepository simpleMetadataRepository = new TrackSavignSimpleMetadataRepository(); - simpleMetadataRepository.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - throw new RuntimeException(); - } + simpleMetadataRepository.executeBatch(monitor -> { + throw new RuntimeException(); }, new NullProgressMonitor()); assertTrue(simpleMetadataRepository.didSave); } catch (Exception e) { @@ -353,10 +337,8 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest repositoryURI = repositoryFile.toURI(); Map properties = new HashMap(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); - repo.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - throw new RuntimeException(); - } + repo.executeBatch(monitor -> { + throw new RuntimeException(); }, new NullProgressMonitor()); Field field = LocalMetadataRepository.class.getDeclaredField("disableSave"); field.setAccessible(true); @@ -369,7 +351,7 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest } /* - * This test ensure that the simple metadata repository disables the + * This test ensure that the simple metadata repository disables the * save flag during the batch process */ public void testDisableSaveFlagDuringExecutionSimple() { @@ -378,24 +360,22 @@ public class BatchExecuteMetadataRepositoryTest extends AbstractProvisioningTest repositoryURI = repositoryFile.toURI(); Map properties = new HashMap(); final LocalMetadataRepository repo = (LocalMetadataRepository) getMetadataRepositoryManager().createRepository(repositoryURI, "My Repo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties); - repo.executeBatch(new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - Field field; - try { - field = LocalMetadataRepository.class.getDeclaredField("disableSave"); - field.setAccessible(true); - boolean disableSave = field.getBoolean(repo); - assertTrue("1.0", disableSave); - } catch (SecurityException e) { - fail("1.1" + e.getMessage()); - } catch (NoSuchFieldException e) { - // TODO Auto-generated catch block - fail("1.2" + e.getMessage()); - } catch (IllegalArgumentException e) { - fail("1.2" + e.getMessage()); - } catch (IllegalAccessException e) { - fail("1.2" + e.getMessage()); - } + repo.executeBatch(monitor -> { + Field field; + try { + field = LocalMetadataRepository.class.getDeclaredField("disableSave"); + field.setAccessible(true); + boolean disableSave = field.getBoolean(repo); + assertTrue("1.0", disableSave); + } catch (SecurityException e1) { + fail("1.1" + e1.getMessage()); + } catch (NoSuchFieldException e2) { + // TODO Auto-generated catch block + fail("1.2" + e2.getMessage()); + } catch (IllegalArgumentException e3) { + fail("1.2" + e3.getMessage()); + } catch (IllegalAccessException e4) { + fail("1.2" + e4.getMessage()); } }, new NullProgressMonitor()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java index d5e4c617d..362e47418 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Code 9 - ongoing development @@ -39,12 +39,14 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest { private static final String TEST_VALUE = "TestValue"; protected File repoLocation; + @Override protected void setUp() throws Exception { super.setUp(); repoLocation = new File(getTempFolder(), "CompositeMetadataRepositoryTest"); AbstractProvisioningTest.delete(repoLocation); } + @Override protected void tearDown() throws Exception { getMetadataRepositoryManager().removeRepository(repoLocation.toURI()); delete(repoLocation); @@ -483,6 +485,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest { compositeRepo.addChild(location1); compositeRepo.addChild(location2); IQuery cQuery = QueryUtil.createLatestQuery(new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (candidate instanceof IInstallableUnit) { IInstallableUnit iInstallableUnit = (IInstallableUnit) candidate; @@ -582,7 +585,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest { /* * Ensure that we can create a non-local composite repository. - * Note that we had to change this test method when we changed the + * Note that we had to change this test method when we changed the * behaviour of the composite repos to aggressively load the children. */ public void testNonLocalRepo() { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java index cdc79c1f7..e62c7ba33 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/HttpStatusTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010, Cloudsmith Inc. + * Copyright (c) 2009, 2017 Cloudsmith Inc. and others. * The code, documentation and other materials contained herein have been * licensed under the Eclipse Public License - v 1.0 by the copyright holder * listed above, as the Initial Contributor under such license. The text of @@ -27,6 +27,7 @@ public class HttpStatusTest extends ServerBasedTestCase { private URI repoLoc; protected String authTestFailMessage; + @Override public void setUp() throws Exception { super.setUp(); mgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME); @@ -173,11 +174,13 @@ public class HttpStatusTest extends ServerBasedTestCase { public class AladdinNotSavedService extends UIServices { public int counter = 0; + @Override public AuthenticationInfo getUsernamePassword(String location) { counter++; return new AuthenticationInfo("Aladdin", "open sesame", false); } + @Override public AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo) { counter++; assertEquals("Aladdin", previousInfo.getUserName()); @@ -189,6 +192,7 @@ public class HttpStatusTest extends ServerBasedTestCase { /** * Not used */ + @Override public TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail) { return new TrustInfo(null, false, true); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java index 6b8226883..903f7c6e2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Code 9 - ongoing development @@ -43,11 +43,13 @@ public class JarURLMetadataRepositoryTest extends AbstractProvisioningTest { this(""); } + @Override protected void setUp() throws Exception { manager = getMetadataRepositoryManager(); } + @Override protected void tearDown() throws Exception { manager = null; if (testRepoJar != null) diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java index 50c689d58..59171df6f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Code 9 - ongoing development @@ -15,7 +15,8 @@ import java.io.File; import java.net.URI; import java.util.*; import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.equinox.internal.provisional.p2.core.eventbus.*; +import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; +import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener; import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.metadata.*; @@ -36,6 +37,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest { private static final String TEST_VALUE = "TestValue"; protected File repoLocation; + @Override protected void setUp() throws Exception { super.setUp(); String tempDir = System.getProperty("java.io.tmpdir"); @@ -44,6 +46,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest { repoLocation.mkdir(); } + @Override protected void tearDown() throws Exception { getMetadataRepositoryManager().removeRepository(repoLocation.toURI()); delete(repoLocation); @@ -174,8 +177,8 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest { /** * Tests loading a repository that has a reference to itself as a disabled repository. - * @throws MalformedURLException - * @throws ProvisionException + * @throws MalformedURLException + * @throws ProvisionException */ public void testLoadSelfReference() throws ProvisionException { //setup a repository that has a reference to itself in disabled state @@ -189,18 +192,16 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest { final int[] callCount = new int[] {0}; final boolean[] wasEnabled = new boolean[] {false}; //add a listener to ensure we receive add events with the repository enabled - ProvisioningListener listener = new SynchronousProvisioningListener() { - public void notify(EventObject o) { - if (!(o instanceof RepositoryEvent)) - return; - RepositoryEvent event = (RepositoryEvent) o; - if (event.getKind() != RepositoryEvent.ADDED) - return; - if (!event.getRepositoryLocation().equals(repoURI)) - return; - wasEnabled[0] = event.isRepositoryEnabled(); - callCount[0]++; - } + SynchronousProvisioningListener listener = o -> { + if (!(o instanceof RepositoryEvent)) + return; + RepositoryEvent event = (RepositoryEvent) o; + if (event.getKind() != RepositoryEvent.ADDED) + return; + if (!event.getRepositoryLocation().equals(repoURI)) + return; + wasEnabled[0] = event.isRepositoryEnabled(); + callCount[0]++; }; final IProvisioningEventBus eventBus = getEventBus(); eventBus.addListener(listener); @@ -232,18 +233,16 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest { final int[] callCount = new int[] {0}; final boolean[] wasEnabled = new boolean[] {false}; //add a listener to ensure we receive add events with the repository enabled - ProvisioningListener listener = new SynchronousProvisioningListener() { - public void notify(EventObject o) { - if (!(o instanceof RepositoryEvent)) - return; - RepositoryEvent event = (RepositoryEvent) o; - if (event.getKind() != RepositoryEvent.ADDED) - return; - if (!event.getRepositoryLocation().equals(repoURL)) - return; - wasEnabled[0] = event.isRepositoryEnabled(); - callCount[0]++; - } + SynchronousProvisioningListener listener = o -> { + if (!(o instanceof RepositoryEvent)) + return; + RepositoryEvent event = (RepositoryEvent) o; + if (event.getKind() != RepositoryEvent.ADDED) + return; + if (!event.getRepositoryLocation().equals(repoURL)) + return; + wasEnabled[0] = event.isRepositoryEnabled(); + callCount[0]++; }; getEventBus().addListener(listener); try { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java index 5e5cc3dc7..60f0ff351 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -38,11 +38,13 @@ public class MetadataRepositoryManagerExceptionsTest extends AbstractProvisionin return new TestSuite(MetadataRepositoryManagerExceptionsTest.class); } + @Override protected void setUp() throws Exception { super.setUp(); manager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME); } + @Override protected void tearDown() throws Exception { super.tearDown(); for (Iterator it = toDelete.iterator(); it.hasNext();) @@ -53,7 +55,7 @@ public class MetadataRepositoryManagerExceptionsTest extends AbstractProvisionin /** * Adds a repository for a non existing site, should * return REPOSITORY_NOT_FOUND, since any other status code gets logged. - * + * * @throws URISyntaxException */ public void testFailedConnection() throws URISyntaxException { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java index a316f8e49..55231f765 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Red Hat Inc. - Bug 460967 @@ -24,7 +24,6 @@ import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; import org.eclipse.equinox.internal.p2.metadata.repository.SimpleMetadataRepositoryFactory; import org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager; import org.eclipse.equinox.internal.p2.updatesite.metadata.UpdateSiteMetadataRepositoryFactory; -import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener; import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener; import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent; import org.eclipse.equinox.p2.core.IAgentLocation; @@ -52,6 +51,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { return new TestSuite(MetadataRepositoryManagerTest.class); } + @Override protected void setUp() throws Exception { super.setUp(); manager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME); @@ -59,6 +59,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { FailingMetadataRepositoryFactory.FAIL = true; } + @Override protected void tearDown() throws Exception { super.tearDown(); for (Iterator it = toDelete.iterator(); it.hasNext();) @@ -115,7 +116,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { /** * Adds a repository that has a non-standard (non ECF) scheme. This should * return REPOSITORY_NOT_FOUND, since any other status code gets logged. - * + * * @throws URISyntaxException */ public void testFailedConnection() throws URISyntaxException { @@ -221,7 +222,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { public void testLoadContention() { File site = getTestData("Repositoy", "/testData/metadataRepo/good/"); final URI location = site.toURI(); - final List<Exception> failures = new ArrayList<Exception>(); + final List<Exception> failures = new ArrayList<>(); final IMetadataRepositoryManager repoManager = getMetadataRepositoryManager(); class LoadJob extends Job { LoadJob() { @@ -471,15 +472,13 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest { public void testRepositoryReferenceCompatibility() throws URISyntaxException { File site = getTestData("Repository", "/testData/metadataRepo/unencodedreporeferences/"); URI location = site.toURI(); - final List references = new ArrayList(); - ProvisioningListener referenceCollector = new SynchronousProvisioningListener() { - public void notify(EventObject o) { - if (!(o instanceof RepositoryEvent)) - return; - RepositoryEvent event = (RepositoryEvent) o; - if (event.getKind() == RepositoryEvent.DISCOVERED) - references.add(event.getRepositoryLocation()); - } + final List<URI> references = new ArrayList<>(); + SynchronousProvisioningListener referenceCollector = o -> { + if (!(o instanceof RepositoryEvent)) + return; + RepositoryEvent event = (RepositoryEvent) o; + if (event.getKind() == RepositoryEvent.DISCOVERED) + references.add(event.getRepositoryLocation()); }; getEventBus().addListener(referenceCollector); try { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java index 1f2ea4ebd..dccfc2272 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ResumeDownloadTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010, Cloudsmith Inc. + * Copyright (c) 2006, 2017 Cloudsmith Inc. and others. * The code, documentation and other materials contained herein have been * licensed under the Eclipse Public License - v 1.0 by the copyright holder * listed above, as the Initial Contributor under such license. The text of @@ -24,6 +24,7 @@ public class ResumeDownloadTest extends AbstractProvisioningTest { private URI repoLoc; private String originalResumeProp; + @Override protected void setUp() throws Exception { super.setUp(); repoLoc = new URI(UPDATE_SITE); @@ -140,16 +141,19 @@ public class ResumeDownloadTest extends AbstractProvisioningTest { // } + @Override public void onData(FileReader reader, IIncomingFileTransfer source, IProgressMonitor monitor) { bytesReceived = source.getBytesReceived(); if (bytesReceived > 1000) monitor.setCanceled(true); } + @Override public void onDone(FileReader reader, IIncomingFileTransfer source, IProgressMonitor monitor) { bytesReceived = source.getBytesReceived(); } + @Override public void onStart(FileReader reader, IIncomingFileTransfer source, IProgressMonitor monitor) { entireLength = source.getFileLength(); } @@ -162,14 +166,17 @@ public class ResumeDownloadTest extends AbstractProvisioningTest { // } + @Override public void onData(FileReader reader, IIncomingFileTransfer source, IProgressMonitor monitor) { resumedReceived = source.getBytesReceived(); } + @Override public void onDone(FileReader reader, IIncomingFileTransfer source, IProgressMonitor monitor) { /* ignore */ } + @Override public void onStart(FileReader reader, IIncomingFileTransfer source, IProgressMonitor monitor) { IFileRangeSpecification spec = source.getFileRangeSpecification(); resumeStart = spec == null ? 0L : spec.getStartPosition(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java index ff324b672..f715a450b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2008, 2017 EclipseSource 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 @@ -41,6 +41,7 @@ import org.eclipse.equinox.p2.tests.StringBufferStream; public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { protected File repoLocation; + @Override protected void setUp() throws Exception { super.setUp(); String tempDir = System.getProperty("java.io.tmpdir"); @@ -49,6 +50,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { repoLocation.mkdir(); } + @Override protected void tearDown() throws Exception { getMetadataRepositoryManager().removeRepository(repoLocation.toURI()); delete(repoLocation); @@ -81,22 +83,27 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { this.versionRange = versionRange; } + @Override public IMatchExpression<IInstallableUnit> getFilter() { return this.filter; } + @Override public String getName() { return this.name; } + @Override public String getNamespace() { return this.namespace; } + @Override public VersionRange getRange() { return this.versionRange; } + @Override public boolean isGreedy() { return isGreedy; } @@ -105,6 +112,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { this.filter = filter == null ? null : InstallableUnit.parseFilter(filter); } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -134,14 +142,17 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { return getRange().isIncluded(cap.getVersion()); } + @Override public int getMin() { return min; } + @Override public int getMax() { return max; } + @Override public boolean isMatch(IInstallableUnit candidate) { if (!candidate.satisfies(this)) return false; @@ -153,10 +164,12 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { return false; } + @Override public IMatchExpression<IInstallableUnit> getMatches() { return ExpressionUtil.getFactory().matchExpression(ExpressionUtil.parse("providedCapabilities.exists(x | x.name == $0 && x.namespace == $1 && x.version ~= $2)"), name, namespace, versionRange); } + @Override public String getDescription() { return description; } @@ -174,6 +187,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { this.version = version; } + @Override public boolean equals(Object other) { if (other == null) return false; @@ -187,14 +201,17 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { return true; } + @Override public String getName() { return this.name; } + @Override public String getNamespace() { return this.namespace; } + @Override public Version getVersion() { return this.version; } @@ -233,60 +250,74 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { this.providedCapabilities.add(providedCapability); } + @Override public Collection<IArtifactKey> getArtifacts() { return artifacts; } + @Override public ICopyright getCopyright() { return this.copyright; } + @Override public IMatchExpression<IInstallableUnit> getFilter() { return this.filter; } + @Override public Collection<IInstallableUnitFragment> getFragments() { return fragments; } + @Override public String getId() { return this.id; } + @Override public Collection<ILicense> getLicenses() { return license; } + @Override public Map getProperties() { return this.properties; } + @Override public String getProperty(String key) { return (String) this.properties.get(key); } + @Override public List<IProvidedCapability> getProvidedCapabilities() { return providedCapabilities; } + @Override public List<IRequirement> getRequirements() { return requiredCapabilities; } + @Override public Collection<ITouchpointData> getTouchpointData() { return touchpointData; } + @Override public ITouchpointType getTouchpointType() { if (this.touchpointType == null) return ITouchpointType.NONE; return this.touchpointType; } + @Override public IUpdateDescriptor getUpdateDescriptor() { return this.updateDescriptor; } + @Override public Version getVersion() { return this.version; } @@ -295,40 +326,49 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { return this.isFragment; } + @Override public boolean isResolved() { return this.isResolved; } + @Override public boolean isSingleton() { return this.isSingleton; } + @Override public boolean satisfies(IRequirement candidate) { return candidate.isMatch(this); } + @Override public IInstallableUnit unresolved() { return this; } + @Override public int compareTo(IInstallableUnit other) { if (getId().compareTo(other.getId()) == 0) return (getVersion().compareTo(other.getVersion())); return getId().compareTo(other.getId()); } + @Override public List<IRequirement> getMetaRequirements() { return Collections.<IRequirement> emptyList(); } + @Override public String getProperty(String key, String locale) { return getProperty(key); } + @Override public Collection<ILicense> getLicenses(String locale) { return license; } + @Override public ICopyright getCopyright(String locale) { return copyright; } @@ -339,6 +379,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { Map instructions = new HashMap(); + @Override public ITouchpointInstruction getInstruction(String instructionKey) { return (ITouchpointInstruction) instructions.get(instructionKey); } @@ -347,10 +388,12 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { this.instructions.put(instructionKey, instruction); } + @Override public Map getInstructions() { return this.instructions; } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -378,14 +421,17 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { this.importAttribute = importAttribute; } + @Override public String getBody() { return this.body; } + @Override public String getImportAttribute() { return this.importAttribute; } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -418,14 +464,17 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { this.version = version; } + @Override public String getId() { return this.id; } + @Override public Version getVersion() { return this.version; } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -450,14 +499,17 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { this.newValue = newValue2; } + @Override public IRequiredCapability applyOn() { return applyOn; } + @Override public IRequiredCapability newValue() { return newValue; } + @Override public boolean matches(IRequiredCapability toMatch) { if (!toMatch.getNamespace().equals(applyOn.getNamespace())) return false; @@ -508,6 +560,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { return null; } + @Override public int hashCode() { final int prime = 31; int result = 1; @@ -516,6 +569,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { return result; } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -537,6 +591,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { return true; } + @Override public String toString() { return applyOn + " --> " + newValue; //$NON-NLS-1$ } @@ -554,20 +609,24 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { this.location = location; } + @Override public String getBody() { return this.body; } + @Override public String getUUID() { if (uuid == null) uuid = this.calculateLicenseDigest().toString(16); return uuid; } + @Override public URI getLocation() { return this.location; } + @Override public boolean equals(Object obj) { if (obj == this) return true; @@ -616,16 +675,17 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { } class AllAcceptingQuery extends MatchQuery { + @Override public boolean isMatch(Object candidate) { return true; } } /** - * This test cases creates an SPI implementation of an IU and writes it to a repository. + * This test cases creates an SPI implementation of an IU and writes it to a repository. * If the repository is Cached, it reads back the SPI implementation. If the repository is * not cached, it reads back the default (InstallableUnit) implementation. - * + * * @throws ProvisionException */ public void testSPIMetadataIU() throws ProvisionException { @@ -651,10 +711,10 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { } /** - * This test cases creates an SPI IU and adds a default provided capability. It ensures that + * This test cases creates an SPI IU and adds a default provided capability. It ensures that * you can write this type of repository and read it back again. If you read it back, and it is cached, * you get the SPI IU, otherwise you get the default (InstallableUnit) IU. - * + * * @throws ProvisionException */ public void testProvidedCapabilitywithSPI_IU() throws ProvisionException { @@ -690,10 +750,10 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { } /** - * This test cases creates an IU and adds an SPI required capability. It ensures that + * This test cases creates an IU and adds an SPI required capability. It ensures that * you can write this type of repository and read it back again. If you read it back, and it is cached, * you get the SPI Required Capability, otherwise you get the default RequiredCapability. - * + * * @throws ProvisionException */ public void testSPIRequiredCapability() throws ProvisionException { @@ -822,7 +882,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest { assertEquals(patchUnit.getRequirementsChange().get(0), spiRequirementChange); assertEquals(spiRequirementChange, patchUnit.getRequirementsChange().get(0)); - // Check to make sure the actual objects are not equal. This is because the repo has + // Check to make sure the actual objects are not equal. This is because the repo has // been refreshed, and re-parsed, thus using the default implementations. assertFalse(spiTouchpointData == unit.getTouchpointData().iterator().next()); assertFalse(spiRequiredCapability == unit.getRequirements().iterator().next()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ServerBasedTestCase.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ServerBasedTestCase.java index 859e9c4c9..5991c8e9e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ServerBasedTestCase.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/ServerBasedTestCase.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2006, 2015, Cloudsmith Inc. + * Copyright (c) 2006, 2017 Cloudsmith Inc. and others. * The code, documentation and other materials contained herein have been * licensed under the Eclipse Public License - v 1.0 by the copyright holder * listed above, as the Initial Contributor under such license. The text of * such license is available at www.eclipse.org. - * + * * Contributors: * Cloudsmith Inc. - Initial API and implementation. * Red Hat Inc. - Bug 460967 @@ -27,6 +27,7 @@ public class ServerBasedTestCase extends TestCase { super(name); } + @Override public void run(TestResult result) { Protectable p = new ProtectedRunner(result); result.runProtected(this, p); @@ -53,11 +54,13 @@ public class ServerBasedTestCase extends TestCase { AllServerTests.checkTearDown(); } + @Override public void tearDown() throws Exception { // if a test is run out or order - this must be done AllServerTests.checkTearDown(); } + @Override public void setUp() throws Exception { // if a test is run out or order - this must be done AllServerTests.checkSetUp(); @@ -70,6 +73,7 @@ public class ServerBasedTestCase extends TestCase { this.result = result; } + @Override public void protect() throws Exception { oneTimeSetUp(); basicRun(result); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java index 2daaafe39..8a90f50a4 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SiteIndexFileTest.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2010, 2015 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2010, 2017 EclipseSource 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 @@ -31,7 +31,7 @@ import org.eclipse.equinox.p2.tests.*; import org.hamcrest.core.IsInstanceOf; /** - * These tests are used to verify the index.p2 file in a variety + * These tests are used to verify the index.p2 file in a variety * of different situations */ public class SiteIndexFileTest extends AbstractProvisioningTest { @@ -41,6 +41,7 @@ public class SiteIndexFileTest extends AbstractProvisioningTest { super(ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class)); } + @Override public String[] sortSuffixes(String[] suffixes, URI location, String[] preferredOrder) { return super.sortSuffixes(suffixes, location, preferredOrder); } @@ -258,7 +259,7 @@ public class SiteIndexFileTest extends AbstractProvisioningTest { } /* - * Adds a query parameter to the end of the URI and tests that p2 can properly + * Adds a query parameter to the end of the URI and tests that p2 can properly * find the p2.index file. */ public void testSingleRepositoryWithQueryParams() throws Exception { @@ -429,7 +430,7 @@ public class SiteIndexFileTest extends AbstractProvisioningTest { } /* - * Tests that a location which specifies both an artifact and a metadata repository w/ an index.p2 file + * Tests that a location which specifies both an artifact and a metadata repository w/ an index.p2 file * can fully loaded */ public void testFullRepository() throws Exception { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/StandaloneSerializationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/StandaloneSerializationTest.java index 0567c5051..0f292f5f8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/StandaloneSerializationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/StandaloneSerializationTest.java @@ -78,7 +78,7 @@ public class StandaloneSerializationTest extends TestCase { MetadataFactory.InstallableUnitDescription iu2 = new MetadataFactory.InstallableUnitDescription(); iu2.setId("bar"); iu2.setVersion(Version.create("1.0.0")); - Collection<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(); + Collection<IInstallableUnit> ius = new ArrayList<>(); ius.add(MetadataFactory.createInstallableUnit(iu)); ius.add(MetadataFactory.createInstallableUnit(iu2)); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/TimeoutTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/TimeoutTest.java index bb2799de1..326fed6a2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/TimeoutTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/TimeoutTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010, Cloudsmith Inc. + * Copyright (c) 2009, 2017 Cloudsmith Inc. and others. * The code, documentation and other materials contained herein have been * licensed under the Eclipse Public License - v 1.0 by the copyright holder * listed above, as the Initial Contributor under such license. The text of @@ -23,6 +23,7 @@ public class TimeoutTest extends ServerBasedTestCase { private URI repoLoc; protected String authTestFailMessage; + @Override public void setUp() throws Exception { super.setUp(); mgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME); @@ -158,11 +159,13 @@ public class TimeoutTest extends ServerBasedTestCase { public class AladdinNotSavedService extends UIServices { public int counter = 0; + @Override public AuthenticationInfo getUsernamePassword(String location) { counter++; return new AuthenticationInfo("Aladdin", "open sesame", false); } + @Override public AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo) { counter++; assertEquals("Aladdin", previousInfo.getUserName()); @@ -174,6 +177,7 @@ public class TimeoutTest extends ServerBasedTestCase { /** * Not used */ + @Override public TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail) { return new TrustInfo(null, false, true); } @@ -189,6 +193,7 @@ public class TimeoutTest extends ServerBasedTestCase { theDelay = delay; } + @Override public void run() { try { Thread.sleep(theDelay); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/XZedRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/XZedRepositoryTest.java index 3042424c0..4e837f081 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/XZedRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/XZedRepositoryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 Rapicorp, Inc and others. + * Copyright (c) 2015, 2017 Rapicorp, Inc 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 @@ -45,7 +45,7 @@ public class XZedRepositoryTest extends AbstractProvisioningTest { } @Test - public void testLoadXzBusted() throws ProvisionException, OperationCanceledException { + public void testLoadXzBusted() throws OperationCanceledException { boolean repoCanLoad = true; try { getMetadataRepositoryManager().loadRepository(getTestData("xzedRepo", "testData/xzRepoTests/metadata/xzBusted").toURI(), null); @@ -95,7 +95,7 @@ public class XZedRepositoryTest extends AbstractProvisioningTest { } @Test - public void testLoadArtifactsXzBusted() throws ProvisionException, OperationCanceledException { + public void testLoadArtifactsXzBusted() throws OperationCanceledException { boolean repoCanLoad = true; try { getMetadataRepositoryManager().loadRepository(getTestData("xzedRepo", "testData/xzRepoTests/artifacts/xzBusted").toURI(), null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java index df181719e..14a0fd02f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Red Hat Inc. - Bug 460967 @@ -47,9 +47,7 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest { protected File sourceRepo3Location; //helloworldfeature + yetanotherfeature protected File sourceRepo4Location; //helloworldfeature v1.0.1 - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#setUp() - */ + @Override protected void setUp() throws Exception { super.setUp(); //load all the repositories @@ -63,9 +61,7 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest { delete(destRepoLocation); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#tearDown() - */ + @Override protected void tearDown() throws Exception { //remove all the repositories getArtifactRepositoryManager().removeRepository(destRepoLocation.toURI()); @@ -104,9 +100,9 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest { } /** - * Runs mirror application with default arguments. source is the source repo, + * Runs mirror application with default arguments. source is the source repo, * destination is the destination repo, append is if the "-writeMode clean" argument should be excluded - * + * * Note: We use URL here because command line applications traffic in unencoded URLs, * so we can't use java.net.URI which will always use the encoded form */ @@ -1192,14 +1188,17 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest { manager.removeRepository(srcLocation); } + @Override public synchronized IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { return source.getArtifactDescriptors(key); } + @Override public Iterator<IArtifactKey> everything() { return ((SimpleArtifactRepository) source).everything(); } + @Override public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { if (firstAttempt) { firstAttempt = false; @@ -1209,10 +1208,12 @@ public class ArtifactMirrorApplicationTest extends AbstractProvisioningTest { return source.getRawArtifact(descriptor, destination, monitor); } + @Override public synchronized boolean contains(IArtifactDescriptor descriptor) { return source.contains(descriptor); } + @Override public synchronized IQueryResult query(IQuery query, IProgressMonitor monitor) { return source.query(query, monitor); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactRepositoryCleanupTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactRepositoryCleanupTest.java index 455b0b7be..0a4e516b0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactRepositoryCleanupTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactRepositoryCleanupTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -26,6 +26,7 @@ public class ArtifactRepositoryCleanupTest extends AbstractProvisioningTest { protected File sourceRepoLocation; //helloworldfeature protected File bystanderRepoLocation; //anotherfeature + @Override protected void setUp() throws Exception { super.setUp(); //load all the repositories @@ -38,6 +39,7 @@ public class ArtifactRepositoryCleanupTest extends AbstractProvisioningTest { AbstractProvisioningTest.delete(destRepoLocation); } + @Override protected void tearDown() throws Exception { //remove all the repositories getArtifactRepositoryManager().removeRepository(destRepoLocation.toURI()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java index d89002c79..358da726b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -35,9 +35,7 @@ public class MetadataMirrorApplicationTest extends AbstractProvisioningTest { protected File sourceRepo3Location; //helloworldfeature + yetanotherfeature protected File sourceRepo4Location; //helloworldfeature v1.0.1 - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#setUp() - */ + @Override protected void setUp() throws Exception { super.setUp(); //load all the repositories @@ -51,9 +49,7 @@ public class MetadataMirrorApplicationTest extends AbstractProvisioningTest { AbstractProvisioningTest.delete(destRepoLocation); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#tearDown() - */ + @Override protected void tearDown() throws Exception { //remove all the repositories getMetadataRepositoryManager().removeRepository(destRepoLocation.toURI()); @@ -80,9 +76,9 @@ public class MetadataMirrorApplicationTest extends AbstractProvisioningTest { } /** - * Runs mirror application with default arguments. source is the source repo, + * Runs mirror application with default arguments. source is the source repo, * destination is the destination repo, append is if the "-writeMode clean" argument should be excluded - * + * * Note: We use URL here because command line applications traffic in unencoded URLs, * so we can't use java.net.URI which will always use the encoded form */ @@ -281,7 +277,7 @@ public class MetadataMirrorApplicationTest extends AbstractProvisioningTest { } /** - * Tests mirroring all metadata in a repository to an empty repository + * Tests mirroring all metadata in a repository to an empty repository * Source contains A, B * Target contains * Expected is A, B diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataRepositoryCleanupTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataRepositoryCleanupTest.java index 77a84115a..43545f2ab 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataRepositoryCleanupTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataRepositoryCleanupTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -26,6 +26,7 @@ public class MetadataRepositoryCleanupTest extends AbstractProvisioningTest { protected File sourceRepoLocation; //helloworldfeature protected File bystanderRepoLocation; //anotherfeature + @Override protected void setUp() throws Exception { super.setUp(); //load all the repositories @@ -38,6 +39,7 @@ public class MetadataRepositoryCleanupTest extends AbstractProvisioningTest { AbstractProvisioningTest.delete(destRepoLocation); } + @Override protected void tearDown() throws Exception { //remove all the repositories getMetadataRepositoryManager().removeRepository(destRepoLocation.toURI()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MirrorApplicationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MirrorApplicationTest.java index 979eab272..60a4659ec 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MirrorApplicationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MirrorApplicationTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 SAP AG and others. + * Copyright (c) 2013, 2017 SAP AG 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 @@ -36,7 +36,7 @@ import org.junit.*; import org.junit.rules.TemporaryFolder; /** - * Tests for joint mirroring of units and artifacts. See other test classes for unit-only and artifact-only mirroring tests. + * Tests for joint mirroring of units and artifacts. See other test classes for unit-only and artifact-only mirroring tests. */ public class MirrorApplicationTest { @@ -93,7 +93,7 @@ public class MirrorApplicationTest { } private static Set<String> artifactsIn(IArtifactRepository repository) { - Set<String> result = new HashSet<String>(); + Set<String> result = new HashSet<>(); for (IArtifactKey artifactKey : repository.query(QueryUtil.createMatchQuery(IArtifactKey.class, "true"), null).toUnmodifiableSet()) { result.add(artifactKey.getId()); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java index 9963265e6..c61c2db8d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Red Hat Inc. - Bug 460967 @@ -56,9 +56,7 @@ public class NewMirrorApplicationArtifactTest extends AbstractProvisioningTest { protected File sourceRepo3Location; //helloworldfeature + yetanotherfeature protected File sourceRepo4Location; //helloworldfeature v1.0.1 - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#setUp() - */ + @Override @Before public void setUp() throws Exception { super.setUp(); @@ -73,9 +71,7 @@ public class NewMirrorApplicationArtifactTest extends AbstractProvisioningTest { delete(destRepoLocation); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#tearDown() - */ + @Override @After public void tearDown() throws Exception { //remove all the repositories @@ -1303,14 +1299,17 @@ public class NewMirrorApplicationArtifactTest extends AbstractProvisioningTest { manager.removeRepository(srcLocation); } + @Override public synchronized Iterator<IArtifactKey> everything() { return ((SimpleArtifactRepository) source).everything(); } + @Override public synchronized IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { return source.getArtifactDescriptors(key); } + @Override public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { if (firstAttempt) { firstAttempt = false; @@ -1320,10 +1319,12 @@ public class NewMirrorApplicationArtifactTest extends AbstractProvisioningTest { return source.getRawArtifact(descriptor, destination, monitor); } + @Override public synchronized boolean contains(IArtifactDescriptor descriptor) { return source.contains(descriptor); } + @Override public synchronized IQueryResult query(IQuery query, IProgressMonitor monitor) { return source.query(query, monitor); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java index 863c329f5..134e641e2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -41,9 +41,7 @@ public class NewMirrorApplicationMetadataTest extends AbstractProvisioningTest { protected Exception exception = null; - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#setUp() - */ + @Override protected void setUp() throws Exception { super.setUp(); //load all the repositories @@ -58,9 +56,7 @@ public class NewMirrorApplicationMetadataTest extends AbstractProvisioningTest { AbstractProvisioningTest.delete(destRepoLocation); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#tearDown() - */ + @Override protected void tearDown() throws Exception { //remove all the repositories getMetadataRepositoryManager().removeRepository(destRepoLocation.toURI()); @@ -76,9 +72,9 @@ public class NewMirrorApplicationMetadataTest extends AbstractProvisioningTest { } /** - * Runs mirror application with default arguments. source is the source repo, + * Runs mirror application with default arguments. source is the source repo, * destination is the destination repo, append is if the "-writeMode clean" argument should be excluded - * + * * Note: We use URL here because command line applications traffic in unencoded URLs, * so we can't use java.net.URI which will always use the encoded form */ @@ -316,7 +312,7 @@ public class NewMirrorApplicationMetadataTest extends AbstractProvisioningTest { } /** - * Tests mirroring all metadata in a repository to an empty repository + * Tests mirroring all metadata in a repository to an empty repository * Source contains A, B * Target contains * Expected is A, B diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java index a98020b1a..72d9994d8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -28,6 +28,7 @@ public class MetadataRepositoryPerformanceTest extends ProvisioningPerformanceTe protected File repoLocation; IMetadataRepository repository; + @Override protected void setUp() throws Exception { super.setUp(); String tempDir = System.getProperty("java.io.tmpdir"); @@ -38,6 +39,7 @@ public class MetadataRepositoryPerformanceTest extends ProvisioningPerformanceTe repository = manager.createRepository(repoLocation.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); } + @Override protected void tearDown() throws Exception { getMetadataRepositoryManager().removeRepository(repoLocation.toURI()); delete(repoLocation); @@ -49,6 +51,7 @@ public class MetadataRepositoryPerformanceTest extends ProvisioningPerformanceTe new PerformanceTestRunner() { IQuery[] queries = new IQuery[IU_COUNT]; + @Override protected void setUp() { List<IInstallableUnit> ius = new ArrayList(IU_COUNT); for (int i = 0; i < IU_COUNT; i++) { @@ -59,9 +62,11 @@ public class MetadataRepositoryPerformanceTest extends ProvisioningPerformanceTe repository.addInstallableUnits(ius); } + @Override protected void tearDown() { } + @Override protected void test() { for (int i = 0; i < queries.length; i++) { repository.query(queries[i], null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/PublisherPerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/PublisherPerformanceTest.java index 646a1afd9..6f61a75ce 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/PublisherPerformanceTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/PublisherPerformanceTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -29,6 +29,7 @@ public class PublisherPerformanceTest extends ProvisioningPerformanceTest { IQuery[] queries = new IQuery[IU_COUNT]; PublisherResult result; + @Override protected void setUp() { IInstallableUnit[] ius = new IInstallableUnit[IU_COUNT]; result = new PublisherResult(); @@ -39,9 +40,11 @@ public class PublisherPerformanceTest extends ProvisioningPerformanceTest { } } + @Override protected void tearDown() { } + @Override protected void test() { for (int i = 0; i < queries.length; i++) { result.query(queries[i], null); @@ -56,6 +59,7 @@ public class PublisherPerformanceTest extends ProvisioningPerformanceTest { IQuery[] queries = new IQuery[IU_COUNT]; PublisherResult result; + @Override protected void setUp() { IInstallableUnit[] ius = new IInstallableUnit[IU_COUNT]; result = new PublisherResult(); @@ -66,9 +70,11 @@ public class PublisherPerformanceTest extends ProvisioningPerformanceTest { } } + @Override protected void tearDown() { } + @Override protected void test() { for (int i = 0; i < queries.length; i++) { result.query(queries[i], null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbstractPlannerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbstractPlannerTest.java index 46758010b..08f77590a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbstractPlannerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AbstractPlannerTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2010, 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -46,11 +46,11 @@ public abstract class AbstractPlannerTest extends AbstractProvisioningTest { } /* - * Take the given plan and compress additons/removals so they look like updates. + * Take the given plan and compress additons/removals so they look like updates. * Good for viewing while debugging. */ protected Collection compress(IProvisioningPlan plan) { - Map<String, InstallableUnitOperand> result = new HashMap<String, InstallableUnitOperand>(); + Map<String, InstallableUnitOperand> result = new HashMap<>(); Operand[] operands = ((ProvisioningPlan) plan).getOperands(); for (int i = 0; i < operands.length; i++) { if (!(operands[i] instanceof InstallableUnitOperand)) @@ -79,6 +79,7 @@ public abstract class AbstractPlannerTest extends AbstractProvisioningTest { /* (non-Javadoc) * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#setUp() */ + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("loading planner test data", getTestDataPath()); @@ -101,6 +102,7 @@ public abstract class AbstractPlannerTest extends AbstractProvisioningTest { repo = loadMetadataRepository(getTestData("planner test repo", getTestDataPath() + "/repo").toURI()); } + @Override protected void tearDown() throws Exception { SimpleProfileRegistry realProfileRegistry = (SimpleProfileRegistry) getProfileRegistry(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ActualChangeRequestTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ActualChangeRequestTest.java index 8fe8c343b..22ce22b65 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ActualChangeRequestTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ActualChangeRequestTest.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Map; import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -30,6 +29,7 @@ public class ActualChangeRequestTest extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}, NO_PROPERTIES, true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ActualChangeRequestTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ActualChangeRequestTest2.java index a968dcd04..f6f5d494e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ActualChangeRequestTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ActualChangeRequestTest2.java @@ -1,20 +1,20 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Map; import org.eclipse.core.runtime.IStatus; -import org.eclipse.equinox.internal.provisional.p2.director.*; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; +import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; +import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -31,6 +31,7 @@ public class ActualChangeRequestTest2 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}, NO_PROPERTIES, true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AddIUProperty.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AddIUProperty.java index 8ef75cb88..81719c5a1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AddIUProperty.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AddIUProperty.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.director.SimplePlanner; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery; @@ -29,6 +28,7 @@ public class AddIUProperty extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java index 102bc7f84..86f419aec 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AdditionalConstraints.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -28,6 +28,7 @@ public class AdditionalConstraints extends AbstractProvisioningTest { IProfile profile; IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 4.0.0)"))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInExternalInstance.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInExternalInstance.java index 620149545..24f8a99c4 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInExternalInstance.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInExternalInstance.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2009, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.lang.reflect.Field; import java.net.URI; import java.util.Properties; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -22,6 +21,7 @@ import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; public class AgentPlanTestInExternalInstance extends AbstractProvisioningTest { + @Override public void setUp() throws Exception { super.setUp(); @@ -41,6 +41,7 @@ public class AgentPlanTestInExternalInstance extends AbstractProvisioningTest { createProfile("installation", p); } + @Override public void tearDown() throws Exception { SimpleProfileRegistry profileRegistry = (SimpleProfileRegistry) getProfileRegistry(); try { @@ -283,7 +284,7 @@ public class AgentPlanTestInExternalInstance extends AbstractProvisioningTest { request3.removeInstallableUnits(new IInstallableUnit[] {a111}); IProvisioningPlan plan3 = planner.getProvisioningPlan(request3, ctx, new NullProgressMonitor()); // assertOK("install actions", engine.perform(getProfile("agent"), new PhaseSetFactory(), plan3.getInstallerPlan().getOperands(), null, null)); - // assertProfileContainsAll("Checking profile after install of actions", getProfile("agent"), new IInstallableUnit[] {act1b}); //At this point there is not + // assertProfileContainsAll("Checking profile after install of actions", getProfile("agent"), new IInstallableUnit[] {act1b}); //At this point there is not assertOK("install A", engine.perform(plan3, null)); assertProfileContainsAll("Checking profile after install of actions", getProfile("installation"), new IInstallableUnit[] {c, b}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInExternalInstanceForCohostedMode.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInExternalInstanceForCohostedMode.java index 68d65ed8e..d2eb3c91a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInExternalInstanceForCohostedMode.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInExternalInstanceForCohostedMode.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2009, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.lang.reflect.Field; import java.net.URI; import java.util.Properties; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -22,6 +21,7 @@ import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; public class AgentPlanTestInExternalInstanceForCohostedMode extends AbstractProvisioningTest { + @Override public void setUp() throws Exception { super.setUp(); @@ -41,6 +41,7 @@ public class AgentPlanTestInExternalInstanceForCohostedMode extends AbstractProv createProfile("installation", p); } + @Override public void tearDown() throws Exception { SimpleProfileRegistry profileRegistry = (SimpleProfileRegistry) getProfileRegistry(); try { @@ -283,7 +284,7 @@ public class AgentPlanTestInExternalInstanceForCohostedMode extends AbstractProv request3.removeInstallableUnits(new IInstallableUnit[] {a111}); IProvisioningPlan plan3 = planner.getProvisioningPlan(request3, ctx, new NullProgressMonitor()); // assertOK("install actions", engine.perform(getProfile("agent"), new PhaseSetFactory(), plan3.getInstallerPlan().getOperands(), null, null)); - // assertProfileContainsAll("Checking profile after install of actions", getProfile("agent"), new IInstallableUnit[] {act1b}); //At this point there is not + // assertProfileContainsAll("Checking profile after install of actions", getProfile("agent"), new IInstallableUnit[] {act1b}); //At this point there is not assertOK("install A", engine.perform(plan3, null)); assertProfileContainsAll("Checking profile after install of actions", getProfile("installation"), new IInstallableUnit[] {c, b, act2}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInRunningInstance.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInRunningInstance.java index 56dad2416..c8b499dd2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInRunningInstance.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AgentPlanTestInRunningInstance.java @@ -1,17 +1,16 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2009, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.net.URI; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.PlanExecutionHelper; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -22,6 +21,7 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; public class AgentPlanTestInRunningInstance extends AbstractProvisioningTest { private IProfile initialProfile = null; + @Override public void setUp() throws Exception { super.setUp(); @@ -32,6 +32,7 @@ public class AgentPlanTestInRunningInstance extends AbstractProvisioningTest { setUpSelfProfile(); } + @Override public void tearDown() throws Exception { if (initialProfile == null) { tearDownSelfProfile(); @@ -267,7 +268,7 @@ public class AgentPlanTestInRunningInstance extends AbstractProvisioningTest { IProvisioningPlan plan3 = planner.getProvisioningPlan(request3, ctx, new NullProgressMonitor()); // assertNull(plan3.getInstallerPlan()); //TODO assertOK("install actions", engine.perform(plan3.getInstallerPlan(), null)); - assertProfileContainsAll("Checking profile after install of actions", getProfile(IProfileRegistry.SELF), new IInstallableUnit[] {act1b}); //At this point there is not + assertProfileContainsAll("Checking profile after install of actions", getProfile(IProfileRegistry.SELF), new IInstallableUnit[] {act1b}); //At this point there is not assertOK("install A", engine.perform(plan3, null)); assertProfileContainsAll("Checking profile after install of actions", getProfile(IProfileRegistry.SELF), new IInstallableUnit[] {c, b, act2}); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOptional.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOptional.java index 4c7e81be8..917c87c4a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOptional.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOptional.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -26,6 +25,7 @@ public class AllOptional extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); IRequirement[] reqA = new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", VersionRange.emptyRange, null, false, false, true)}; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java index ecb22d5be..d3629cd41 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AllOrbit.java @@ -1,9 +1,9 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; @@ -29,6 +29,7 @@ public class AllOrbit extends AbstractProvisioningTest { IEngine engine; IMetadataRepository repo; + @Override protected void setUp() throws Exception { super.setUp(); IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AnotherSingleton.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AnotherSingleton.java index 7f3243b2d..16589e3af 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AnotherSingleton.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/AnotherSingleton.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -28,6 +27,7 @@ public class AnotherSingleton extends AbstractProvisioningTest { IPlanner planner; IProfile profile; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug207319.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug207319.java index e0448bd17..c14bcf6a5 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug207319.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug207319.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; @@ -23,6 +22,7 @@ public class Bug207319 extends AbstractProvisioningTest { IDirector director; IProfile profile; + @Override protected void setUp() throws Exception { super.setUp(); a = createIU("A", Version.create("1.0.0")); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug249605.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug249605.java index 0dec03584..45d9d07f3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug249605.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug249605.java @@ -1,20 +1,19 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.HashMap; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery; import org.eclipse.equinox.p2.metadata.*; @@ -30,6 +29,7 @@ public class Bug249605 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252638.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252638.java index 6d6fac99e..fbdfd0d9f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252638.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252638.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -29,6 +28,7 @@ public class Bug252638 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252682.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252682.java index 7567b6eaa..3fbe0e29b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252682.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug252682.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,6 +27,7 @@ public class Bug252682 extends AbstractProvisioningTest { IProfile profile = null; ArrayList newIUs = new ArrayList(); + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("test data bug 252682", "testData/bug252682"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java index bad44a831..d91ec0dac 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet1.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; @@ -29,6 +28,7 @@ public class Bug254481dataSet1 extends AbstractProvisioningTest { IProfile profile = null; IMetadataRepository repo = null; + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("test data bug 254481", "testData/bug254481/dataSet1/profileRegistry"); @@ -41,6 +41,7 @@ public class Bug254481dataSet1 extends AbstractProvisioningTest { assertNotNull(repo); } + @Override protected void tearDown() throws Exception { getMetadataRepositoryManager().removeRepository(getTestData("test data bug 254481", "testData/bug254481/dataSet1/repo").toURI()); super.tearDown(); @@ -56,11 +57,11 @@ public class Bug254481dataSet1 extends AbstractProvisioningTest { IPlanner planner = createPlanner(); IProvisioningPlan plan = planner.getProvisioningPlan(request, null, new NullProgressMonitor()); assertInstallOperand(plan, patch); - //[[R]com.ibm.rational.test.lt.arm 7.0.250.v200810021504 --> [R]com.ibm.rational.test.lt.arm 7.0.300.200811041300, + //[[R]com.ibm.rational.test.lt.arm 7.0.250.v200810021504 --> [R]com.ibm.rational.test.lt.arm 7.0.300.200811041300, assertEquals(1, queryResultSize(plan.getAdditions().query(QueryUtil.createIUQuery("com.ibm.rational.test.lt.arm"), null))); - //[R]com.ibm.rational.test.lt.armbroker 7.0.250.v200810021504 --> [R]com.ibm.rational.test.lt.armbroker 7.0.300.200811041300, + //[R]com.ibm.rational.test.lt.armbroker 7.0.250.v200810021504 --> [R]com.ibm.rational.test.lt.armbroker 7.0.300.200811041300, assertEquals(1, queryResultSize(plan.getAdditions().query(QueryUtil.createIUQuery("com.ibm.rational.test.lt.armbroker"), null))); - //[R]com.ibm.rational.test.lt.kernel 7.2.151.v200810021605 --> [R]com.ibm.rational.test.lt.kernel 7.2.200.200811041300, + //[R]com.ibm.rational.test.lt.kernel 7.2.151.v200810021605 --> [R]com.ibm.rational.test.lt.kernel 7.2.200.200811041300, assertEquals(1, queryResultSize(plan.getAdditions().query(QueryUtil.createIUQuery("com.ibm.rational.test.lt.kernel"), null))); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java index 384929443..7515827c0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug254481dataSet2.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; @@ -29,6 +28,7 @@ public class Bug254481dataSet2 extends AbstractProvisioningTest { IProfile profile = null; IMetadataRepository repo = null; + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("test data bug 254481", "testData/bug254481/dataSet2/profileRegistry"); @@ -41,6 +41,7 @@ public class Bug254481dataSet2 extends AbstractProvisioningTest { assertNotNull(repo); } + @Override protected void tearDown() throws Exception { getMetadataRepositoryManager().removeRepository(getTestData("test data bug 254481", "testData/bug254481/dataSet2/repo").toURI()); super.tearDown(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug255984.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug255984.java index 908f8f47f..d276a3be7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug255984.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug255984.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery; import org.eclipse.equinox.p2.metadata.*; @@ -30,6 +29,7 @@ public class Bug255984 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}, NO_PROPERTIES, true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug259537.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug259537.java index 66437a473..07af0a977 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug259537.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug259537.java @@ -1,17 +1,16 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; import org.eclipse.equinox.p2.engine.IEngine; import org.eclipse.equinox.p2.engine.IProfile; @@ -31,6 +30,7 @@ public class Bug259537 extends AbstractProvisioningTest { private IEngine engine; private String profileId; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug270656.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug270656.java index 7ce3f3d40..c7d6e2a5a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug270656.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug270656.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -28,6 +27,7 @@ public class Bug270656 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, true, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug270683.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug270683.java index fca413083..77ff477f1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug270683.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug270683.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; import org.eclipse.equinox.p2.engine.IEngine; @@ -33,6 +32,7 @@ public class Bug270683 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271067.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271067.java index 02da353d1..a569341f5 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271067.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271067.java @@ -1,20 +1,19 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import java.lang.reflect.Field; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -31,6 +30,7 @@ public class Bug271067 extends AbstractProvisioningTest { String profileLoadedId = "bootProfile"; IMetadataRepository repo = null; + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("test data bug 271067", "testData/bug271067/profileRegistry"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java index dd1b8d2c0..48c52b0b2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug271954.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -29,6 +29,7 @@ public class Bug271954 extends AbstractProvisioningTest { private File previousStoreValue = null; private Object previousSelfProfile = null; + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("test data bug 271954", "testData/bug271954"); @@ -55,6 +56,7 @@ public class Bug271954 extends AbstractProvisioningTest { profile = realProfileRegistry.getProfile(profileLoadedId); } + @Override protected void tearDown() throws Exception { SimpleProfileRegistry realProfileRegistry = (SimpleProfileRegistry) getProfileRegistry(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug272251.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug272251.java index 36a9b4edb..df5100c54 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug272251.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug272251.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; @@ -30,6 +29,7 @@ public class Bug272251 extends AbstractProvisioningTest { IProfile profile = null; IMetadataRepository repo = null; + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("test data bug 272251", "testData/bug272251/profileRegistry/"); @@ -42,6 +42,7 @@ public class Bug272251 extends AbstractProvisioningTest { assertNotNull(repo); } + @Override protected void tearDown() throws Exception { getMetadataRepositoryManager().removeRepository(getTestData("test data bug 272251", "testData/bug272251/repo").toURI()); super.tearDown(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java index f065207f2..99c1d805a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug278668.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -10,11 +10,10 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.ArrayList; import java.util.Properties; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -28,6 +27,7 @@ public class Bug278668 extends AbstractProvisioningTest { private IProfile profile; private IMetadataRepository repo; + @Override protected void setUp() throws Exception { super.setUp(); profile = createProfile("test278668"); @@ -69,6 +69,7 @@ public class Bug278668 extends AbstractProvisioningTest { repo = getMetadataRepositoryManager().loadRepository(getTestData("test data bug 278668", "testData/bug278668").toURI(), null); } + @Override protected void tearDown() throws Exception { getMetadataRepositoryManager().removeRepository(getTestData("test data bug 278668", "testData/bug278668").toURI()); super.tearDown(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java index 54f7e7626..cfd7b2d4c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300104.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.core.*; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -31,6 +30,7 @@ public class Bug300104 extends AbstractProvisioningTest { IProvisioningAgent agent = null; private IProfileRegistry profileRegistry; + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("test data bug 300104", "testData/bug300104/p2"); @@ -143,8 +143,8 @@ public class Bug300104 extends AbstractProvisioningTest { } private void applyHelloPatch2() throws ProvisionException { - // install newer version of feature patch which updates - // hello to version 1.0.1 with later qualifier and + // install newer version of feature patch which updates + // hello to version 1.0.1 with later qualifier and // adds unit hello2 1.0.0 /* <unit id='hellopatch.feature.group' version='1.0.1.200911201358' singleton='false'> diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small.java index 4910fee57..1679b2b70 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype, Inc and others. + * Copyright (c) 2010, 2017 Sonatype, Inc 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -30,6 +29,7 @@ public class Bug300572Small extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); //A depends on B diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small2.java index c5a58c193..ca11db5f3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small2.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype, Inc and others. + * Copyright (c) 2010, 2017 Sonatype, Inc 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -31,6 +30,7 @@ public class Bug300572Small2 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); IMetadataRepository repo = getMetadataRepositoryManager().loadRepository(getTestData("bug300572 data", "testData/bug300572Small/repo/").toURI(), new NullProgressMonitor()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small3.java index cb3671c5a..9771857df 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small3.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype, Inc and others. + * Copyright (c) 2010, 2017 Sonatype, Inc 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -36,6 +35,7 @@ public class Bug300572Small3 extends AbstractProvisioningTest { // private IInstallableUnit p2c; + @Override protected void setUp() throws Exception { super.setUp(); IMetadataRepository repo = getMetadataRepositoryManager().loadRepository(getTestData("bug300572 data", "testData/bug300572Small/repo/").toURI(), new NullProgressMonitor()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small4.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small4.java index f9bc9db56..d0bd6ce70 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small4.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small4.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype, Inc and others. + * Copyright (c) 2010, 2017 Sonatype, Inc 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -20,7 +19,7 @@ import org.eclipse.equinox.p2.planner.ProfileInclusionRules; import org.eclipse.equinox.p2.query.QueryUtil; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; -//This test verify that one patch can replace another one. +//This test verify that one patch can replace another one. public class Bug300572Small4 extends AbstractProvisioningTest { IInstallableUnit a1; IInstallableUnit b2, b3; @@ -30,6 +29,7 @@ public class Bug300572Small4 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); //A depends on B diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small5.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small5.java index 6f7a3faa0..018ba5bf7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small5.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small5.java @@ -1,24 +1,23 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype, Inc and others. + * Copyright (c) 2010, 2017 Sonatype, Inc 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; -//This test verify that one patch can replace another one. +//This test verify that one patch can replace another one. public class Bug300572Small5 extends AbstractProvisioningTest { IInstallableUnit a1; IInstallableUnitPatch p1, p2; @@ -27,6 +26,7 @@ public class Bug300572Small5 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); //A depends on B diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small6.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small6.java index 40079762d..21bc0a8e8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small6.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572Small6.java @@ -1,24 +1,23 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype, Inc and others. + * Copyright (c) 2010, 2017 Sonatype, Inc 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; -//This test verify that one patch can replace another one. +//This test verify that one patch can replace another one. public class Bug300572Small6 extends AbstractProvisioningTest { IInstallableUnit a1, b1, b2, x; IInstallableUnitPatch p1; @@ -27,6 +26,7 @@ public class Bug300572Small6 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); //A depends on B diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug301446.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug301446.java index f7e19f5ee..cc656c55d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug301446.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug301446.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -36,11 +36,13 @@ public class Bug301446 extends AbstractPlannerTest { } // path to our data + @Override protected String getTestDataPath() { return "testData/bug301446"; } // profile id + @Override protected String getProfileId() { return "bootProfile"; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582.java index 55ceab82f..6ca7a6488 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -21,11 +21,13 @@ import org.eclipse.equinox.p2.query.QueryUtil; public class Bug302582 extends AbstractPlannerTest { // path to our data + @Override protected String getTestDataPath() { return "testData/bug302582"; } // profile id + @Override protected String getProfileId() { return "bootProfile"; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582c.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582c.java index adacf59a0..2d1688acd 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582c.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582c.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -19,17 +19,11 @@ import org.eclipse.equinox.p2.query.IQueryResult; import org.eclipse.equinox.p2.query.QueryUtil; public class Bug302582c extends Bug302582 { - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.planner.Bug302582#getProfileId() - */ @Override protected String getProfileId() { return "PlatformProfile"; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.planner.Bug302582#getTestDataPath() - */ @Override protected String getTestDataPath() { return "testData/bug302582c"; @@ -38,10 +32,11 @@ public class Bug302582c extends Bug302582 { /* * Profile already contains a single optional singleton IU. Try to install 3 versions of that IU into it. (including the lower * version which is already installed) - * + * * (non-Javadoc) * @see org.eclipse.equinox.p2.tests.planner.Bug302582#testInstall() */ + @Override public void testInstall() { IPlanner planner = createPlanner(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java index 4dd9eae1f..99e5d0522 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug302582d.java @@ -1,20 +1,19 @@ /*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 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
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.p2.tests.planner;
-import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
-
import java.io.File;
import java.util.Iterator;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.p2.core.*;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
@@ -34,6 +33,7 @@ public class Bug302582d extends AbstractProvisioningTest { IProvisioningAgent agent = null;
private IProfileRegistry profileRegistry;
+ @Override
protected void setUp() throws Exception {
super.setUp();
File reporegistry1 = getTestData("test data bug 302582d", "testData/bug302582d/p2");
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306279d.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306279d.java index c35d57a20..ef9daa78e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306279d.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306279d.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype, Inc and others. + * Copyright (c) 2010, 2017 Sonatype, Inc 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation * IBM Corporation - ongoing development @@ -30,7 +30,7 @@ public class Bug306279d extends AbstractProvisioningTest { b2 = createIU("B", Version.createOSGi(2, 0, 0)); b3 = createIU("B", Version.createOSGi(3, 0, 0)); - //A -ng-> B + //A -ng-> B IRequirement[] reqB = new IRequirement[1]; reqB[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", VersionRange.emptyRange, null, true, false, false); a = createIU("A", Version.create("1.0.0"), reqB); @@ -62,7 +62,7 @@ public class Bug306279d extends AbstractProvisioningTest { IRequirement negationX = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "X", VersionRange.emptyRange, null, 0, 0, false); IRequirement negationY = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "Y", VersionRange.emptyRange, null, 0, 0, false); - Collection<IRequirement> req = new ArrayList<IRequirement>(); + Collection<IRequirement> req = new ArrayList<>(); req.add(negationX); req.add(negationY); pcr.addExtraRequirements(req); @@ -77,7 +77,7 @@ public class Bug306279d extends AbstractProvisioningTest { IPlanner planner = createPlanner(); IProfile profile = createProfile(getUniqueString()); - //Here we create a request that request the installation of A, X and Y. + //Here we create a request that request the installation of A, X and Y. IProfileChangeRequest pcr = planner.createChangeRequest(profile); pcr.add(a); pcr.add(x); @@ -87,7 +87,7 @@ public class Bug306279d extends AbstractProvisioningTest { //Negate Y to prevent its installation IRequirement negationY = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "Y", VersionRange.emptyRange, null, 0, 0, false); - Collection<IRequirement> req = new ArrayList<IRequirement>(); + Collection<IRequirement> req = new ArrayList<>(); req.add(negationY); pcr.addExtraRequirements(req); @@ -101,7 +101,7 @@ public class Bug306279d extends AbstractProvisioningTest { IPlanner planner = createPlanner(); IProfile profile = createProfile(getUniqueString()); - //Here we create a request that request the installation of A, X and Y. + //Here we create a request that request the installation of A, X and Y. IProfileChangeRequest pcr = planner.createChangeRequest(profile); pcr.add(a); pcr.add(x); @@ -111,7 +111,7 @@ public class Bug306279d extends AbstractProvisioningTest { //Negate X to prevent its installation IRequirement negationX = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "X", VersionRange.emptyRange, null, 0, 0, false); - Collection<IRequirement> req = new ArrayList<IRequirement>(); + Collection<IRequirement> req = new ArrayList<>(); req.add(negationX); pcr.addExtraRequirements(req); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306424.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306424.java index fe15f8036..c29a7822c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306424.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug306424.java @@ -1,22 +1,21 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collection; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -34,6 +33,7 @@ public class Bug306424 extends AbstractProvisioningTest { return "testData/bug306424"; } + @Override protected void tearDown() throws Exception { SimpleProfileRegistry realProfileRegistry = (SimpleProfileRegistry) getProfileRegistry(); @@ -47,10 +47,7 @@ public class Bug306424 extends AbstractProvisioningTest { super.tearDown(); } - /* - * /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#setUp() - */ + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("loading planner test data", getTestDataPath()); @@ -80,7 +77,7 @@ public class Bug306424 extends AbstractProvisioningTest { changeRequest.remove(b); IRequirement negateB = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, b.getId(), new VersionRange(b.getVersion(), true, b.getVersion(), true), null, 0, 0, false); - Collection<IRequirement> extraReqs = new ArrayList<IRequirement>(); + Collection<IRequirement> extraReqs = new ArrayList<>(); extraReqs.add(negateB); changeRequest.addExtraRequirements(extraReqs); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309530.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309530.java index d9dc53435..3e80e79e6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309530.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug309530.java @@ -1,20 +1,19 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import java.lang.reflect.Field; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -31,6 +30,7 @@ public class Bug309530 extends AbstractProvisioningTest { return "testData/bug309530"; } + @Override protected void tearDown() throws Exception { SimpleProfileRegistry realProfileRegistry = (SimpleProfileRegistry) getProfileRegistry(); @@ -48,6 +48,7 @@ public class Bug309530 extends AbstractProvisioningTest { * /* (non-Javadoc) * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#setUp() */ + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("loading planner test data", getTestDataPath()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java index e884cca29..79ff8e786 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug362692.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -25,24 +25,26 @@ import org.eclipse.equinox.p2.tests.TestActivator; public class Bug362692 extends AbstractPlannerTest { // path to our data + @Override protected String getTestDataPath() { return "testData/bug362692"; } // profile id + @Override protected String getProfileId() { return "bootProfile"; } /* - * Test data registry profiles 1320939990376 - * Already installed - A1.1.1 B1.1.1 C1.1.2 D1.1.4 E1.1.4 + * Test data registry profiles 1320939990376 + * Already installed - A1.1.1 B1.1.1 C1.1.2 D1.1.4 E1.1.4 */ public void testInstall() { IPlanner planner = createPlanner(); // this is the set of IUs we expect in the final result - highest version only - Set<IInstallableUnit> expected = new HashSet<IInstallableUnit>(); + Set<IInstallableUnit> expected = new HashSet<>(); IQueryResult queryResult = repo.query(QueryUtil.createIUQuery("PluginA", Version.createOSGi(1, 1, 1, null)), new NullProgressMonitor()); expected.addAll(queryResult.toSet()); queryResult = repo.query(QueryUtil.createIUQuery("PluginB", Version.createOSGi(1, 1, 2, null)), new NullProgressMonitor()); @@ -55,7 +57,7 @@ public class Bug362692 extends AbstractPlannerTest { expected.addAll(queryResult.toSet()); // create the actual plan - install everything in the repo as optional (mimic the dropins folder) - Set<IInstallableUnit> toAdd = new HashSet<IInstallableUnit>(); + Set<IInstallableUnit> toAdd = new HashSet<>(); IQueryResult allIUs = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()); // we don't want to re-install units which are already installed in the profile so remove them. (this is what the reconciler does) boolean already = false; @@ -78,7 +80,7 @@ public class Bug362692 extends AbstractPlannerTest { // toAdd.addAll(getProfile().query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()).toSet()); // set the metadata repositories on the provisioning context. one for the dropins and one for the shared area - Collection<URI> repoURLs = new ArrayList<URI>(); + Collection<URI> repoURLs = new ArrayList<>(); repoURLs.add(repo.getLocation()); repoURLs.add(new Path(getTestDataPath()).append("shared").toFile().toURI()); ProvisioningContext context = getContext(repoURLs); @@ -95,7 +97,7 @@ public class Bug362692 extends AbstractPlannerTest { } /* - * All of the expected IUs should either already be installed in the profile (and not be removed) + * All of the expected IUs should either already be installed in the profile (and not be removed) * or in the list of additions. */ private void validate(Collection<IInstallableUnit> expected, Collection<IInstallableUnit> toAdd) { @@ -117,7 +119,7 @@ public class Bug362692 extends AbstractPlannerTest { } /* - * All of the expected IUs should either already be installed in the profile (and not be removed) + * All of the expected IUs should either already be installed in the profile (and not be removed) * or in the plan as an addition. */ private void validate(Collection<IInstallableUnit> expected, IProvisioningPlan plan) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug365124.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug365124.java index 122ddc118..3ec71c893 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug365124.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug365124.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -21,11 +21,13 @@ import org.eclipse.equinox.p2.query.QueryUtil; public class Bug365124 extends AbstractPlannerTest { // path to our data + @Override protected String getTestDataPath() { return "testData/bug365124"; } // profile id + @Override protected String getProfileId() { return "PlatformProfile"; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DependencyOnSelf.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DependencyOnSelf.java index 7bda2df24..e98c573d7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DependencyOnSelf.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DependencyOnSelf.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -24,6 +23,7 @@ public class DependencyOnSelf extends AbstractProvisioningTest { IPlanner planner; IProfile profile; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.0.0]"))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DisabledExplanation.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DisabledExplanation.java index 644bf7015..ca7322a76 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DisabledExplanation.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DisabledExplanation.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; import org.eclipse.equinox.p2.engine.IProfile; @@ -27,6 +26,7 @@ public class DisabledExplanation extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DropinsScenario.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DropinsScenario.java index 33cd9fe30..4a0f8b732 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DropinsScenario.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/DropinsScenario.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -27,6 +26,7 @@ public class DropinsScenario extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java index 31524cc2e..c0cbfde04 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/EPPPackageInstallStability_bug323322.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype Corporation and others. + * Copyright (c) 2010, 2017 Sonatype 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 @@ -32,12 +32,12 @@ public class EPPPackageInstallStability_bug323322 extends AbstractProvisioningTe repoMgr.addRepository(getTestData("Helios SR0", "testData/helios-sr0/").toURI()); IPlanner planner = (IPlanner) agent.getService(IPlanner.SERVICE_NAME); - Map<String, String> profileArgs = new HashMap<String, String>(); + Map<String, String> profileArgs = new HashMap<>(); profileArgs.put("osgi.os", "linux"); profileArgs.put("osgi.ws", "gtk"); profileArgs.put("osgi.arch", "x86"); - Set<IInstallableUnit> iusFromFirstResolution = new HashSet<IInstallableUnit>(); + Set<IInstallableUnit> iusFromFirstResolution = new HashSet<>(); { IProfile eppProfile1 = ((IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME)).addProfile("epp.install.1", profileArgs); IProfileChangeRequest request = planner.createChangeRequest(eppProfile1); @@ -70,7 +70,7 @@ public class EPPPackageInstallStability_bug323322 extends AbstractProvisioningTe assertOK("plan is not ok", plan.getStatus()); Set tmp = plan.getAdditions().query(QueryUtil.ALL_UNITS, new NullProgressMonitor()).query(QueryUtil.ALL_UNITS, null).toSet(); - Set<IInstallableUnit> iusFromSecondResolution = new HashSet<IInstallableUnit>(); + Set<IInstallableUnit> iusFromSecondResolution = new HashSet<>(); for (Iterator iterator = tmp.iterator(); iterator.hasNext();) { IInstallableUnit iu = (IInstallableUnit) iterator.next(); iusFromSecondResolution.add(iu.unresolved()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationLargeConflict.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationLargeConflict.java index dede14f5d..c51903c58 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationLargeConflict.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationLargeConflict.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 @@ -10,10 +10,9 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; @@ -30,6 +29,7 @@ public class ExplanationLargeConflict extends AbstractProvisioningTest { private IPlanner planner; private IProfile SDKprofile; + @Override protected void setUp() throws Exception { super.setUp(); repo1 = loadMetadataRepository(getTestData("repo1", "testData/testLargeConflict/repo1").toURI()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationTest.java index 507bcef6f..975b455af 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ExplanationTest.java @@ -1,10 +1,10 @@ /*******************************************************************************
- * Copyright (c) 2011 SAP AG. and others.
+ * Copyright (c) 2011, 2017 SAP AG. 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
- *
+ *
* Contributors:
* SAP AG. - initial API and implementation
*******************************************************************************/
@@ -22,6 +22,7 @@ public class ExplanationTest extends AbstractProvisioningTest { IInstallableUnit c;
IPlanner planner;
+ @Override
protected void setUp() throws Exception {
super.setUp();
root = createIU("root", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "missing", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "C", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}, NO_PROPERTIES, true);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java index b1b20a11e..7a0cecdcc 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindRootsAfterUpdate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Sonatype, Inc. and others. All rights reserved. This + * Copyright (c) 2011, 2017 Sonatype, Inc. 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 @@ -28,6 +28,7 @@ public class FindRootsAfterUpdate extends AbstractProvisioningTest { IProfile profile; IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 4.0.0)"))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindingPatchesThroughUpdates.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindingPatchesThroughUpdates.java index 6b58d7d81..5e7bc1526 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindingPatchesThroughUpdates.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/FindingPatchesThroughUpdates.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,6 +27,7 @@ public class FindingPatchesThroughUpdates extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0")); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/GreedyRequirement.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/GreedyRequirement.java index 9aded5a40..77462eedb 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/GreedyRequirement.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/GreedyRequirement.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -24,6 +23,7 @@ public class GreedyRequirement extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); b1 = createIU("B", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUProperties.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUProperties.java index 3f0e04b09..d610ab1b4 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUProperties.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUProperties.java @@ -1,17 +1,16 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery; @@ -30,6 +29,7 @@ public class IUProperties extends AbstractProvisioningTest { private IEngine engine; private String profileId; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B1", new VersionRange("[1.0.0, 2.0.0)"))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUPropertyRemoval.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUPropertyRemoval.java index fe0bc87f9..79093f966 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUPropertyRemoval.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUPropertyRemoval.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery; @@ -27,6 +26,7 @@ public class IUPropertyRemoval extends AbstractProvisioningTest { private IEngine engine; private String profileId; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B1", new VersionRange("[1.0.0, 2.0.0)"))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter.java index 49dfa6b7c..9ea3ec3a4 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -24,6 +23,7 @@ public class IUWithFilter extends AbstractProvisioningTest { IPlanner planner; IProfile profile; + @Override protected void setUp() throws Exception { super.setUp(); MetadataFactory.InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter2.java index 0f514fe81..ac8528add 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/IUWithFilter2.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -25,6 +24,7 @@ public class IUWithFilter2 extends AbstractProvisioningTest { IPlanner planner; IProfile profile; + @Override protected void setUp() throws Exception { super.setUp(); IRequirement[] reqs = new IRequirement[1]; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest.java index 3949d939a..c843452fc 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.Version; @@ -30,6 +29,7 @@ public class InclusionRuleTest extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); @@ -119,7 +119,7 @@ public class InclusionRuleTest extends AbstractProvisioningTest { assertProfileContainsAll("A1 or B1 is missing", profile2, new IInstallableUnit[] {a1, b1}); assertEquals(queryResultSize(profile2.query(QueryUtil.createIUAnyQuery(), null)), 2); - //Remove the optional inclusion rule from a1. a1 and b1 are still here + //Remove the optional inclusion rule from a1. a1 and b1 are still here ProfileChangeRequest req5 = new ProfileChangeRequest(profile2); req5.removeInstallableUnitInclusionRules(a1); IProvisioningPlan plan5 = planner.getProvisioningPlan(req5, null, null); @@ -177,7 +177,7 @@ public class InclusionRuleTest extends AbstractProvisioningTest { IProvisioningPlan plan5 = planner.getProvisioningPlan(req5, null, null); assertEquals(IStatus.ERROR, plan5.getStatus().getSeverity()); - //Install a1 and a2 marking a1 optional + //Install a1 and a2 marking a1 optional ProfileChangeRequest req = new ProfileChangeRequest(profile4); req.addInstallableUnits(new IInstallableUnit[] {a1, a2}); req.setInstallableUnitInclusionRules(a1, ProfileInclusionRules.createOptionalInclusionRule(a1)); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest2.java index b1294409d..4f4c815e1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/InclusionRuleTest2.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery; import org.eclipse.equinox.p2.metadata.*; @@ -27,6 +26,7 @@ public class InclusionRuleTest2 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MinimalInstall.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MinimalInstall.java index 13a21d1ad..6c8279bfa 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MinimalInstall.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MinimalInstall.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -27,6 +26,7 @@ public class MinimalInstall extends AbstractProvisioningTest { IProfile profile; IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B1", new VersionRange("[1.0.0, 2.0.0)"))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MinimalInstall2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MinimalInstall2.java index b80679d41..68692290e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MinimalInstall2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MinimalInstall2.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 Sonatype, Inc. and others. + * Copyright (c) 2011, 2017 Sonatype, Inc. 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ @@ -35,6 +35,7 @@ public class MinimalInstall2 extends AbstractProvisioningTest { IProfile profile; IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency.java index 7777216ca..fee90db21 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency.java @@ -1,22 +1,22 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.director.Explanation; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; -import org.eclipse.equinox.internal.provisional.p2.director.*; +import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; +import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -29,6 +29,7 @@ public class MissingDependency extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency2.java index ffaca4367..fb0a6cb05 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency2.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -23,6 +22,7 @@ public class MissingDependency2 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); IRequirement[] reqA = new IRequirement[1]; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency3.java index 4fe0b74f2..774b79361 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingDependency3.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -24,6 +23,7 @@ public class MissingDependency3 extends AbstractProvisioningTest { private IPlanner planner; //This tests that A can still be resolved and installed + @Override protected void setUp() throws Exception { super.setUp(); IRequirement[] reqA = new IRequirement[1]; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement.java index 6e6fc79a4..1180d860e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement.java @@ -1,22 +1,22 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.director.Explanation; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; -import org.eclipse.equinox.internal.provisional.p2.director.*; +import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; +import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -30,6 +30,7 @@ public class MissingNonGreedyRequirement extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); b1 = createIU("B", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement2.java index 4c8dcec2f..80365f54f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingNonGreedyRequirement2.java @@ -1,22 +1,22 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.director.Explanation; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; -import org.eclipse.equinox.internal.provisional.p2.director.*; +import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; +import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -29,6 +29,7 @@ public class MissingNonGreedyRequirement2 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); c1 = createIU("C", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptional.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptional.java index 524c5120a..1bbfbd282 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptional.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptional.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -24,6 +23,7 @@ public class MissingOptional extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalNonGreedyRequirement.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalNonGreedyRequirement.java index 192c101e8..74d967522 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalNonGreedyRequirement.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalNonGreedyRequirement.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -23,6 +22,7 @@ public class MissingOptionalNonGreedyRequirement extends AbstractProvisioningTes private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); b1 = createIU("B", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies.java index 64bdb61ab..dd4685d96 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -24,6 +23,7 @@ public class MissingOptionalWithDependencies extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies2.java index f9ff767bd..4ca2e2169 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies2.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -26,6 +25,7 @@ public class MissingOptionalWithDependencies2 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies3.java index 37c45bfab..a54bd8cae 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MissingOptionalWithDependencies3.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -26,6 +25,7 @@ public class MissingOptionalWithDependencies3 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleProvider.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleProvider.java index b62773cda..7ea99d6d8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleProvider.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleProvider.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -29,6 +28,7 @@ public class MultipleProvider extends AbstractProvisioningTest { IPlanner planner; IProfile profile; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B1", new VersionRange("[1.0.0, 2.0.0)"))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java index bac67a575..97ca52d4f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/MultipleSingleton.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -32,6 +32,7 @@ public class MultipleSingleton extends AbstractProvisioningTest { IPlanner planner; IProfile profile; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); @@ -86,7 +87,7 @@ public class MultipleSingleton extends AbstractProvisioningTest { } /* - * Install both the SDK and Third as roots. + * Install both the SDK and Third as roots. * Both have a dependency on the Platform. * Try to update the SDK. * Operation blocked because Third also depends on Platform. diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java index 875884ad9..277621522 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NegationTesting.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -51,7 +51,7 @@ public class NegationTesting extends AbstractProvisioningTest { // assertTrue(prov.satisfies(req)); // } - //Test the slicer and the resolver. + //Test the slicer and the resolver. public void testNot4() { MetadataFactory.InstallableUnitDescription iud1 = new MetadataFactory.InstallableUnitDescription(); iud1.setId("TestNegation4"); @@ -102,7 +102,7 @@ public class NegationTesting extends AbstractProvisioningTest { //Verify that the installing iu1 and iu3 will result in a conflict since iu3 is excluded by the requirement of iu1 ProfileChangeRequest changeRequest2 = new ProfileChangeRequest(profile); - Collection<IInstallableUnit> toAdd = new ArrayList<IInstallableUnit>(); + Collection<IInstallableUnit> toAdd = new ArrayList<>(); toAdd.add(iu1); toAdd.add(iu3); changeRequest2.addAll(toAdd); @@ -182,7 +182,7 @@ public class NegationTesting extends AbstractProvisioningTest { assertEquals(0, queryResultSize(slice.query(QueryUtil.createIUQuery("ProviderOf1_1_1"), new NullProgressMonitor()))); assertEquals(2, queryResultSize(slice.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()))); - //Verify that the negation can not fail the resolution when the IUs satisfying the negative requirement are not there + //Verify that the negation can not fail the resolution when the IUs satisfying the negative requirement are not there IProfile profile = createProfile("TestProfile." + getName()); IPlanner planner = createPlanner(); ProfileChangeRequest changeRequest = new ProfileChangeRequest(profile); @@ -192,7 +192,7 @@ public class NegationTesting extends AbstractProvisioningTest { assertEquals(2, queryResultSize(((PlannerStatus) plan.getStatus()).getPlannedState().query(QueryUtil.createIUAnyQuery(), null))); } - //Test the slicer and the resolver. + //Test the slicer and the resolver. public void testNot7() { MetadataFactory.InstallableUnitDescription iud1 = new MetadataFactory.InstallableUnitDescription(); iud1.setId("TestNegation4"); @@ -246,7 +246,7 @@ public class NegationTesting extends AbstractProvisioningTest { //Verify that the installing iu1 and iu3 will result in a conflict since iu3 is excluded by the requirement of iu1 ProfileChangeRequest changeRequest2 = new ProfileChangeRequest(profile); - Collection<IInstallableUnit> toAdd = new ArrayList<IInstallableUnit>(); + Collection<IInstallableUnit> toAdd = new ArrayList<>(); toAdd.add(iu1); toAdd.add(iu3); changeRequest2.addAll(toAdd); @@ -320,7 +320,7 @@ public class NegationTesting extends AbstractProvisioningTest { //Verify that the installing iu1 and iu4 will result in a conflict since iu3 is excluded by the requirement of iu1 ProfileChangeRequest changeRequest2 = new ProfileChangeRequest(profile); - Collection<IInstallableUnit> toAdd = new ArrayList<IInstallableUnit>(); + Collection<IInstallableUnit> toAdd = new ArrayList<>(); toAdd.add(iu1); toAdd.add(iu4); changeRequest2.addAll(toAdd); @@ -345,7 +345,7 @@ public class NegationTesting extends AbstractProvisioningTest { assertNotOK("plan should fail", plan.getStatus()); } - //This test demonstrates having capabilities that are unique + //This test demonstrates having capabilities that are unique public void testUniqueCapability() { MetadataFactory.InstallableUnitDescription iud1 = new MetadataFactory.InstallableUnitDescription(); iud1.setId("TestNegation4"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NoRequirements.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NoRequirements.java index 239026074..ed7e911cf 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NoRequirements.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NoRequirements.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -24,6 +23,7 @@ public class NoRequirements extends AbstractProvisioningTest { IPlanner planner; IProfile profile; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.0.0]"))); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NoUnecessaryIUProperty.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NoUnecessaryIUProperty.java index 0eccc26bd..fcaa0ab77 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NoUnecessaryIUProperty.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NoUnecessaryIUProperty.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Sonatype, Inc. Corporation and others. + * Copyright (c) 2010, 2017 Sonatype, Inc. 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 @@ -27,6 +27,7 @@ public class NoUnecessaryIUProperty extends AbstractProvisioningTest { IMetadataRepository repo; IInstallableUnit iuA, iuB; + @Override protected void setUp() throws Exception { super.setUp(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java index 4f17396a1..77f368277 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState.java @@ -1,21 +1,20 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import java.net.URI; import java.util.*; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery; @@ -35,6 +34,7 @@ public class NonMinimalState extends AbstractProvisioningTest { private String searchedId; private Set visited = new HashSet(); + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("Non Minimal state", "testData/nonMinimalState/"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState2.java index ab9c8f761..f0875cf1d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/NonMinimalState2.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,6 +27,7 @@ public class NonMinimalState2 extends AbstractProvisioningTest { IProfile profile = null; IMetadataRepository repo = null; + @Override protected void setUp() throws Exception { getMetadataRepositoryManager().addRepository(getTestData("Test repo (copy of Galileo M7)", "testData/galileoM7/").toURI()); profile = createProfile(NonMinimalState2.class.getName()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PP2ShouldFailToInstall.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PP2ShouldFailToInstall.java index 5f0e078c6..b50cb1cf3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PP2ShouldFailToInstall.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PP2ShouldFailToInstall.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -29,6 +29,7 @@ public class PP2ShouldFailToInstall extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU("p2.feature", Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "P1", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "P2", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchFailingToInstall.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchFailingToInstall.java index 798ed7398..20241efe3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchFailingToInstall.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchFailingToInstall.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -29,6 +29,7 @@ public class PatchFailingToInstall extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU("p2.feature", Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "P1", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "P2", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1.java index caec5daec..31a9a70da 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -27,6 +26,7 @@ public class PatchTest1 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest10.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest10.java index ef5a399a1..7dd2a6633 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest10.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest10.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -30,6 +29,7 @@ public class PatchTest10 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true)}); @@ -50,7 +50,7 @@ public class PatchTest10 extends AbstractProvisioningTest { } public void testConflictingPatches() { - //a1 and p1 can be installed together + //a1 and p1 can be installed together ProfileChangeRequest req1 = new ProfileChangeRequest(profile1); req1.addInstallableUnits(new IInstallableUnit[] {a1, p1}); IProvisioningPlan plan1 = planner.getProvisioningPlan(req1, null, null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest11.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest11.java index c9e26fe5d..04ae6c56f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest11.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest11.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -29,6 +28,7 @@ public class PatchTest11 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true, true)}); @@ -46,7 +46,7 @@ public class PatchTest11 extends AbstractProvisioningTest { public void testInstallBogusInstallFilterInPatch() { //P1 changes the requirement from A on B to be filtered (the filter evaluates to false): A requires B [1.0.0, 1.0.0] becomes when the patch is applied A requires B [1.1.0, 1.3.0) if "foo=bar" - //The result is a bit counter intuitive but correct. Only A1 and P1 are installed. No be get installed since the dependency on B is filtered out. + //The result is a bit counter intuitive but correct. Only A1 and P1 are installed. No be get installed since the dependency on B is filtered out. ProfileChangeRequest req2 = new ProfileChangeRequest(profile1); req2.addInstallableUnits(new IInstallableUnit[] {a1, p1}); req2.setInstallableUnitInclusionRules(p1, ProfileInclusionRules.createOptionalInclusionRule(p1)); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest12.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest12.java index e797bbb79..c2890fd11 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest12.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest12.java @@ -1,22 +1,22 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.director.Explanation; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; -import org.eclipse.equinox.internal.provisional.p2.director.*; +import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; +import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -33,6 +33,7 @@ public class PatchTest12 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true, true)}); @@ -63,7 +64,7 @@ public class PatchTest12 extends AbstractProvisioningTest { assertInstallOperand(plan2, a1); assertInstallOperand(plan2, b1); - //Try to install a1 and p1. This should fail because the patch adds an invalid filter + //Try to install a1 and p1. This should fail because the patch adds an invalid filter ProfileChangeRequest req3 = new ProfileChangeRequest(profile1); req3.addInstallableUnits(new IInstallableUnit[] {a1, p1}); IProvisioningPlan plan3 = planner.getProvisioningPlan(req3, null, null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest13.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest13.java index ca5fa7c70..3c4484c09 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest13.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest13.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -29,6 +28,7 @@ public class PatchTest13 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "C", new VersionRange("[1.0.0, 1.1.0)"), null, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1b.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1b.java index ff25f6530..e17be16a6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1b.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1b.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -28,6 +27,7 @@ public class PatchTest1b extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true)}); @@ -44,7 +44,7 @@ public class PatchTest1b extends AbstractProvisioningTest { } public void testInstall() { - //A requires B 1.0, the installation of the P will result in B 1.2 to be installed + //A requires B 1.0, the installation of the P will result in B 1.2 to be installed ProfileChangeRequest req1 = new ProfileChangeRequest(profile1); req1.addInstallableUnits(new IInstallableUnit[] {a1, p1}); IProvisioningPlan plan1 = planner.getProvisioningPlan(req1, null, null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1c.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1c.java index 81e1e0f6a..b0922f39e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1c.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest1c.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -29,6 +28,7 @@ public class PatchTest1c extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true)}); @@ -46,7 +46,7 @@ public class PatchTest1c extends AbstractProvisioningTest { } public void testInstall() { - //A requires B [1.0, 1.1), the installation of P will result in B 1.2 to be installed + //A requires B [1.0, 1.1), the installation of P will result in B 1.2 to be installed ProfileChangeRequest req1 = new ProfileChangeRequest(profile1); req1.addInstallableUnits(new IInstallableUnit[] {a1, p1}); IProvisioningPlan plan1 = planner.getProvisioningPlan(req1, null, null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest2.java index 8782c6b14..f015427ad 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest2.java @@ -1,22 +1,22 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.director.Explanation; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; -import org.eclipse.equinox.internal.provisional.p2.director.*; +import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; +import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -36,6 +36,7 @@ public class PatchTest2 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); IProvidedCapability[] cap = new IProvidedCapability[] {MetadataFactory.createProvidedCapability("foo", "bar", Version.createOSGi(1, 0, 0))}; @@ -44,8 +45,8 @@ public class PatchTest2 extends AbstractProvisioningTest { IRequirementChange change = MetadataFactory.createRequirementChange(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", VersionRange.emptyRange, null, false, false, false), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.1.0, 1.3.0)"), null, false, false, true)); p1 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.1.0]"), null, false, false, false)}}, null); p2 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.3.0, 1.5.0]"), null, false, false, false)}}, null); - p3 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] { {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.1.0]"), null, false, false, false)}, {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.3.0, 1.5.0]"), null, false, false, false)}}, null); - p4 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] { {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.6.0, 1.7.0]"), null, false, false, false)}, {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.3.0, 1.5.0]"), null, false, false, false)}}, null); + p3 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.1.0]"), null, false, false, false)}, {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.3.0, 1.5.0]"), null, false, false, false)}}, null); + p4 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.6.0, 1.7.0]"), null, false, false, false)}, {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.3.0, 1.5.0]"), null, false, false, false)}}, null); p5 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] {{MetadataFactory.createRequirement("foo", "bar", new VersionRange("[1.0.0, 2.0.0)"), null, false, false, false), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.5.0]"), null, false, false, false)}}, null); p6 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {change}, new IRequirement[][] {}, null); createTestMetdataRepository(new IInstallableUnit[] {a1, b1, p1, p2, p3, p4, p5, p6}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest3.java index b576d8698..3832b272e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest3.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -31,6 +30,7 @@ public class PatchTest3 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); f1 = createIU("F", Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.1.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest4.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest4.java index 39350658b..4aaa8a480 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest4.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest4.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -35,6 +34,7 @@ public class PatchTest4 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); f1 = createIU("F", Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "C", VersionRange.emptyRange, null, false, false, true)}); @@ -49,7 +49,7 @@ public class PatchTest4 extends AbstractProvisioningTest { IRequirementChange changeC = MetadataFactory.createRequirementChange(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "D", VersionRange.emptyRange, null, false, false, false), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "D", new VersionRange("[2.0.0, 2.1.0)"), null, false, false, true)); IRequirement lifeCycle = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "F", VersionRange.emptyRange, null, false, false, false); - IRequirement[][] scope = new IRequirement[][] { {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.1.0]"), null, false, false, false)}, {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "C", new VersionRange("[1.0.0, 1.1.0]"), null, false, false, false)}}; + IRequirement[][] scope = new IRequirement[][] {{MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", new VersionRange("[1.0.0, 1.1.0]"), null, false, false, false)}, {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "C", new VersionRange("[1.0.0, 1.1.0]"), null, false, false, false)}}; p1 = createIUPatch("P", Version.create("1.0.0"), true, new IRequirementChange[] {changeA, changeC}, scope, lifeCycle); p2 = createIUPatch("P", Version.create("2.0.0"), true, new IRequirementChange[] {changeA, changeC}, new IRequirement[0][0], lifeCycle); createTestMetdataRepository(new IInstallableUnit[] {f1, a1, b1, b2, c1, d1, d2, p1}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest5.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest5.java index a4ea02bf0..a69a375fa 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest5.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest5.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -29,6 +28,7 @@ public class PatchTest5 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); top = createIU("TOP", Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "F", new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest6.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest6.java index e0c3971c8..acb554983 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest6.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest6.java @@ -1,22 +1,22 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.director.Explanation; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; -import org.eclipse.equinox.internal.provisional.p2.director.*; +import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; +import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -35,6 +35,7 @@ public class PatchTest6 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true)}); @@ -77,7 +78,7 @@ public class PatchTest6 extends AbstractProvisioningTest { IProvisioningPlan plan3 = planner.getProvisioningPlan(req3, null, null); assertEquals(IStatus.OK, plan3.getStatus().getSeverity()); - //Install a1 and p1. + //Install a1 and p1. ProfileChangeRequest req4 = new ProfileChangeRequest(profile1); req4.addInstallableUnits(new IInstallableUnit[] {a1, p1}); IProvisioningPlan plan4 = planner.getProvisioningPlan(req4, null, null); @@ -87,7 +88,7 @@ public class PatchTest6 extends AbstractProvisioningTest { assertInstallOperand(plan4, pp1); assertInstallOperand(plan4, b1); - //Install a1, c1 and p1. + //Install a1, c1 and p1. ProfileChangeRequest req5 = new ProfileChangeRequest(profile1); req5.addInstallableUnits(new IInstallableUnit[] {a1, c1, p1}); IProvisioningPlan plan5 = planner.getProvisioningPlan(req5, null, null); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest7.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest7.java index cb9af2780..287006894 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest7.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest7.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -34,6 +33,7 @@ public class PatchTest7 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); // x1 = createIU("X", Version.createOSGi(1, 2, 0), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest7b.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest7b.java index c33cd981f..cbf524e90 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest7b.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest7b.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -34,6 +33,7 @@ public class PatchTest7b extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); x1 = createIU("X", Version.createOSGi(1, 2, 0), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest8.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest8.java index 5cb75ded7..1243d4c32 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest8.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest8.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -33,6 +32,7 @@ public class PatchTest8 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.createOSGi(1, 0, 0), true); @@ -68,7 +68,7 @@ public class PatchTest8 extends AbstractProvisioningTest { // req1.addInstallableUnits(new IInstallableUnit[] {f1}); // ProvisioningPlan plan1 = planner.getProvisioningPlan(req1, null, null); // assertEquals(IStatus.ERROR, plan1.getStatus().getSeverity()); - // + // // //Verify that the installation of f1 and p1 succeed // ProfileChangeRequest req2 = new ProfileChangeRequest(profile1); // req2.addInstallableUnits(new IInstallableUnit[] {f1, p1}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest9.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest9.java index cbd4920a7..bbe4e809d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest9.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTest9.java @@ -1,22 +1,22 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.director.Explanation; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; -import org.eclipse.equinox.internal.provisional.p2.director.*; +import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; +import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -34,6 +34,7 @@ public class PatchTest9 extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "C", new VersionRange("[1.0.0, 1.1.0)"), null, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch.java index dae6aa17c..1c98c89d6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -35,6 +35,7 @@ public class PatchTestMultiplePatch extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P3, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch2.java index 78fb0d9ff..07048baef 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch2.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -37,6 +36,7 @@ public class PatchTestMultiplePatch2 extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P3, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch3.java index f823f96aa..0d0a73df8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestMultiplePatch3.java @@ -1,17 +1,16 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -37,6 +36,7 @@ public class PatchTestMultiplePatch3 extends AbstractProvisioningTest { private IProfile profile1; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P3, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional.java index 151e1649a..cfa36d122 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -31,6 +31,7 @@ public class PatchTestOptional extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional2.java index ed2ea837c..83ad523c6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional2.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -30,6 +30,7 @@ public class PatchTestOptional2 extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); @@ -53,7 +54,7 @@ public class PatchTestOptional2 extends AbstractProvisioningTest { } public void testInstallPatchSettingAMissingOptionalDependency() { - //The patch changes the requirement from p2Feature to P1 1.1.1. to be optional, but P1 1.1.1 is missing + //The patch changes the requirement from p2Feature to P1 1.1.1. to be optional, but P1 1.1.1 is missing install(profile1, new IInstallableUnit[] {pp1}, true, planner, engine); assertProfileContainsAll("Profile setup incorrectly", profile1, new IInstallableUnit[] {p2Feature, pp1, p2}); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional3.java index 8131a439a..57414eefd 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestOptional3.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -30,6 +30,7 @@ public class PatchTestOptional3 extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); @@ -55,7 +56,7 @@ public class PatchTestOptional3 extends AbstractProvisioningTest { public void testInstallPatchSettingAMissingOptionalDependency() { //This verify that the non satisfiable but optional part of the patch does not prevent the application of the whole patch - //The patch changes the requirement from p2Feature to P1 1.1.1 to be optional, but P1 1.1.1 is missing + //The patch changes the requirement from p2Feature to P1 1.1.1 to be optional, but P1 1.1.1 is missing install(profile1, new IInstallableUnit[] {pp1}, true, planner, engine); assertProfileContainsAll("Profile setup incorrectly", profile1, new IInstallableUnit[] {p2Feature, pp1, p2b}); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUninstall.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUninstall.java index 924577fad..dc1e96927 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUninstall.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUninstall.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -34,6 +34,7 @@ public class PatchTestUninstall extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate.java index 160ef0d34..0e14307de 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate.java @@ -1,22 +1,22 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.director.Explanation; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.ProvisioningPlan; -import org.eclipse.equinox.internal.provisional.p2.director.*; +import org.eclipse.equinox.internal.provisional.p2.director.PlannerStatus; +import org.eclipse.equinox.internal.provisional.p2.director.RequestStatus; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -41,6 +41,7 @@ public class PatchTestUpdate extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); @@ -73,7 +74,7 @@ public class PatchTestUpdate extends AbstractProvisioningTest { } public void testUpdate() { - //The update of the feature is expected to fail because the patches are installed without flexibility (strict mode) + //The update of the feature is expected to fail because the patches are installed without flexibility (strict mode) ProfileChangeRequest req1 = new ProfileChangeRequest(profile1); req1.addInstallableUnits(new IInstallableUnit[] {p2Feature20}); req1.setInstallableUnitInclusionRules(p2Feature20, ProfileInclusionRules.createStrictInclusionRule(p2Feature20)); @@ -83,7 +84,7 @@ public class PatchTestUpdate extends AbstractProvisioningTest { } public void testExplanation() { - //The update of the feature is expected to fail because the patches are installed without flexibility (strict mode) + //The update of the feature is expected to fail because the patches are installed without flexibility (strict mode) ProfileChangeRequest req1 = new ProfileChangeRequest(profile1); req1.addInstallableUnits(new IInstallableUnit[] {p2Feature20}); req1.setInstallableUnitInclusionRules(p2Feature20, ProfileInclusionRules.createStrictInclusionRule(p2Feature20)); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate2.java index 160db3931..90ea300cd 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate2.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -37,6 +36,7 @@ public class PatchTestUpdate2 extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); @@ -72,7 +72,7 @@ public class PatchTestUpdate2 extends AbstractProvisioningTest { } public void testUpdate() { - //The update of the feature is expected to work and to cause the uninstallation of the patch since it is installed optionally + //The update of the feature is expected to work and to cause the uninstallation of the patch since it is installed optionally ProfileChangeRequest req1 = new ProfileChangeRequest(profile1); req1.addInstallableUnits(new IInstallableUnit[] {p2Feature20}); req1.setInstallableUnitInclusionRules(p2Feature20, ProfileInclusionRules.createStrictInclusionRule(p2Feature20)); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate3.java index e50135c09..d0e897551 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate3.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.net.URI; import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -37,6 +36,7 @@ public class PatchTestUpdate3 extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate4.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate4.java index a9a2bf3d9..c54885859 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate4.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate4.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.planner.IPlanner; @@ -36,6 +35,7 @@ public class PatchTestUpdate4 extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate5.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate5.java index 2c65745b4..0ef6492a5 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate5.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUpdate5.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -34,6 +34,7 @@ public class PatchTestUpdate5 extends AbstractProvisioningTest { private IPlanner planner; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); p2Feature = createIU(P2_FEATURE, Version.createOSGi(1, 0, 0), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P1, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, P2, new VersionRange("[1.0.0, 1.0.0]"), null, false, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUsingNegativeRequirement.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUsingNegativeRequirement.java index 2fcf9bc52..6b457c84d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUsingNegativeRequirement.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PatchTestUsingNegativeRequirement.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 Sonatype, Inc and others. + * Copyright (c) 2011, 2017 Sonatype, Inc 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ @@ -31,6 +31,7 @@ public class PatchTestUsingNegativeRequirement extends AbstractProvisioningTest IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.1.0)"), null, false, true), MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "C", new VersionRange("[1.0.0, 1.0.0]"), null, false, true)}); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java index 570c568d3..0beb7d4a1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/PermissiveSlicerTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -65,7 +65,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { } public void testSliceRCPWithFilter() { - Map<String, String> p = new HashMap<String, String>(); + Map<String, String> p = new HashMap<>(); p.put("osgi.os", "win32"); p.put("osgi.ws", "win32"); p.put("osgi.arch", "x86"); @@ -81,7 +81,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { } public void testStrictDependency() { - Map<String, String> p = new HashMap<String, String>(); + Map<String, String> p = new HashMap<>(); p.put("osgi.os", "win32"); p.put("osgi.ws", "win32"); p.put("osgi.arch", "x86"); @@ -121,7 +121,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { } public void testValidateIU() { - Map<String, String> p = new HashMap<String, String>(); + Map<String, String> p = new HashMap<>(); p.put("osgi.os", "win32"); p.put("osgi.ws", "win32"); p.put("osgi.arch", "x86"); @@ -142,7 +142,7 @@ public class PermissiveSlicerTest extends AbstractProvisioningTest { } public void testExtractOnlyPlatformSpecificForOnePlatform() { - Map<String, String> p = new HashMap<String, String>(); + Map<String, String> p = new HashMap<>(); p.put("osgi.os", "win32"); p.put("osgi.ws", "win32"); p.put("osgi.arch", "x86"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ResolvedIUInPCR.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ResolvedIUInPCR.java index 9c3a9d1c0..839166c6e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ResolvedIUInPCR.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/ResolvedIUInPCR.java @@ -18,6 +18,7 @@ public class ResolvedIUInPCR extends AbstractProvisioningTest { private IProfile profile; + @Override protected void setUp() throws Exception { IULoader.loadIUs(this); profile = createProfile("ResolvedIUInPCR." + getName()); @@ -33,7 +34,7 @@ public class ResolvedIUInPCR extends AbstractProvisioningTest { } public void testNoResolvedIUInBulkAddition() { - Collection<IInstallableUnit> riusToAdd = new ArrayList<IInstallableUnit>(); + Collection<IInstallableUnit> riusToAdd = new ArrayList<>(); ResolvedInstallableUnit riu1 = new ResolvedInstallableUnit(iu1); riusToAdd.add(riu1); @@ -68,7 +69,7 @@ public class ResolvedIUInPCR extends AbstractProvisioningTest { } public void testNoResolvedIUInBulkRemoval() { - Collection<IInstallableUnit> riusToAdd = new ArrayList<IInstallableUnit>(); + Collection<IInstallableUnit> riusToAdd = new ArrayList<>(); ResolvedInstallableUnit riu1 = new ResolvedInstallableUnit(iu1); riusToAdd.add(riu1); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest1.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest1.java index 592714825..fd7c12c8f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest1.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest1.java @@ -1,20 +1,19 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import java.util.ArrayList; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -28,6 +27,7 @@ public class SDKPatchingTest1 extends AbstractProvisioningTest { ArrayList newIUs = new ArrayList(); IInstallableUnit patchInstallingCommon = null; + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("test data for sdkpatching test", "testData/sdkpatchingtest"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest2.java index b53d40965..9f678fe59 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SDKPatchingTest2.java @@ -1,20 +1,19 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.io.File; import java.util.ArrayList; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.*; @@ -29,6 +28,7 @@ public class SDKPatchingTest2 extends AbstractProvisioningTest { IInstallableUnit patchInstallingJDTLaunching = null; IInstallableUnit patchInstallingDebugUI = null; + @Override protected void setUp() throws Exception { super.setUp(); File reporegistry1 = getTestData("test data for sdkpatching test", "testData/sdkpatchingtest"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies.java index e907ff1cd..372f2c093 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2009, 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 @@ -8,9 +8,8 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -25,6 +24,7 @@ public class SeveralOptionalDependencies extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); IRequirement reqA = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, true, false, true); //optional dependency, will be satisfied diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies2.java index e591a0533..5e6ce00dd 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies2.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2009, 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 @@ -8,9 +8,8 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -25,6 +24,7 @@ public class SeveralOptionalDependencies2 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); IRequirement reqA = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, true, false, true); //optional dependency, will be satisfied diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies3.java index 7be8d81c1..e168f0a41 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies3.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2009, 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 @@ -8,9 +8,8 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -22,6 +21,7 @@ public class SeveralOptionalDependencies3 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); IRequirement reqA = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, true, false, true); //optional dependency, will not be satisfied diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies4.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies4.java index eadbb89f5..3f8724be3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies4.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies4.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2009, 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 @@ -8,9 +8,8 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -25,6 +24,7 @@ public class SeveralOptionalDependencies4 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); IRequirement reqA = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, true, false, true); //optional dependency, will be satisfied diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies5.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies5.java index 29c29609c..4876e4514 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies5.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SeveralOptionalDependencies5.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2009, 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 @@ -8,9 +8,8 @@ ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -25,6 +24,7 @@ public class SeveralOptionalDependencies5 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); IRequirement reqA = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "A", VersionRange.emptyRange, null, true, false, true); //optional dependency, will be satisfied diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest.java index 30a88d2bf..a262a66bf 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -18,7 +17,7 @@ import org.eclipse.equinox.p2.planner.IPlanner; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; public class SimpleOptionalTest extends AbstractProvisioningTest { - //A dep B op, C, D op + //A dep B op, C, D op //X dep B private IInstallableUnit a1; @@ -27,6 +26,7 @@ public class SimpleOptionalTest extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); b1 = createIU("B", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest2.java index f7f034e2e..5164de354 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest2.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -33,6 +32,7 @@ public class SimpleOptionalTest2 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); b1 = createIU("B", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest3.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest3.java index 6ce4d2263..12e77d5ec 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest3.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest3.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -31,6 +30,7 @@ public class SimpleOptionalTest3 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); b1 = createIU("B", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest4.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest4.java index 7ee19110c..6cfce5bad 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest4.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest4.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProvisioningPlan; import org.eclipse.equinox.p2.metadata.*; @@ -18,7 +17,7 @@ import org.eclipse.equinox.p2.planner.IPlanner; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; public class SimpleOptionalTest4 extends AbstractProvisioningTest { - //A dep B op, C, D op + //A dep B op, C, D op //X dep B private IInstallableUnit a1; @@ -30,6 +29,7 @@ public class SimpleOptionalTest4 extends AbstractProvisioningTest { private IProfile profile; private IPlanner planner; + @Override protected void setUp() throws Exception { super.setUp(); b1 = createIU("B", Version.create("1.0.0"), false); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest5.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest5.java index fb84ec094..61c3d8c24 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest5.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleOptionalTest5.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.Version; @@ -28,6 +27,7 @@ public class SimpleOptionalTest5 extends AbstractProvisioningTest { IProfile profile; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), false); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleSingleton.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleSingleton.java index e5781d3da..2eb28870b 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleSingleton.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimpleSingleton.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -31,6 +31,7 @@ public class SimpleSingleton extends AbstractProvisioningTest { IPlanner planner; IProfile profile; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimulatedSharedInstallTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimulatedSharedInstallTest.java index acc832165..64b418335 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimulatedSharedInstallTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SimulatedSharedInstallTest.java @@ -1,20 +1,19 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.net.URI; import java.util.*; import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.director.SimplePlanner; import org.eclipse.equinox.internal.provisional.p2.director.PlanExecutionHelper; import org.eclipse.equinox.p2.core.IProvisioningAgent; @@ -35,6 +34,7 @@ public class SimulatedSharedInstallTest extends AbstractProvisioningTest { IProfile profile; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.parseVersion("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, "B", new VersionRange("[1.0.0, 1.0.0]"))); @@ -73,6 +73,7 @@ public class SimulatedSharedInstallTest extends AbstractProvisioningTest { assertContains(profile.query(QueryUtil.createIUAnyQuery(), null), c1); IProfile availableWrapper = new IProfile() { + @Override public IQueryResult<IInstallableUnit> available(IQuery<IInstallableUnit> query, IProgressMonitor monitor) { IQueryResult queryResult = profile.query(query, monitor); Collector collector = new Collector(); @@ -85,34 +86,42 @@ public class SimulatedSharedInstallTest extends AbstractProvisioningTest { } // everything else is delegated + @Override public Map getInstallableUnitProperties(IInstallableUnit iu) { return profile.getInstallableUnitProperties(iu); } + @Override public String getInstallableUnitProperty(IInstallableUnit iu, String key) { return profile.getInstallableUnitProperty(iu, key); } + @Override public String getProfileId() { return profile.getProfileId(); } + @Override public Map getProperties() { return profile.getProperties(); } + @Override public String getProperty(String key) { return profile.getProperty(key); } + @Override public long getTimestamp() { return profile.getTimestamp(); } + @Override public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) { return profile.query(query, monitor); } + @Override public IProvisioningAgent getProvisioningAgent() { return profile.getProvisioningAgent(); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SingletonOptionallyInstalled.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SingletonOptionallyInstalled.java index 88afde881..5b7d7069d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SingletonOptionallyInstalled.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SingletonOptionallyInstalled.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.Version; @@ -28,6 +27,7 @@ public class SingletonOptionallyInstalled extends AbstractProvisioningTest { IProfile profile; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SingletonOptionallyInstalled2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SingletonOptionallyInstalled2.java index 0ae24deac..41fd90f43 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SingletonOptionallyInstalled2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SingletonOptionallyInstalled2.java @@ -1,18 +1,17 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.Version; @@ -28,6 +27,7 @@ public class SingletonOptionallyInstalled2 extends AbstractProvisioningTest { IProfile profile; private IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); a1 = createIU("A", Version.create("1.0.0"), true); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SlicerBug365124Test.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SlicerBug365124Test.java index 09c304987..2b4a4c34c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SlicerBug365124Test.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SlicerBug365124Test.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -33,7 +33,7 @@ public class SlicerBug365124Test extends AbstractProvisioningTest { } private Map<String, String> getProperties() { - Map<String, String> result = new HashMap<String, String>(); + Map<String, String> result = new HashMap<>(); result.put("org.eclipse.equinox.p2.installFolder", "/Users/equinox/Downloads/eclipse"); result.put("osgi.nl", "en_US"); result.put("osgi.ws", "cocoa"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java index dfbe37940..d6965d1a5 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/SynchronizeOperationTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 Sonatype, Inc. and others. + * Copyright (c) 2011, 2017 Sonatype, Inc. 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 - * + * * Contributors: * Sonatype, Inc. - initial API and implementation * IBM Corporation - Ongoing development @@ -62,9 +62,9 @@ public class SynchronizeOperationTest extends AbstractProvisioningTest { URI repoLocation = getTestData("p2 location", "testData/synchronizeOperation/repo").toURI(); IProvisioningAgent firstAgent = provider.createAgent(p2location); IVersionedId v = new VersionedId("payload.feature.feature.group", (String) null); - Collection<IVersionedId> toInstall = new ArrayList<IVersionedId>(); + Collection<IVersionedId> toInstall = new ArrayList<>(); toInstall.add(v); - List<URI> repos = new ArrayList<URI>(); + List<URI> repos = new ArrayList<>(); repos.add(repoLocation); SynchronizeOperation operation = createSynchronizeOperation(toInstall, repos, new NullProgressMonitor(), firstAgent); operation.setProfileId("DefaultProfile"); @@ -102,7 +102,7 @@ public class SynchronizeOperationTest extends AbstractProvisioningTest { //This is a copy of the OperationHelper code private Collection<IInstallableUnit> gatherIUs(IQueryable<IInstallableUnit> searchContext, Collection<IVersionedId> ius, boolean checkIUs, IProgressMonitor monitor) throws ProvisionException { - Collection<IInstallableUnit> gatheredIUs = new ArrayList<IInstallableUnit>(ius.size()); + Collection<IInstallableUnit> gatheredIUs = new ArrayList<>(ius.size()); for (IVersionedId versionedId : ius) { if (!checkIUs && versionedId instanceof IInstallableUnit) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestFilteringOnAbsentProperty.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestFilteringOnAbsentProperty.java index ebaa458d8..e3c1414a6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestFilteringOnAbsentProperty.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TestFilteringOnAbsentProperty.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -28,10 +28,11 @@ public class TestFilteringOnAbsentProperty extends AbstractProvisioningTest { /* * This test mimics the metadata structure used to represent the macos distro in bundled shape. - * The idea is that there is one IU that requires a capability. + * The idea is that there is one IU that requires a capability. * This capability is provided by two different IUs (iuA and iuABundled) with each guarded by a different filters guaranteeing that only one of the two will ever be selected. * One of the filter makes use of the (<propertyName>=*) LDAP filter that tests for the presence of a property. */ + @Override protected void setUp() throws Exception { //first IU { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TwoVersionsOfWSDL.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TwoVersionsOfWSDL.java index b5728b8cb..9d9ec7dd7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TwoVersionsOfWSDL.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TwoVersionsOfWSDL.java @@ -1,17 +1,16 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.VersionRange; @@ -29,6 +28,7 @@ public class TwoVersionsOfWSDL extends AbstractProvisioningTest { IPlanner planner; IEngine engine; + @Override protected void setUp() throws Exception { super.setUp(); IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java index 18daccb97..99c4d497f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java @@ -44,10 +44,10 @@ public class TychoUsage extends AbstractProvisioningTest { public void testTychoUsage() throws ProvisionException, URISyntaxException { IMetadataRepository repo = loadMetadataRepository(URIUtil.fromString("http://download.eclipse.org/releases/indigo")); IInstallableUnit newRoot1 = repo.query(QueryUtil.createIUQuery("org.eclipse.emf.sdk.feature.group", Version.create("2.7.2.v20120130-0943")), new NullProgressMonitor()).iterator().next(); - Collection<IInstallableUnit> newRoots = new ArrayList<IInstallableUnit>(); + Collection<IInstallableUnit> newRoots = new ArrayList<>(); newRoots.add(newRoot1); - Map<String, String> context = new HashMap<String, String>(); + Map<String, String> context = new HashMap<>(); context.put("osgi.ws", "win32"); context.put("osgi.os", "win32"); context.put("osgi.arch", "x86_64"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UninstallEverything.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UninstallEverything.java index 6e77c15a1..76e609629 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UninstallEverything.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UninstallEverything.java @@ -1,16 +1,15 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.planner; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -24,6 +23,7 @@ public class UninstallEverything extends AbstractProvisioningTest { IDirector director; IProfile profile; + @Override protected void setUp() throws Exception { super.setUp(); a = createIU("A", Version.create("1.0.0")); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UpdateForTwoIUs.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UpdateForTwoIUs.java index 6167924bb..87e0616f7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UpdateForTwoIUs.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/UpdateForTwoIUs.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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 @@ -38,12 +38,12 @@ public class UpdateForTwoIUs extends AbstractProvisioningTest { IExpression expr = ExpressionUtil.parse(orExpression); IMatchExpression matchExpression = ExpressionUtil.getFactory().matchExpression(expr); - Collection<IMatchExpression<IInstallableUnit>> updateExpression = new ArrayList<IMatchExpression<IInstallableUnit>>(); + Collection<IMatchExpression<IInstallableUnit>> updateExpression = new ArrayList<>(); updateExpression.add(matchExpression); iud.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(updateExpression, IUpdateDescriptor.HIGH, (String) null, (URI) null)); iua = MetadataFactory.createInstallableUnit(iud); - Collection<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(); + Collection<IInstallableUnit> ius = new ArrayList<>(); ius.add(iua); URI repoURI = getTempFolder().toURI(); createMetadataRepository(repoURI, null).addInstallableUnits(ius); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java index 2d948c741..a06ffe7a9 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher; @@ -52,6 +52,7 @@ public class TestArtifactRepository implements IArtifactRepository { this.descriptor = descriptor; } + @Override public void close() throws IOException { if (closed) return; @@ -79,6 +80,7 @@ public class TestArtifactRepository implements IArtifactRepository { } } + @Override public IStatus getStatus() { return status; } @@ -87,20 +89,24 @@ public class TestArtifactRepository implements IArtifactRepository { return destination; } + @Override public void setStatus(IStatus status) { this.status = status == null ? Status.OK_STATUS : status; } + @Override public void write(byte[] b) throws IOException { destination.write(b); count += b.length; } + @Override public void write(byte[] b, int off, int len) throws IOException { destination.write(b, off, len); count += len; } + @Override public void write(int b) throws IOException { destination.write(b); count++; @@ -118,6 +124,7 @@ public class TestArtifactRepository implements IArtifactRepository { repo = new HashMap/*<IArtifactDescriptor, byte[]>*/(); } + @Override public OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException { // Check if the artifact is already in this repository if (contains(descriptor)) { @@ -126,11 +133,13 @@ public class TestArtifactRepository implements IArtifactRepository { } return new ArtifactOutputStream(new ByteArrayOutputStream(500), descriptor); } - + + @Override public void addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) { addDescriptor(descriptor, new byte[0]); } + @Override @Deprecated public final void addDescriptor(IArtifactDescriptor descriptor) { this.addDescriptor(descriptor, new NullProgressMonitor()); @@ -140,20 +149,24 @@ public class TestArtifactRepository implements IArtifactRepository { repo.put(descriptor, bytes); } + @Override public void addDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) { for (int i = 0; i < descriptors.length; i++) addDescriptor(descriptors[i]); } + @Override @Deprecated public final void addDescriptors(IArtifactDescriptor[] descriptors) { this.addDescriptors(descriptors, new NullProgressMonitor()); } + @Override public boolean contains(IArtifactDescriptor descriptor) { return repo.containsKey(descriptor); } + @Override public synchronized boolean contains(IArtifactKey key) { for (IArtifactDescriptor descriptor : repo.keySet()) { if (descriptor.getArtifactKey().equals(key)) @@ -162,6 +175,7 @@ public class TestArtifactRepository implements IArtifactRepository { return false; } + @Override public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { try { byte[] repoContents = repo.get(descriptor); @@ -175,8 +189,9 @@ public class TestArtifactRepository implements IArtifactRepository { return Status.OK_STATUS; } + @Override public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { - Set<IArtifactDescriptor> result = new HashSet<IArtifactDescriptor>(); + Set<IArtifactDescriptor> result = new HashSet<>(); for (IArtifactDescriptor descriptor : repo.keySet()) { if (descriptor.getArtifactKey().equals(key)) result.add(descriptor); @@ -184,6 +199,7 @@ public class TestArtifactRepository implements IArtifactRepository { return result.toArray(new IArtifactDescriptor[0]); } + @Override public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, requests.length); try { @@ -203,19 +219,22 @@ public class TestArtifactRepository implements IArtifactRepository { return artifactRequest.getResult(); } + @Override public void removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) { repo.remove(descriptor); } + @Override @Deprecated public final void removeDescriptor(IArtifactDescriptor descriptor) { this.removeDescriptor(descriptor, new NullProgressMonitor()); } + @Override public void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) { - ArrayList/*<IArtifactDescriptor>*/removeList = new ArrayList/*<IArtifactDescriptor>*/(); - for (Iterator/*<IArtifactDescriptor>*/iterator = repo.keySet().iterator(); iterator.hasNext();) { - IArtifactDescriptor descriptor = (IArtifactDescriptor) iterator.next(); + ArrayList<IArtifactDescriptor> removeList = new ArrayList<>(); + for (Iterator<IArtifactDescriptor> iterator = repo.keySet().iterator(); iterator.hasNext();) { + IArtifactDescriptor descriptor = iterator.next(); if (descriptor.getArtifactKey().equals(key)) removeList.add(descriptor); } @@ -224,67 +243,82 @@ public class TestArtifactRepository implements IArtifactRepository { } } + @Override @Deprecated public final void removeDescriptor(IArtifactKey key) { removeDescriptor(key, new NullProgressMonitor()); } + @Override public void removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) { for (IArtifactDescriptor descriptor : descriptors) removeDescriptor(descriptor); } + @Override @Deprecated public final void removeDescriptors(IArtifactDescriptor[] descriptors) { this.removeDescriptors(descriptors, new NullProgressMonitor()); } + @Override public void removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor) { for (IArtifactKey key : keys) removeDescriptor(key); } + @Override @Deprecated public final void removeDescriptors(IArtifactKey[] keys) { this.removeDescriptors(keys, new NullProgressMonitor()); } + @Override public String getDescription() { return description; } + @Override public URI getLocation() { return null; } + @Override public String getName() { return name; } + @Override public Map getProperties() { return OrderedProperties.unmodifiableProperties(properties); } + @Override public String getProperty(String key) { return properties.get(key); } + @Override public String getProvider() { return provider; } + @Override public IProvisioningAgent getProvisioningAgent() { return agent; } + @Override public String getType() { return "memoryArtifactRepo"; //$NON-NLS-1$ } + @Override public String getVersion() { return version; } + @Override public boolean isModifiable() { return true; } @@ -297,10 +331,12 @@ public class TestArtifactRepository implements IArtifactRepository { this.name = value; } + @Override public String setProperty(String key, String value, IProgressMonitor monitor) { return (value == null ? properties.remove(key) : properties.put(key, value)); } + @Override public final String setProperty(String key, String value) { return this.setProperty(key, value, new NullProgressMonitor()); } @@ -309,15 +345,18 @@ public class TestArtifactRepository implements IArtifactRepository { provider = value; } + @Override public void removeAll(IProgressMonitor monitor) { repo.clear(); } + @Override @Deprecated public final void removeAll() { removeAll(new NullProgressMonitor()); } + @Override public Object getAdapter(Class adapter) { return null; } @@ -342,39 +381,46 @@ public class TestArtifactRepository implements IArtifactRepository { return repo.get(artifactDescriptor); } + @Override public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { return getArtifact(descriptor, destination, monitor); } + @Override public IArtifactDescriptor createArtifactDescriptor(IArtifactKey key) { return new ArtifactDescriptor(key); } + @Override public IArtifactKey createArtifactKey(String classifier, String id, Version keyVersion) { return new ArtifactKey(classifier, id, keyVersion); } + @Override public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) { if (monitor != null && monitor.isCanceled()) return Collector.emptyCollector(); - Collector<IArtifactKey> collector = new Collector<IArtifactKey>(); + Collector<IArtifactKey> collector = new Collector<>(); for (IArtifactDescriptor descriptor : repo.keySet()) { collector.accept(descriptor.getArtifactKey()); } return collector; } + @Override public IQueryable<IArtifactDescriptor> descriptorQueryable() { final Collection<IArtifactDescriptor> descs = repo.keySet(); return new IQueryable<IArtifactDescriptor>() { + @Override public IQueryResult<IArtifactDescriptor> query(IQuery<IArtifactDescriptor> query, IProgressMonitor monitor) { return query.perform(descs.iterator()); } }; } + @Override public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { try { runnable.run(monitor); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java index 9d99ff1ce..861565711 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ANYConfigCUsActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 SAP and others. All rights reserved. This + * Copyright (c) 2011, 2017 SAP 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 - * - * Contributors: + * + * Contributors: * SAP - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; @@ -42,6 +42,7 @@ public class ANYConfigCUsActionTest extends ActionTest { private IMetadataRepository metadataRepo; private DataLoader loader; + @Override public void setUp() throws Exception { // configuration spec for creation of filterless CUs @@ -171,6 +172,7 @@ public class ANYConfigCUsActionTest extends ActionTest { assertTrue("my.property", body.indexOf("setProgramProperty(propName:my.property,propValue:${#123}a${#44}b${#58}c${#59}${#36}d${#125});") > -1); //$NON-NLS-1$ //$NON-NLS-2$ } + @Override protected void insertPublisherInfoBehavior() { loader = new DataLoader(configLocation, executableLocation); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java index ac160a4dc..a76fabae9 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AbstractPublisherActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -49,10 +49,12 @@ public final class AbstractPublisherActionTest extends AbstractProvisioningTest this.updateDescriptor = updateDescriptor; } + @Override public boolean isApplicable(String configSpec, boolean includeDefault, String id, Version version) { return id.equals("test"); } + @Override public IUpdateDescriptor getUpdateDescriptor(InstallableUnitDescription iu) { return this.updateDescriptor; } @@ -69,6 +71,7 @@ public final class AbstractPublisherActionTest extends AbstractProvisioningTest this.metaRequiredCapability = metaRequiredCapability; } + @Override public IProvidedCapability[] getProvidedCapabilities(InstallableUnitDescription iu) { if (providedCapability == null) return null; @@ -76,6 +79,7 @@ public final class AbstractPublisherActionTest extends AbstractProvisioningTest return new IProvidedCapability[] {providedCapability}; } + @Override public IRequirement[] getRequiredCapabilities(InstallableUnitDescription iu) { if (requiredCapability == null) return null; @@ -83,6 +87,7 @@ public final class AbstractPublisherActionTest extends AbstractProvisioningTest return new IRequirement[] {requiredCapability}; } + @Override public IRequirement[] getMetaRequiredCapabilities(InstallableUnitDescription iu) { if (metaRequiredCapability == null) return null; @@ -90,6 +95,7 @@ public final class AbstractPublisherActionTest extends AbstractProvisioningTest return new IRequirement[] {metaRequiredCapability}; } + @Override public boolean isApplicable(String configSpec, boolean includeDefault, String id, Version version) { return id.equals("test"); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java index cabc4e891..da76625b6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AccumulateConfigDataActionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 @@ -40,9 +40,10 @@ public class AccumulateConfigDataActionTest extends ActionTest { Capture<ConfigAdvice> configAdviceCapture; Capture<LaunchingAdvice> launchingAdviceCapture; + @Override public void setUp() throws Exception { - configAdviceCapture = new Capture<ConfigAdvice>(); - launchingAdviceCapture = new Capture<LaunchingAdvice>(); + configAdviceCapture = new Capture<>(); + launchingAdviceCapture = new Capture<>(); setupPublisherInfo(); setupPublisherResult(); testAction = new AccumulateConfigDataAction(publisherInfo, configSpec, configLocation, executableLocation); @@ -95,6 +96,7 @@ public class AccumulateConfigDataActionTest extends ActionTest { fail(); } + @Override protected void insertPublisherInfoBehavior() { ConfigData configData = new ConfigData(fwName, fwVersion, launcherName, launcherVersion); ConfigAdvice configAdvice = new ConfigAdvice(configData, configSpec); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java index aaaa136b7..89a5cf3be 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; @@ -26,7 +26,6 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; import org.hamcrest.*; import org.junit.Assert; -@SuppressWarnings({"cast", "unchecked"}) public abstract class ActionTest extends AbstractProvisioningTest { protected static final String COMMA_SEPARATOR = ","; //$NON-NLS-1$ protected static final String JAR = "jar";//$NON-NLS-1$ @@ -49,13 +48,13 @@ public abstract class ActionTest extends AbstractProvisioningTest { public static String[] getArrayFromString(String list, String separator) { if (list == null || list.trim().equals("")) //$NON-NLS-1$ return new String[0]; - List<String> result = new ArrayList<String>(); + List<String> result = new ArrayList<>(); for (StringTokenizer tokens = new StringTokenizer(list, separator); tokens.hasMoreTokens();) { String token = tokens.nextToken().trim(); if (!token.equals("")) //$NON-NLS-1$ result.add(token); } - return (String[]) result.toArray(new String[result.size()]); + return result.toArray(new String[result.size()]); } protected void verifyProvidedCapability(Collection<IProvidedCapability> prov, String namespace, String name, Version version) { @@ -199,7 +198,7 @@ public abstract class ActionTest extends AbstractProvisioningTest { /** * Adds an installable unit in the context visible to actions. - * + * * @see AbstractPublisherAction#queryForIU */ protected final void addContextIU(String unitId, String unitVersion) { @@ -209,7 +208,7 @@ public abstract class ActionTest extends AbstractProvisioningTest { /** * Adds an installable unit in the context visible to actions. - * + * * @see AbstractPublisherAction#queryForIU */ protected final void addContextIU(String unitId, String unitVersion, String filter) { @@ -231,6 +230,7 @@ public abstract class ActionTest extends AbstractProvisioningTest { final IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(id); return new TypeSafeMatcher<IPublisherResult>() { + @Override public void describeTo(Description description) { description.appendText("contains a unit " + id); } @@ -247,6 +247,7 @@ public abstract class ActionTest extends AbstractProvisioningTest { final IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(id); return new TypeSafeMatcher<IPublisherResult>() { + @Override public void describeTo(Description description) { description.appendText("contains exactly one unit " + id); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceMatcher.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceMatcher.java index 77f5496e0..636163acd 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceMatcher.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/AdviceMatcher.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -34,10 +34,12 @@ public class AdviceMatcher implements IArgumentMatcher { this.version = version; } + @Override public void appendTo(StringBuffer buf) { buf.append("AdviceMatcher[" + id + ',' + version + ']'); } + @Override public boolean matches(Object arg) { if (!(arg instanceof IPublisherAdvice)) return false; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java index 343bf1cab..6a525fab0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/BundlesActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development * SAP AG - allow setting greedy through directive (bug 247099) @@ -38,7 +38,6 @@ import org.eclipse.equinox.p2.tests.TestData; import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; -@SuppressWarnings({"unchecked"}) public class BundlesActionTest extends ActionTest { private static final String OSGI = PublisherHelper.OSGI_BUNDLE_CLASSIFIER; private static final String JAVA_PACKAGE = "java.package";//$NON-NLS-1$ @@ -100,11 +99,11 @@ public class BundlesActionTest extends ActionTest { @Override public void setupPublisherInfo() { - tpAdvice1 = new MultiCapture<ITouchpointAdvice>(); - tpAdvice2 = new MultiCapture<ITouchpointAdvice>(); + tpAdvice1 = new MultiCapture<>(); + tpAdvice2 = new MultiCapture<>(); - udAdvice3 = new MultiCapture<IUpdateDescriptorAdvice>(); - capAdvice5 = new MultiCapture<ICapabilityAdvice>(); + udAdvice3 = new MultiCapture<>(); + capAdvice5 = new MultiCapture<>(); super.setupPublisherInfo(); } @@ -286,7 +285,7 @@ public class BundlesActionTest extends ActionTest { } private void verifyBundle3() { - // also a regression test for bug 393051: manifest headers use uncommon (but valid) capitalization + // also a regression test for bug 393051: manifest headers use uncommon (but valid) capitalization ArrayList ius = new ArrayList(publisherResult.getIUs(TEST3_PROVBUNDLE_NAME, IPublisherResult.ROOT)); assertTrue(ius.size() == 1); @@ -338,6 +337,7 @@ public class BundlesActionTest extends ActionTest { assertTrue(max == 7); } + @Override public void cleanup() { super.cleanup(); if (artifactRepository != null) { @@ -346,14 +346,15 @@ public class BundlesActionTest extends ActionTest { } } + @Override protected void insertPublisherInfoBehavior() { //super sets publisherInfo.getMetadataRepository and publisherInfo.getContextMetadataRepository super.insertPublisherInfoBehavior(); - Map<String, String> sarProperties = new HashMap<String, String>(); + Map<String, String> sarProperties = new HashMap<>(); sarProperties.put("key1", "value1");//$NON-NLS-1$//$NON-NLS-2$ sarProperties.put("key2", "value2");//$NON-NLS-1$//$NON-NLS-2$ - Map<String, String> sdkProperties = new HashMap<String, String>(); + Map<String, String> sdkProperties = new HashMap<>(); sdkProperties.put("key1", "value1");//$NON-NLS-1$//$NON-NLS-2$ sdkProperties.put("key2", "value2");//$NON-NLS-1$//$NON-NLS-2$ @@ -401,9 +402,9 @@ public class BundlesActionTest extends ActionTest { } private void expectOtherAdviceQueries(String bundleName, Version bundleVersion) { - expect(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, ICapabilityAdvice.class)).andReturn(Collections.EMPTY_LIST); //$NON-NLS-1$ - expect(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, IAdditionalInstallableUnitAdvice.class)).andReturn(Collections.EMPTY_LIST); //$NON-NLS-1$ - expect(publisherInfo.getAdvice(null, true, bundleName, bundleVersion, IBundleShapeAdvice.class)).andReturn(null); //$NON-NLS-1$ + expect(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, ICapabilityAdvice.class)).andReturn(Collections.EMPTY_LIST); + expect(publisherInfo.getAdvice(null, false, bundleName, bundleVersion, IAdditionalInstallableUnitAdvice.class)).andReturn(Collections.EMPTY_LIST); + expect(publisherInfo.getAdvice(null, true, bundleName, bundleVersion, IBundleShapeAdvice.class)).andReturn(null); } private void expectCapabilityAdviceQuery(String bundleName, Version bundleVersion, Collection<ICapabilityAdvice> answer) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/CaptureList.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/CaptureList.java index 95f2424a7..c605c28f6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/CaptureList.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/CaptureList.java @@ -1,23 +1,22 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; import java.util.AbstractList; -import java.util.List; import org.easymock.Capture; /** * An object that adapts an EasyMock Capture to a List. */ -public class CaptureList<E> extends AbstractList<E> implements List<E> { +public class CaptureList<E> extends AbstractList<E> { private Capture<E> capture; public CaptureList(Capture<E> capture) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java index fcc5d8e59..8ff6112f4 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ConfigCUsActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development ******************************************************************************/ @@ -37,6 +37,7 @@ public class ConfigCUsActionTest extends ActionTest { private IMetadataRepository metadataRepo; private DataLoader loader; + @Override public void setUp() throws Exception { setupPublisherInfo(); setupPublisherResult(); @@ -119,6 +120,7 @@ public class ConfigCUsActionTest extends ActionTest { assertTrue("my.property", body.indexOf("setProgramProperty(propName:my.property,propValue:${#123}a${#44}b${#58}c${#59}${#36}d${#125});") > -1); } + @Override protected void insertPublisherInfoBehavior() { loader = new DataLoader(configLocation, executableLocation); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ContextRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ContextRepositoryTest.java index 520bab510..5ef286779 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ContextRepositoryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ContextRepositoryTest.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2010 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2010, 2017 EclipseSource 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 @@ -25,9 +25,7 @@ public class ContextRepositoryTest extends AbstractProvisioningTest { */ public class TestPublisherApplication extends AbstractPublisherApplication { - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.publisher.AbstractPublisherApplication#createActions() - */ + @Override protected IPublisherAction[] createActions() { return new IPublisherAction[0]; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java index 9fd739350..0bff49b18 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxExecutableActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development ******************************************************************************/ @@ -32,14 +32,13 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.tests.TestActivator; import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository; -@SuppressWarnings({"unchecked"}) public class EquinoxExecutableActionTest extends ActionTest { private static final File MAC_EXEC = new File(TestActivator.getTestDataFolder(), "EquinoxExecutableActionTest/macosx/"); //$NON-NLS-1$ private static final File LINUX_EXEC = new File(TestActivator.getTestDataFolder(), "EquinoxExecutableActionTest/linux/"); //$NON-NLS-1$ private static final File WIN_EXEC = new File(TestActivator.getTestDataFolder(), "EquinoxExecutableActionTest/win/"); //$NON-NLS-1$ private final String EXECUTABLE_NAME = "LauncherName"; //$NON-NLS-1$ - private Collection<IBrandingAdvice> brandingAdvice = new LinkedList<IBrandingAdvice>(); + private Collection<IBrandingAdvice> brandingAdvice = new LinkedList<>(); private String macConfigCocoa = "cocoa.macosx.x86"; //$NON-NLS-1$ private String winConfig = "win32.win32.x86"; //$NON-NLS-1$ private String linuxConfig = "linux.gtk.x86"; //$NON-NLS-1$ @@ -49,6 +48,7 @@ public class EquinoxExecutableActionTest extends ActionTest { private String id; private String[] expectedExecutablesContents; + @Override public void setUp() throws Exception { setupPublisherInfo(); setupPublisherResult(); @@ -99,7 +99,7 @@ public class EquinoxExecutableActionTest extends ActionTest { testAction = new EquinoxExecutableAction(executablesDescriptor, config, idBase, version, flavorArg); testAction.perform(publisherInfo, publisherResult, new NullProgressMonitor()); verifyResults(idBase, config); - debug("Completed EquinoxExecutableActionTest " + idBase + " test."); //$NON-NLS-1$ //$NON-NLS-2$ + debug("Completed EquinoxExecutableActionTest " + idBase + " test."); //$NON-NLS-1$ //$NON-NLS-2$ } private void verifyResults(String idBase, String confSpec) { @@ -117,13 +117,13 @@ public class EquinoxExecutableActionTest extends ActionTest { String _arch = config[2]; for (int i = 0; i < iuList.size(); i++) { IInstallableUnit possibleEclipse = (IInstallableUnit) iuList.get(i); - if (possibleEclipse.getId().equals(flavorArg + idBase + ".executable." + confSpec)) {//$NON-NLS-1$ + if (possibleEclipse.getId().equals(flavorArg + idBase + ".executable." + confSpec)) {//$NON-NLS-1$ IInstallableUnitFragment fragment = (IInstallableUnitFragment) iuList.get(i); Collection<IProvidedCapability> providedCapability = fragment.getProvidedCapabilities(); - verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, flavorArg + idBase + ".executable." + confSpec, version); //$NON-NLS-1$ + verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, flavorArg + idBase + ".executable." + confSpec, version); //$NON-NLS-1$ assertTrue(providedCapability.size() == 1); Collection<IRequirement> requiredCapability = fragment.getHost(); - verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + confSpec, new VersionRange(version, true, version, true)); //$NON-NLS-1$ + verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + confSpec, new VersionRange(version, true, version, true)); //$NON-NLS-1$ assertTrue(requiredCapability.size() == 1); assertTrue(fragment.getFilter().getParameters()[0].toString().indexOf("(osgi.ws=" + _ws + ")") != -1); @@ -142,7 +142,7 @@ public class EquinoxExecutableActionTest extends ActionTest { if (possibleEclipse.getId().equals((idBase + ".executable." + confSpec + "." + EXECUTABLE_NAME))) { //$NON-NLS-1$//$NON-NLS-2$ assertTrue(possibleEclipse.getVersion().equals(version)); Collection<IProvidedCapability> providedCapability = possibleEclipse.getProvidedCapabilities(); - verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + confSpec + "." + EXECUTABLE_NAME, version); //$NON-NLS-1$ //$NON-NLS-2$ + verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + confSpec + "." + EXECUTABLE_NAME, version); //$NON-NLS-1$ //$NON-NLS-2$ assertTrue(providedCapability.size() == 1); Collection<IRequirement> req = possibleEclipse.getRequirements(); assertTrue(req.size() == 0); @@ -167,12 +167,12 @@ public class EquinoxExecutableActionTest extends ActionTest { assertTrue(eKey.getId().equals(idBase + ".executable." + confSpec)); //$NON-NLS-1$ assertTrue(eKey.getVersion().equals(version)); Collection<IProvidedCapability> providedCapabilities = possibleExec.getProvidedCapabilities(); - verifyProvidedCapability(providedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + confSpec, version); //$NON-NLS-1$ + verifyProvidedCapability(providedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, idBase + ".executable." + confSpec, version); //$NON-NLS-1$ verifyProvidedCapability(providedCapabilities, flavorArg + idBase, idBase + ".executable", version); //$NON-NLS-1$ assertTrue(providedCapabilities.size() == 2); Collection<IRequirement> requiredCapability = possibleExec.getRequirements(); - verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.equinox.launcher." + (idBase.equals("mac") || idBase.equals("macCocoa") ? confSpec.substring(0, confSpec.lastIndexOf(".")) : confSpec), VersionRange.emptyRange); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.equinox.launcher." + (idBase.equals("mac") || idBase.equals("macCocoa") ? confSpec.substring(0, confSpec.lastIndexOf(".")) : confSpec), VersionRange.emptyRange); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ assertTrue(requiredCapability.size() == 1); try { @@ -212,9 +212,9 @@ public class EquinoxExecutableActionTest extends ActionTest { file.delete(); } - /** + /** * If present, check that the Info.plist had its various values - * properly rewritten. + * properly rewritten. * @param zip file to check for the Info.plist */ private void checkInfoPlist(ZipFile zip) { @@ -265,6 +265,7 @@ public class EquinoxExecutableActionTest extends ActionTest { } } + @Override protected void insertPublisherInfoBehavior() { setupArtifactRepository(); expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); @@ -274,18 +275,22 @@ public class EquinoxExecutableActionTest extends ActionTest { private void setupBrandingAdvice(final String osArg, final String config, final File exec, final File icon) { brandingAdvice.add(new IBrandingAdvice() { + @Override public boolean isApplicable(String configSpec, boolean includeDefault, String id, Version version) { return true; } + @Override public String getOS() { return osArg; } + @Override public String[] getIcons() { return icon == null ? null : new String[] {icon.getAbsolutePath()}; } + @Override public String getExecutableName() { return EXECUTABLE_NAME; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java index 55761f4fb..bfa5960a7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/EquinoxLauncherCUActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development ******************************************************************************/ @@ -31,6 +31,7 @@ public class EquinoxLauncherCUActionTest extends ActionTest { private static String c_ID = EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER; private static String d_ID = EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER + ".source";//$NON-NLS-1$ + @Override public void setUp() throws Exception { setupPublisherInfo(); setupPublisherResult(); @@ -63,12 +64,12 @@ public class EquinoxLauncherCUActionTest extends ActionTest { assertTrue(iu instanceof InstallableUnitFragment); //verify required capability verifyRequiredCapability(((InstallableUnitFragment) iu).getHost(), PublisherHelper.OSGI_BUNDLE_CLASSIFIER, EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER, VersionRange.emptyRange); - verifyRequiredCapability(((InstallableUnitFragment) iu).getHost(), PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "bundle", new VersionRange(Version.create("1.0.0"), true, Version.create("2.0.0"), false), 1, 1, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + verifyRequiredCapability(((InstallableUnitFragment) iu).getHost(), PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "bundle", new VersionRange(Version.create("1.0.0"), true, Version.create("2.0.0"), false), 1, 1, false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ assertEquals(2, (((InstallableUnitFragment) iu).getHost().size())); Collection<IProvidedCapability> cap = iu.getProvidedCapabilities(); - verifyProvidedCapability(cap, IInstallableUnit.NAMESPACE_IU_ID, flavorArg + "org.eclipse.equinox.launcher", Version.emptyVersion); //$NON-NLS-1$ - verifyProvidedCapability(cap, "org.eclipse.equinox.p2.flavor", flavorArg, Version.create("1.0.0")); //$NON-NLS-1$//$NON-NLS-2$ + verifyProvidedCapability(cap, IInstallableUnit.NAMESPACE_IU_ID, flavorArg + "org.eclipse.equinox.launcher", Version.emptyVersion); //$NON-NLS-1$ + verifyProvidedCapability(cap, "org.eclipse.equinox.p2.flavor", flavorArg, Version.create("1.0.0")); //$NON-NLS-1$//$NON-NLS-2$ assertTrue(cap.size() == 2); Map prop = iu.getProperties(); @@ -79,6 +80,7 @@ public class EquinoxLauncherCUActionTest extends ActionTest { fail(); } + @Override public void setupPublisherResult() { publisherResult = new PublisherResult(); ArrayList iuList = new ArrayList(); @@ -89,6 +91,7 @@ public class EquinoxLauncherCUActionTest extends ActionTest { publisherResult.addIUs(iuList, IPublisherResult.ROOT); } + @Override protected void insertPublisherInfoBehavior() { VersionAdvice versionAdvice = new VersionAdvice(); versionAdvice.setVersion(IInstallableUnit.NAMESPACE_IU_ID, flavorArg + "org.eclipse.equinox.launcher", Version.emptyVersion); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java index ef30a43f0..5c09cb967 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/FeaturesActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development ******************************************************************************/ @@ -49,9 +49,10 @@ public class FeaturesActionTest extends ActionTest { private String FOO = "foo"; //$NON-NLS-1$ private Capture<ITouchpointAdvice> tpAdvice; + @Override public void setUp() throws Exception { testAction = new FeaturesAction(new File[] {root}); - tpAdvice = new Capture<ITouchpointAdvice>(); + tpAdvice = new Capture<>(); setupPublisherInfo(); setupPublisherResult(); } @@ -194,7 +195,7 @@ public class FeaturesActionTest extends ActionTest { Collection<IProvidedCapability> fooProvidedCapabilities = foo.getProvidedCapabilities(); contains(fooProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "foo.feature.jar", fooVersion); //$NON-NLS-1$ - contains(fooProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", fooVersion); //$NON-NLS-1$ + contains(fooProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", fooVersion); //$NON-NLS-1$ contains(fooProvidedCapabilities, "org.eclipse.update.feature", FOO, fooVersion); //$NON-NLS-1$ assertTrue(fooProvidedCapabilities.size() == 3); @@ -245,8 +246,8 @@ public class FeaturesActionTest extends ActionTest { assertTrue(barRequiredCapabilities.size() == 0); Collection<IProvidedCapability> barProvidedCapabilities = bar.getProvidedCapabilities(); - contains(barProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar.feature.jar", barVersion); //$NON-NLS-1$ - contains(barProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", fooVersion); //$NON-NLS-1$ + contains(barProvidedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, "bar.feature.jar", barVersion); //$NON-NLS-1$ + contains(barProvidedCapabilities, PublisherHelper.NAMESPACE_ECLIPSE_TYPE, "feature", fooVersion); //$NON-NLS-1$ contains(barProvidedCapabilities, "org.eclipse.update.feature", BAR, barVersion); //$NON-NLS-1$ assertTrue(barProvidedCapabilities.size() == 3); } @@ -261,6 +262,7 @@ public class FeaturesActionTest extends ActionTest { TestData.assertContains(expected, actualStream, true); } + @Override protected void insertPublisherInfoBehavior() { //setup metadataRepository with barIU metadataRepository = new TestMetadataRepository(getAgent(), new IInstallableUnit[] {mockIU(BAR, null)}); @@ -293,7 +295,7 @@ public class FeaturesActionTest extends ActionTest { } private ArrayList fillAdvice(ArrayList adviceCollection) { - Map<String, String> prop = new HashMap<String, String>(); + Map<String, String> prop = new HashMap<>(); prop.put("key1", "value1"); //$NON-NLS-1$//$NON-NLS-2$ prop.put("key2", "value2"); //$NON-NLS-1$//$NON-NLS-2$ IPropertyAdvice propertyAdvice = EasyMock.createMock(IPropertyAdvice.class); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java index d1098794e..32d05e216 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/JREActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development * SAP AG - ongoing development @@ -32,7 +32,6 @@ import org.eclipse.equinox.p2.tests.*; import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository; import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; -@SuppressWarnings({"unchecked"}) public class JREActionTest extends ActionTest { private File J14 = new File(TestActivator.getTestDataFolder(), "JREActionTest/1.4/"); //$NON-NLS-1$ @@ -44,12 +43,13 @@ public class JREActionTest extends ActionTest { protected TestArtifactRepository artifactRepository = new TestArtifactRepository(getAgent()); protected TestMetadataRepository metadataRepository; + @Override public void setUp() throws Exception { setupPublisherInfo(); setupPublisherResult(); } - // TODO this name is misleading: the test doesn't test the real Java 1.4 JRE IU but a broken local copy of the 1.4 profile + // TODO this name is misleading: the test doesn't test the real Java 1.4 JRE IU but a broken local copy of the 1.4 profile public void test14() throws Exception { performAction(new JREAction(J14)); @@ -189,11 +189,11 @@ public class JREActionTest extends ActionTest { assertTrue(((ITouchpointInstruction) instructions.get("uninstall")).getBody().equals("cleanupzip(source:@artifact, target:${installFolder});")); //$NON-NLS-1$ //$NON-NLS-2$ assertTrue(bar instanceof IInstallableUnitFragment); Collection<IRequirement> requiredCapability = ((IInstallableUnitFragment) bar).getHost(); - verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, id, new VersionRange(jreVersion, true, Version.MAX_VERSION, true)); //$NON-NLS-1$ + verifyRequiredCapability(requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, id, new VersionRange(jreVersion, true, Version.MAX_VERSION, true)); assertTrue(requiredCapability.size() == 1); Collection<IProvidedCapability> providedCapability = bar.getProvidedCapabilities(); - verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, "config." + id, jreVersion); //$NON-NLS-1$ + verifyProvidedCapability(providedCapability, IInstallableUnit.NAMESPACE_IU_ID, "config." + id, jreVersion); //$NON-NLS-1$ assertTrue(providedCapability.size() == 1); assertTrue(bar.getProperty("org.eclipse.equinox.p2.type.fragment").equals("true")); //$NON-NLS-1$//$NON-NLS-2$ @@ -203,11 +203,7 @@ public class JREActionTest extends ActionTest { private void verifyArtifactRepository(IArtifactKey key, File JRELocation, final String fileName) throws IOException { assertTrue(artifactRepository.contains(key)); ByteArrayOutputStream content = new ByteArrayOutputStream(); - FileFilter fileFilter = new FileFilter() { - public boolean accept(File file) { - return file.getName().endsWith(fileName); - } - }; + FileFilter fileFilter = file -> file.getName().endsWith(fileName); File[] contentBytes = JRELocation.listFiles(fileFilter); FileUtils.copyStream(new FileInputStream(contentBytes[0]), false, content, true); ZipInputStream zipInputStream = artifactRepository.getZipInputStream(key); @@ -230,6 +226,7 @@ public class JREActionTest extends ActionTest { return iu.getProvidedCapabilities(); } + @Override protected void insertPublisherInfoBehavior() { expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_PUBLISH).anyTimes(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java index ecc29a5cf..f87581dd2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalUpdateSiteActionTest.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -20,16 +20,10 @@ import org.eclipse.equinox.p2.publisher.IPublisherInfo; import org.eclipse.equinox.p2.tests.TestData; import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository; -/** - * - */ public class LocalUpdateSiteActionTest extends ActionTest { protected TestArtifactRepository artifactRepository = new TestArtifactRepository(getAgent()); - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.tests.AbstractProvisioningTest#setUp() - */ @Override protected void setUp() throws Exception { super.setUp(); @@ -37,6 +31,7 @@ public class LocalUpdateSiteActionTest extends ActionTest { setupPublisherInfo(); } + @Override protected void insertPublisherInfoBehavior() { super.insertPublisherInfoBehavior(); expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); @@ -46,7 +41,7 @@ public class LocalUpdateSiteActionTest extends ActionTest { /** * This test uses a simple site.xml (with a zipped up feature) and ensures - * that the metadata to unzip the feature is available. + * that the metadata to unzip the feature is available. * @throws Exception */ public void testUnzipTouchpointAction() throws Exception { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java index e16f3f59b..92f42d4e9 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/LocalizationTests.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2009, 2011 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -42,9 +42,7 @@ public class LocalizationTests extends AbstractProvisioningTest { return utils; } - /* (non-Javadoc) - * @see junit.framework.TestCase#setUp() - */ + @Override protected void setUp() throws Exception { super.setUp(); info = new PublisherInfo(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MultiCapture.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MultiCapture.java index 14ecad6d9..e1e248700 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MultiCapture.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MultiCapture.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -20,42 +20,52 @@ public class MultiCapture<T> extends Capture<T> implements Collection<T> { private static final long serialVersionUID = 1L; private final List captured = new ArrayList(); + @Override public boolean add(T arg0) { return captured.add(arg0); } + @Override public boolean addAll(Collection arg0) { return captured.addAll(arg0); } + @Override public void clear() { captured.clear(); } + @Override public boolean contains(Object arg0) { return captured.contains(arg0); } + @Override public boolean containsAll(Collection arg0) { return captured.containsAll(arg0); } + @Override public boolean isEmpty() { return captured.isEmpty(); } + @Override public Iterator iterator() { return captured.iterator(); } + @Override public boolean remove(Object arg0) { return captured.remove(arg0); } + @Override public boolean removeAll(Collection arg0) { return captured.removeAll(arg0); } + @Override public boolean retainAll(Collection arg0) { return captured.retainAll(arg0); } @@ -66,14 +76,17 @@ public class MultiCapture<T> extends Capture<T> implements Collection<T> { super.setValue(value); } + @Override public int size() { return captured.size(); } + @Override public Object[] toArray() { return captured.toArray(); } + @Override public Object[] toArray(Object[] arg0) { return captured.toArray(arg0); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java index 4da44836a..93baee38a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development * SAP AG - ongoing development @@ -46,6 +46,7 @@ public class ProductActionCapturingTest extends ActionTest { return createNiceMock(IPublisherInfo.class); } + @Override protected void insertPublisherInfoBehavior() { // capture these calls for assertions publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(RootIUAdvice.class), EasyMock.capture(rootIUAdviceCapture))); @@ -58,15 +59,16 @@ public class ProductActionCapturingTest extends ActionTest { expectLastCall().anyTimes(); } + @Override public void setUp() throws Exception { - rootIUAdviceCapture = new Capture<RootIUAdvice>(); - productFileAdviceCapture = new Capture<ProductFileAdvice>(); + rootIUAdviceCapture = new Capture<>(); + productFileAdviceCapture = new Capture<>(); setupPublisherInfo(); setupPublisherResult(); } /** - * Tests that a product file containing bundle configuration data produces appropriate + * Tests that a product file containing bundle configuration data produces appropriate * IConfigAdvice (start levels, auto-start). */ public void testSetBundleConfigData() throws Exception { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java index aac25bd43..a30ab6424 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development * SAP AG - ongoing development @@ -56,11 +56,13 @@ public class ProductActionTest extends ActionTest { return createNiceMock(IPublisherInfo.class); } + @Override public void setUp() throws Exception { setupPublisherInfo(); setupPublisherResult(); } + @Override public void setupPublisherInfo() { PublisherInfo publisherInfoImpl = new PublisherInfo(); publisherInfoImpl.setArtifactRepository(artifactRepository); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java index 410d71a6c..ddc28b6a2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM - initial API and implementation *******************************************************************************/ @@ -45,6 +45,7 @@ public class ProductActionTestMac extends ActionTest { return createNiceMock(IPublisherInfo.class); } + @Override protected void insertPublisherInfoBehavior() { publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(RootIUAdvice.class), EasyMock.capture(rootIUAdviceCapture))); publisherInfo.addAdvice(EasyMock.and(EasyMock.isA(ProductFileAdvice.class), EasyMock.capture(productFileAdviceCapture))); @@ -53,10 +54,11 @@ public class ProductActionTestMac extends ActionTest { expectLastCall().anyTimes(); } + @Override public void setUp() throws Exception { configSpec = AbstractPublisherAction.createConfigSpec("carbon", "macosx", "x86"); - rootIUAdviceCapture = new Capture<RootIUAdvice>(); - productFileAdviceCapture = new Capture<ProductFileAdvice>(); + rootIUAdviceCapture = new Capture<>(); + productFileAdviceCapture = new Capture<>(); setupPublisherInfo(); setupPublisherResult(); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionWithJRELocationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionWithJRELocationTest.java index a5eed95f3..4bf57e628 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionWithJRELocationTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionWithJRELocationTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2011 SAP AG and others. All rights reserved. This + * Copyright (c) 2011, 2017 SAP AG 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 - * - * Contributors: + * + * Contributors: * SAP AG - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.publisher.actions; @@ -36,7 +36,7 @@ public class ProductActionWithJRELocationTest extends AbstractProvisioningTest { public void testWithJRELocationFolder() throws Exception { File productFileLocation = TestData.getFile("ProductActionTest", "productWithLicense.product"); File jreLocation = TestData.getFile("JREActionTest", "packageVersions"); - List<IProvidedCapability> expectedProvidedCapabilities = new ArrayList<IProvidedCapability>(); + List<IProvidedCapability> expectedProvidedCapabilities = new ArrayList<>(); expectedProvidedCapabilities.add(MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, "my.package", null)); expectedProvidedCapabilities.add(MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, "my.package", Version.create("1.0.0"))); testTemplate(productFileLocation, jreLocation, "a.jre.test", Version.create("1.0.0"), expectedProvidedCapabilities); @@ -45,7 +45,7 @@ public class ProductActionWithJRELocationTest extends AbstractProvisioningTest { public void testWithJREProfile() throws Exception { File productFileLocation = TestData.getFile("ProductActionTest", "productWithLicense.product"); File jreLocation = TestData.getFile("JREActionTest", "packageVersions/test-1.0.0.profile"); - List<IProvidedCapability> expectedProvidedCapabilities = new ArrayList<IProvidedCapability>(); + List<IProvidedCapability> expectedProvidedCapabilities = new ArrayList<>(); expectedProvidedCapabilities.add(MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, "my.package", null)); expectedProvidedCapabilities.add(MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, "my.package", Version.create("1.0.0"))); testTemplate(productFileLocation, jreLocation, "a.jre.test", Version.create("1.0.0"), expectedProvidedCapabilities); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductContentTypeTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductContentTypeTest.java index a7f91b1cb..1ab27559c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductContentTypeTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductContentTypeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2012 SAP AG and others. + * Copyright (c) 2011, 2017 SAP AG 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 @@ -39,6 +39,7 @@ public class ProductContentTypeTest extends ActionTest { private IInstallableUnit featureIU = createIU("TestFeature.feature.group"); private IInstallableUnit bundleIU = createIU("TestBundle"); + @Override public void setUp() throws Exception { setupPublisherResult(); initCUsList(); @@ -72,7 +73,7 @@ public class ProductContentTypeTest extends ActionTest { } /** - * Publish product with invalid value for attribute <code>type</code>. + * Publish product with invalid value for attribute <code>type</code>. */ public void test04PublishWithInvalidContentType() throws Exception { File productFileLocation = TestData.getFile(TEST_DATA_FOLDER, "InvalidContentType.product"); @@ -100,7 +101,7 @@ public class ProductContentTypeTest extends ActionTest { /** * Publish product with attributes <code>type="bundles"</code> and <code>useFeatures="true"</code>. * Check that the generated product IU - * requires the default CU list + CU for the product + bundle IU. + * requires the default CU list + CU for the product + bundle IU. */ public void test06OverrideUseFeaturesAttr() throws Exception { testTemplate("OverrideUseFeaturesAttr.product", "1", cusList.size() + 2, bundleIU); @@ -116,7 +117,7 @@ public class ProductContentTypeTest extends ActionTest { } private void initCUsList() { - cusList = new ArrayList<IInstallableUnit>(); + cusList = new ArrayList<>(); cusList.add(createIU(flavor + ".source.default")); cusList.add(createIU(flavor + ".osgi.bundle.default")); cusList.add(createIU(flavor + ".org.eclipse.update.feature.default")); @@ -151,7 +152,7 @@ public class ProductContentTypeTest extends ActionTest { private void verifyRequirementsForConfigurationUnits(Collection<IRequirement> requirements, String productName, String productVersion) { - List<IInstallableUnit> cusListCopy = new ArrayList<IInstallableUnit>(cusList); + List<IInstallableUnit> cusListCopy = new ArrayList<>(cusList); cusListCopy.add(createIU(flavor + productName + ".configuration", Version.create(productVersion))); for (Iterator<IInstallableUnit> cusIterator = cusListCopy.iterator(); cusIterator.hasNext();) { IInstallableUnit cu = cusIterator.next(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java index 0919e18a3..2bac1f095 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileAdviceTest.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -34,9 +34,7 @@ public class ProductFileAdviceTest extends AbstractProvisioningTest { String configFile = "/org.eclipse.equinox.p2.tests/testData/ProductActionTest/productWithConfig/config.ini"; - /* (non-Javadoc) - * @see junit.framework.TestCase#setUp() - */ + @Override protected void setUp() throws Exception { super.setUp(); productFileLocation = TestData.getFile("ProductActionTest/productWithConfig", "sample.product").toString(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java index 7c0c36402..9a9d5eedc 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductFileTest.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2009, 2011 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -39,6 +39,7 @@ public class ProductFileTest extends TestCase { private String uidProductFileLocation; private ProductFile uidProductFile; + @Override protected void setUp() throws Exception { productFileLocation = TestData.getFile("ProductActionTest/productWithConfig", "sample.product").toString(); noLauncherFlag = new ProductFile(TestData.getFile("ProductActionTest/launcherFlags", "noLauncherFlag.product").toString()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java index e30e96ffd..190b70a1c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootFilesActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development ******************************************************************************/ @@ -28,7 +28,6 @@ import org.eclipse.equinox.p2.tests.TestActivator; import org.eclipse.equinox.p2.tests.TestData; import org.eclipse.equinox.p2.tests.publisher.TestArtifactRepository; -@SuppressWarnings({"unchecked"}) public class RootFilesActionTest extends ActionTest { private static final int INCLUDES_ROOT = 1; private static final int ARTIFACT_REPO = 2; @@ -62,6 +61,7 @@ public class RootFilesActionTest extends ActionTest { } } + @Override public void insertPublisherInfoBehavior() { expect(publisherInfo.getArtifactRepository()).andReturn(artifactRepository).anyTimes(); expect(publisherInfo.getArtifactOptions()).andReturn(IPublisherInfo.A_INDEX | IPublisherInfo.A_OVERWRITE | IPublisherInfo.A_PUBLISH).anyTimes(); @@ -116,7 +116,7 @@ public class RootFilesActionTest extends ActionTest { } /** - * + * * @return a list of relative files to the rootPath. */ private Map getRepoFiles(Map map) { @@ -128,6 +128,7 @@ public class RootFilesActionTest extends ActionTest { return map; } + @Override public void cleanup() { super.cleanup(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java index b0ba056c6..392e484b2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/RootIUActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 - * - * Contributors: + * + * Contributors: * Code 9 - initial API and implementation * IBM - ongoing development ******************************************************************************/ @@ -24,7 +24,6 @@ import org.eclipse.equinox.p2.query.MatchQuery; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.tests.TestMetadataRepository; -@SuppressWarnings({"unchecked"}) public class RootIUActionTest extends ActionTest { private static final int CONTAINS_A = 1; private static final int CONTAINS_B = 2; @@ -230,6 +229,7 @@ public class RootIUActionTest extends ActionTest { rootIUAdviceCollection = new ArrayList(); if ((testSpec & CONTAINS_A) > 0) { query = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (candidate instanceof IInstallableUnit) if (((IInstallableUnit) candidate).getId().equals(iu_A)) @@ -241,6 +241,7 @@ public class RootIUActionTest extends ActionTest { } if ((testSpec & CONTAINS_B) > 0) { query = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { if (candidate instanceof IInstallableUnit) if (((IInstallableUnit) candidate).getId().equals(iu_B)) @@ -252,6 +253,7 @@ public class RootIUActionTest extends ActionTest { } if ((testSpec & EMPTY) > 0) { query = new MatchQuery() { + @Override public boolean isMatch(Object candidate) { return false; } @@ -338,6 +340,7 @@ public class RootIUActionTest extends ActionTest { rootIUAdviceCollection.add(new RootIUAdvice(publishIUs)); } + @Override public void insertPublisherInfoBehavior() { expect(publisherInfo.getAdvice(null, false, rootIU, versionArg, ICapabilityAdvice.class)).andReturn(new ArrayList()).anyTimes(); expect(publisherInfo.getAdvice(null, true, null, null, IRootIUAdvice.class)).andReturn(rootIUAdviceCollection).anyTimes(); @@ -351,6 +354,7 @@ public class RootIUActionTest extends ActionTest { expect(publisherInfo.getContextMetadataRepository()).andReturn(null).anyTimes(); } + @Override public void cleanup() { super.cleanup(); rootIUAdviceCollection = null; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/StatusMatchers.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/StatusMatchers.java index 309a81c0c..79352d536 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/StatusMatchers.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/StatusMatchers.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 SAP AG and others. + * Copyright (c) 2012, 2017 SAP AG 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 @@ -18,6 +18,7 @@ public class StatusMatchers { public static Matcher<IStatus> errorStatus() { return new TypeSafeMatcher<IStatus>() { + @Override public void describeTo(Description description) { description.appendText("a status with severity ERROR"); } @@ -32,6 +33,7 @@ public class StatusMatchers { public static Matcher<IStatus> okStatus() { return new TypeSafeMatcher<IStatus>() { + @Override public void describeTo(Description description) { description.appendText("a status with severity OK"); } @@ -46,6 +48,7 @@ public class StatusMatchers { public static Matcher<IStatus> statusWithMessageWhich(final Matcher<String> messageMatcher) { return new TypeSafeMatcher<IStatus>() { + @Override public void describeTo(Description description) { description.appendText("a status with a message which is "); description.appendDescriptionOf(messageMatcher); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java index 53982106a..73721be38 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ql/PerformanceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2017 Cloudsmith Inc. 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 @@ -267,7 +267,7 @@ public class PerformanceTest extends AbstractProvisioningTest { } public void testSlicerPerformance() throws Exception { - HashMap<String, String> env = new HashMap<String, String>(); + HashMap<String, String> env = new HashMap<>(); env.put("osgi.os", "linux"); env.put("osgi.ws", "gtk"); env.put("osgi.arch", "x86"); @@ -298,6 +298,7 @@ public class PerformanceTest extends AbstractProvisioningTest { } // Check the size of the last slice to verify that it's the same as the traverse size r = slice.query(new MatchQuery() { + @Override public boolean isMatch(Object value) { return true; } @@ -312,7 +313,7 @@ public class PerformanceTest extends AbstractProvisioningTest { } public void testPermissiveSlicerPerformance() throws Exception { - HashMap<String, String> env = new HashMap<String, String>(); + HashMap<String, String> env = new HashMap<>(); //env.put("osgi.os", "linux"); //env.put("osgi.ws", "gtk"); //env.put("osgi.arch", "x86"); @@ -343,6 +344,7 @@ public class PerformanceTest extends AbstractProvisioningTest { } // Check the size of the last slice to verify that it's the same as the traverse size r = slice.query(new MatchQuery() { + @Override public boolean isMatch(Object value) { return true; } @@ -366,7 +368,7 @@ public class PerformanceTest extends AbstractProvisioningTest { } private IInstallableUnit[] gatherAvailableInstallableUnits(IQueryable queryable) { - ArrayList<IInstallableUnit> list = new ArrayList<IInstallableUnit>(); + ArrayList<IInstallableUnit> list = new ArrayList<>(); IQueryResult<IInstallableUnit> matches = queryable.query(QueryUtil.createIUAnyQuery(), null); for (Iterator<IInstallableUnit> it = matches.iterator(); it.hasNext();) list.add(it.next()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java index d0fabf593..2f4715fb7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation * Ericsson AB - Ongoing development @@ -214,11 +214,9 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest { if (parent != null) { parent = parent.getParentFile(); if (parent != null) { - File[] children = parent.listFiles(new FileFilter() { - public boolean accept(File pathname) { - String name = pathname.getName(); - return name.startsWith("eclipse-platform-"); - } + File[] children = parent.listFiles((FileFilter) pathname -> { + String name = pathname.getName(); + return name.startsWith("eclipse-platform-"); }); if (children != null && children.length == 1) file = children[0]; @@ -386,7 +384,7 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest { * Run the reconciler to discover changes in the drop-ins folder and update the system state. */ public void reconcile(String message, boolean clean) { - List<String> args = new ArrayList<String>(); + List<String> args = new ArrayList<>(); args.add("-application"); args.add("org.eclipse.equinox.p2.reconciler.application"); if (clean) @@ -562,7 +560,7 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest { } /* - * Assert that a feature with the given id exists in the configuration. If + * Assert that a feature with the given id exists in the configuration. If * a version is specified then match the version, otherwise any version will * do. */ @@ -628,7 +626,7 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest { if (!exe.exists()) exe = new File(root, "java"); assertTrue("Java executable not found in: " + exe.getAbsolutePath(), exe.exists()); - List<String> command = new ArrayList<String>(); + List<String> command = new ArrayList<>(); Collections.addAll(command, new String[] {(new File(location == null ? output : location, getExeFolder() + "eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-vm", exe.getAbsolutePath()}); Collections.addAll(command, args); Collections.addAll(command, new String[] {"-vmArgs", "-Dosgi.checkConfiguration=true"}); @@ -712,7 +710,7 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest { "-repository", sourceRepo, "-installIU", iuToInstall, // "-destination", installFolder.getAbsolutePath(), // "-bundlepool", installFolder.getAbsolutePath(), // - "-roaming", "-profile", "PlatformProfile", "-profileProperties", "org.eclipse.update.install.features=true", // + "-roaming", "-profile", "PlatformProfile", "-profileProperties", "org.eclipse.update.install.features=true", // "-p2.os", Platform.getOS(), "-p2.ws", Platform.getWS(), "-p2.arch", Platform.getOSArch()}; return runEclipse(message, command); } @@ -754,13 +752,10 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest { if (destination == null) destination = output; destination = new File(destination, getRootFolder() + "plugins"); - File[] verifierBundle = destination.listFiles(new FilenameFilter() { - - public boolean accept(File dir, String name) { - if (name.startsWith(VERIFIER_BUNDLE_ID)) - return true; - return false; - } + File[] verifierBundle = destination.listFiles((FilenameFilter) (dir, name) -> { + if (name.startsWith(VERIFIER_BUNDLE_ID)) + return true; + return false; }); if (verifierBundle != null && verifierBundle.length > 0) verifierBundle[0].delete(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractSharedBundleProductTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractSharedBundleProductTest.java index 7ae4307d5..1f25e27f7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractSharedBundleProductTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractSharedBundleProductTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -40,7 +40,7 @@ public class AbstractSharedBundleProductTest extends AbstractReconcilerTest { // list.add("org.eclipse.core.net.win32.x86"); // list.add("org.eclipse.equinox.security.win32.x86"); final String[] bootstrap = new String[] { // - "org.eclipse.core.contenttype", // + "org.eclipse.core.contenttype", // "org.eclipse.core.expressions", // "org.eclipse.core.jobs", // "org.eclipse.core.net", // @@ -111,6 +111,7 @@ public class AbstractSharedBundleProductTest extends AbstractReconcilerTest { /* (non-Javadoc) * @see org.eclipse.equinox.p2.tests.reconciler.dropins.AbstractReconcilerTest#initialize() */ + @Override public void initialize() throws Exception { // extract the platform archive to the output folder @@ -129,11 +130,7 @@ public class AbstractSharedBundleProductTest extends AbstractReconcilerTest { // move all bundles (except launchers) to the shared location File bundles = new File(output, "eclipse/plugins"); File sharedBundleLocation = new File(shared, "plugins"); - FileFilter filter = new FileFilter() { - public boolean accept(File pathname) { - return !pathname.getName().contains("equinox.launcher"); - } - }; + FileFilter filter = pathname -> !pathname.getName().contains("equinox.launcher"); move("2.0", bundles, sharedBundleLocation, filter); // update the bundles.info file to contain only the boostrap bundles diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ReconcilerTestSuite.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ReconcilerTestSuite.java index 9de65bdfa..48e544f41 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ReconcilerTestSuite.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ReconcilerTestSuite.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -37,9 +37,7 @@ public class ReconcilerTestSuite extends TestSuite { return propertyToPlatformArchive; } - /* (non-Javadoc) - * @see junit.framework.TestSuite#tests() - */ + @Override public Enumeration tests() { Vector result = new Vector(); result.add(INITIALIZE); @@ -49,16 +47,12 @@ public class ReconcilerTestSuite extends TestSuite { return result.elements(); } - /* (non-Javadoc) - * @see junit.framework.TestSuite#testCount() - */ + @Override public int testCount() { return super.testCount() + 2; } - /* (non-Javadoc) - * @see junit.framework.TestSuite#testAt(int) - */ + @Override public Test testAt(int index) { if (index == 0) return INITIALIZE; @@ -77,10 +71,11 @@ public class ReconcilerTestSuite extends TestSuite { /** * Runs the tests and collects their result in a TestResult. - * + * * We must override this method in order to run against JUnit4 which doesn't * invoke tests(). */ + @Override public void run(TestResult result) { for (Enumeration e = tests(); e.hasMoreElements();) { Test each = (Test) e.nextElement(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedBundleProductTestSuite.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedBundleProductTestSuite.java index c2f11b9c5..a33dce64d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedBundleProductTestSuite.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedBundleProductTestSuite.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2010, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -22,10 +22,12 @@ public class SharedBundleProductTestSuite extends ReconcilerTestSuite { super(propertyToPlatformArchive); } + @Override public Test getInitializationTest() { return new AbstractSharedBundleProductTest("initialize", getPlatformArchive()); } + @Override public Test getCleanUpTest() { return new AbstractSharedBundleProductTest("cleanup"); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabled.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabled.java index a7e3b4c94..51c01ff51 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabled.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabled.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2013 IBM Corporation and others. + * Copyright (c) 2013, 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 - * + * * Contributors: * Red Hat, Inc. - initial API and implementation *******************************************************************************/ @@ -33,6 +33,7 @@ public class SharedInstallTestsProfileSpoofEnabled extends SharedInstallTests { super(name); } + @Override public void reconcileReadOnly(String message) { File root = new File(Activator.getBundleContext().getProperty("java.home")); root = new File(root, "bin"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabledConfigured.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabledConfigured.java index e5dd8284f..07ef2739f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabledConfigured.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabledConfigured.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2003 IBM Corporation and others. + * Copyright (c) 2003, 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 - * + * * Contributors: * Red Hat, Inc. - initial API and implementation *******************************************************************************/ @@ -84,6 +84,7 @@ public class SharedInstallTestsProfileSpoofEnabledConfigured extends SharedInsta super.tearDown(); } + @Override public void testBasicStartup() throws IOException { assertInitialized(); setupReadOnlyInstall(); @@ -110,6 +111,7 @@ public class SharedInstallTestsProfileSpoofEnabledConfigured extends SharedInsta } } + @Override public void testReadOnlyDropinsStartup() throws IOException { if (Platform.getOS().equals(Platform.OS_MACOSX)) return; @@ -175,6 +177,7 @@ public class SharedInstallTestsProfileSpoofEnabledConfigured extends SharedInsta } } + @Override public void testUserDropinsStartup() throws IOException { if (Platform.getOS().equals(Platform.OS_MACOSX)) return; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java index ca633192a..8009af35e 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/CacheManagerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 EclipseSource. + * Copyright (c) 2011, 2017 EclipseSource. * 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 @@ -96,10 +96,12 @@ public class CacheManagerTest extends TestCase { private class AgentLocationMock implements IAgentLocation { + @Override public URI getDataArea(final String namespace) { return repositoryLocation; } + @Override public URI getRootLocation() { // ignore return null; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java index 085e22b75..8158c44e8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest2.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2012 Wind River and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2012, 2017 Wind River 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 - * + * * Contributors: * Wind River - initial API and implementation *******************************************************************************/ @@ -47,6 +47,7 @@ public class FileReaderTest2 extends AbstractProvisioningTest { boolean isPaused = false; float downloadProgressEventAfterPaused = 0; + @Override public void notify(EventObject event) { if (event instanceof DownloadProgressEvent) { downloadIsOngoing = true; @@ -196,6 +197,7 @@ public class FileReaderTest2 extends AbstractProvisioningTest { ProvisioningListener listener = new ProvisioningListener() { boolean startedPauseJob = false; + @Override public void notify(EventObject o) { if (!startedPauseJob && o instanceof DownloadProgressEvent) { pauseJob.schedule(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/NTLMTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/NTLMTest.java index 93b0426d8..43a3127b0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/NTLMTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/NTLMTest.java @@ -1,11 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010, Cloudsmith Inc. + * Copyright (c) 2009, 2017 Cloudsmith Inc. * The code, documentation and other materials contained herein have been * licensed under the Eclipse Public License - v 1.0 by the copyright holder * listed above, as the Initial Contributor under such license. The text of * such license is available at www.eclipse.org. ******************************************************************************/ - package org.eclipse.equinox.p2.tests.repository; import java.net.URI; @@ -23,6 +22,7 @@ public class NTLMTest extends AbstractTestServerClientCase { private URI repoLoc; protected String authTestFailMessage; + @Override public void setUp() throws Exception { super.setUp(); mgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/TimeoutTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/TimeoutTest.java index 94898cebf..a902acc05 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/TimeoutTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/TimeoutTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010, Cloudsmith Inc. + * Copyright (c) 2009, 2017 Cloudsmith Inc. and others. * The code, documentation and other materials contained herein have been * licensed under the Eclipse Public License - v 1.0 by the copyright holder * listed above, as the Initial Contributor under such license. The text of @@ -28,10 +28,6 @@ public class TimeoutTest extends AbstractTestServerClientCase { protected String authTestFailMessage; - public void setUp() throws Exception { - super.setUp(); - } - @Override public void tearDown() throws Exception { AllServerTests.setServiceUI(null); // cleanup hook @@ -213,11 +209,13 @@ public class TimeoutTest extends AbstractTestServerClientCase { public class AladdinNotSavedService extends UIServices { public int counter = 0; + @Override public AuthenticationInfo getUsernamePassword(String location) { counter++; return new AuthenticationInfo("Aladdin", "open sesame", false); } + @Override public AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo) { counter++; assertEquals("Aladdin", previousInfo.getUserName()); @@ -229,6 +227,7 @@ public class TimeoutTest extends AbstractTestServerClientCase { /** * Not used */ + @Override public TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail) { return new TrustInfo(null, false, true); } @@ -243,6 +242,7 @@ public class TimeoutTest extends AbstractTestServerClientCase { theDelay = delay; } + @Override public void run() { try { Thread.sleep(theDelay); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/BaseChangeExtendedConfigured.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/BaseChangeExtendedConfigured.java index ef6672e5c..95ab753d1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/BaseChangeExtendedConfigured.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/BaseChangeExtendedConfigured.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2013 Ericsson AB and others. All rights reserved. This + * Copyright (c) 2013, 2017 Ericsson AB 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 - * - * Contributors: + * + * Contributors: * Ericsson AB - initial API and implementation * Red Hat, Inc. - fragment support ******************************************************************************/ @@ -63,7 +63,7 @@ public class BaseChangeExtendedConfigured extends BaseChange { if (!exe.exists()) exe = new File(root, "java"); assertTrue("Java executable not found in: " + exe.getAbsolutePath(), exe.exists()); - List<String> command = new ArrayList<String>(); + List<String> command = new ArrayList<>(); Collections.addAll(command, new String[] {(new File(location == null ? output : location, getExeFolder() + "eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-vm", exe.getAbsolutePath()}); Collections.addAll(command, args); Collections.addAll(command, new String[] {"-vmArgs", "-Dosgi.checkConfiguration=true"}); @@ -96,6 +96,7 @@ public class BaseChangeExtendedConfigured extends BaseChange { runEclipse("user2", output, new String[] {"-configuration", userBase.getAbsolutePath() + java.io.File.separatorChar + "configuration", "-application", "org.eclipse.equinox.p2.director", "-installIU", "p2TestFeature2.feature.group", "-repository", getTestRepo()}, extension); } + @Override protected void installVerifierInBase() { setReadOnly(readOnlyBase, false); runEclipse("Running eclipse", output, new String[] {"-application", "org.eclipse.equinox.p2.director", "-installIU", "Verifier.feature.group", "-repository", getTestRepo()}); @@ -143,7 +144,7 @@ public class BaseChangeExtendedConfigured extends BaseChange { //install verifier again installVerifierInBase(); - // next start is with extensions, should find zzz and verifier, and no other bundles + // next start is with extensions, should find zzz and verifier, and no other bundles // as base was changed and user configuration is ignored Properties verificationProperties = new Properties(); verificationProperties.setProperty("checkPresenceOfVerifier", "true"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/BaseChangeExtendedConflicts.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/BaseChangeExtendedConflicts.java index c9442d781..36384a947 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/BaseChangeExtendedConflicts.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/BaseChangeExtendedConflicts.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2013 Ericsson AB and others. All rights reserved. This + * Copyright (c) 2013, 2017 Ericsson AB 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 - * - * Contributors: + * + * Contributors: * Ericsson AB - initial API and implementation * Red Hat, Inc. - fragment support ******************************************************************************/ @@ -63,7 +63,7 @@ public class BaseChangeExtendedConflicts extends BaseChange { if (!exe.exists()) exe = new File(root, "java"); assertTrue("Java executable not found in: " + exe.getAbsolutePath(), exe.exists()); - List<String> command = new ArrayList<String>(); + List<String> command = new ArrayList<>(); Collections.addAll(command, new String[] {(new File(location == null ? output : location, getExeFolder() + "eclipse")).getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-vm", exe.getAbsolutePath()}); Collections.addAll(command, args); Collections.addAll(command, new String[] {"-vmArgs", "-Dosgi.checkConfiguration=true"}); @@ -96,6 +96,7 @@ public class BaseChangeExtendedConflicts extends BaseChange { runEclipse("user2", output, new String[] {"-configuration", userBase.getAbsolutePath() + java.io.File.separatorChar + "configuration", "-application", "org.eclipse.equinox.p2.director", "-installIU", "p2TestFeature2.feature.group", "-repository", getTestRepo()}, extension); } + @Override protected void installVerifierInBase() { setReadOnly(readOnlyBase, false); runEclipse("Running eclipse", output, new String[] {"-application", "org.eclipse.equinox.p2.director", "-installIU", "Verifier.feature.group", "-repository", getTestRepo()}); @@ -143,7 +144,7 @@ public class BaseChangeExtendedConflicts extends BaseChange { //install verifier again installVerifierInBase(); - // next start is with extensions, should find zzz and verifier, and no other bundles + // next start is with extensions, should find zzz and verifier, and no other bundles // as base was changed and user configuration is ignored Properties verificationProperties = new Properties(); verificationProperties.setProperty("checkPresenceOfVerifier", "true"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/InitialSharedInstall.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/InitialSharedInstall.java index 4e160b508..a3ac9918a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/InitialSharedInstall.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/InitialSharedInstall.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2013 Ericsson AB and others. All rights reserved. This + * Copyright (c) 2013, 2017 Ericsson AB 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 - * - * Contributors: + * + * Contributors: * Ericsson AB - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.sharedinstall; @@ -17,7 +17,7 @@ import org.eclipse.equinox.p2.tests.reconciler.dropins.ReconcilerTestSuite; //This test verifies that when eclipse runs for the first time and it has been run previously, then the migration wizard is presented. -//This test is separated in two classes. +//This test is separated in two classes. //This class is responsible for setting up eclipse once //The second class (InitialSharedInstallReadTest) is responsible for carrying out the real test //The test is setup this way in order to reuse all the testing infrastructure without having the modify much of it. @@ -59,12 +59,10 @@ public class InitialSharedInstall extends AbstractSharedInstallTest { private void cleanupDotEclipseFolder() { File userHome = new File(System.getProperty("user.home")); File dotEclipse = new File(userHome, ".eclipse"); - File[] toDelete = dotEclipse.listFiles(new FilenameFilter() { - public boolean accept(File dir, String name) { - if (name.startsWith("p2.automated.test")) - return true; - return false; - } + File[] toDelete = dotEclipse.listFiles((FilenameFilter) (dir, name) -> { + if (name.startsWith("p2.automated.test")) + return true; + return false; }); for (int i = 0; i < toDelete.length; i++) { delete(toDelete[i]); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java index 0a138eac4..191c1e381 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2015 Ericsson and others. + * Copyright (c) 2012, 2017 Ericsson 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 @@ -28,13 +28,14 @@ import org.osgi.service.prefs.BackingStoreException; import org.osgi.service.prefs.Preferences; public class SharedProfilePreferencesTest extends AbstractProvisioningTest { + @Override protected void setUp() throws Exception { //We don't call super.setUp() on purpose Bundle p2Core = Platform.getBundle("org.eclipse.equinox.p2.core"); p2Core.stop(); - //We have to do all this dance to copy the files because if we store them at the actual path, then the path is too long + //We have to do all this dance to copy the files because if we store them at the actual path, then the path is too long File baseInstallToCopy = getTestData("baseInstall", "testData/sharedPrefs/test1/baseInstall"); File baseInstall = getTempFolder(); File baseInstallToCopyTo = new File(baseInstall, "p2/org.eclipse.equinox.p2.engine/profileRegistry"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java index 72637cb55..455ad656c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2015 Ericsson and others. + * Copyright (c) 2012, 2017 Ericsson 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 @@ -25,6 +25,7 @@ import org.eclipse.equinox.p2.tests.TestActivator; import org.osgi.framework.Bundle; public class SharedProfilePreferencesTestWithDataInUser extends AbstractProvisioningTest { + @Override protected void setUp() throws Exception { //We don't call super.setUp() on purpose diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java index aed5bf148..3d88a4145 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 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 @@ -29,10 +29,12 @@ public abstract class AbstractSimpleConfiguratorTest extends AbstractProvisionin static String BUNDLE_JAR_DIRECTORY = "simpleConfiguratorTest/bundlesTxt2"; private EmbeddedEquinox equinox = null; + @Override protected void setUp() throws Exception { super.setUp(); } + @Override protected void tearDown() throws Exception { super.tearDown(); if (equinox != null) @@ -182,11 +184,7 @@ public abstract class AbstractSimpleConfiguratorTest extends AbstractProvisionin } protected File[] getBundleJars(File directory) { - FilenameFilter bundleFilter = new FilenameFilter() { - public boolean accept(File directoryName, String filename) { - return !filename.startsWith(".") && !filename.equals("CVS"); - } - }; + FilenameFilter bundleFilter = (directoryName, filename) -> !filename.startsWith(".") && !filename.equals("CVS"); return directory.listFiles(bundleFilter); } } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/BundlesTxtTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/BundlesTxtTest.java index 3c3aed777..0a8c7f9ce 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/BundlesTxtTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/BundlesTxtTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Red Hat, Inc. - fragment support @@ -24,6 +24,7 @@ public class BundlesTxtTest extends AbstractSimpleConfiguratorTest { protected File[] jars = null; protected File bundleInfo = null; + @Override protected void setUp() throws Exception { super.setUp(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/NonExclusiveMode.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/NonExclusiveMode.java index 5e093c8bf..ff67cd1c1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/NonExclusiveMode.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/NonExclusiveMode.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Red Hat, Inc. - tests @@ -20,6 +20,7 @@ public class NonExclusiveMode extends AbstractSimpleConfiguratorTest { private File[] jars = null; private File bundleInfo = null; + @Override protected void setUp() throws Exception { super.setUp(); jars = getBundleJars(TestData.getFile(BUNDLE_JAR_DIRECTORY, "")); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTest.java index c32dcdb6b..7e1d6a1e2 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2012,2013 Red Hat, Inc. and others. All rights reserved. This + * Copyright (c) 2012,2017 Red Hat, Inc. 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 - * - * Contributors: + * + * Contributors: * Red Hat, Inc. - initial API and implementation * Ericsson AB - ongoing development * Red Hat, Inc. - fragment support @@ -27,6 +27,7 @@ public class SimpleConfiguratorTest extends AbstractProvisioningTest { protected URL[] localConfiguration = new URL[1]; protected SimpleConfiguratorImpl configurator; + @Override public void setUp() throws Exception { relativeURL = new URL("file://bundles.info"); File tmp = getTempFolder(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorUtilsExtendedConfiguredTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorUtilsExtendedConfiguredTest.java index 814667553..175d2f678 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorUtilsExtendedConfiguredTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorUtilsExtendedConfiguredTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 IBM Corporation and others. + * Copyright (c) 2008, 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 @@ -127,6 +127,7 @@ public class SimpleConfiguratorUtilsExtendedConfiguredTest extends SimpleConfigu } //on adding extension master must be selected in order to create new profile with extensions! + @Override public void testSharedConfigurationMasterUnmodified() throws IOException { storeTimestamp(new File(masterConfguration, relativeURL.getFile()).lastModified()); assertEquals(sharedConfiguration[1], configurator.chooseConfigurationURL(relativeURL, sharedConfiguration)); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorTests.java index c46209f3f..f0f0a5a94 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorTests.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -115,7 +115,7 @@ public class SimpleConfiguratorManipulatorTests extends AbstractProvisioningTest List<BundleInfo> installedAndExtendedL = Arrays.asList(installedAndExtendedInfo); List<BundleInfo> installedL = Arrays.asList(installedInfo); - List<BundleInfo> extendedL = new ArrayList<BundleInfo>(installedAndExtendedL); + List<BundleInfo> extendedL = new ArrayList<>(installedAndExtendedL); extendedL.removeAll(installedL); assertTrue(installedAndExtendedL.containsAll(installedL)); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/AbstractTestServerClientCase.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/AbstractTestServerClientCase.java index a4d07e4cd..f97bcc3cc 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/AbstractTestServerClientCase.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/AbstractTestServerClientCase.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 Cloudsmith and others. + * Copyright (c) 2009, 2017 Cloudsmith 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 - * + * * Contributors: * Cloudsmith - initial API and implementation * Red Hat Inc. - Bug 460967 @@ -28,6 +28,7 @@ public class AbstractTestServerClientCase extends TestCase { super(name); } + @Override public void run(TestResult result) { Protectable p = new ProtectedRunner(result); result.runProtected(this, p); @@ -58,11 +59,13 @@ public class AbstractTestServerClientCase extends TestCase { TestServerController.checkTearDown(); } + @Override public void tearDown() throws Exception { // if a test is run out or order - this must be done TestServerController.checkTearDown(); } + @Override public void setUp() throws Exception { // if a test is run out or order - this must be done TestServerController.checkSetUp(); @@ -75,6 +78,7 @@ public class AbstractTestServerClientCase extends TestCase { this.result = result; } + @Override public void protect() throws Exception { oneTimeSetUp(); basicRun(result); @@ -113,10 +117,12 @@ public class AbstractTestServerClientCase extends TestCase { public class AladdinNotSavedService extends UIServices { + @Override public AuthenticationInfo getUsernamePassword(String location) { return new AuthenticationInfo("Aladdin", "open sesame", false); } + @Override public AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo) { assertEquals("Aladdin", previousInfo.getUserName()); assertEquals("open sesame", previousInfo.getPassword()); @@ -127,6 +133,7 @@ public class AbstractTestServerClientCase extends TestCase { /** * Not used */ + @Override public TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail) { return new TrustInfo(null, false, true); } @@ -139,10 +146,12 @@ public class AbstractTestServerClientCase extends TestCase { */ public class BadLoginService extends UIServices { + @Override public AuthenticationInfo getUsernamePassword(String location) { return new AuthenticationInfo("moria", "friend", false); } + @Override public AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo) { assertEquals("moria", previousInfo.getUserName()); assertEquals("friend", previousInfo.getPassword()); @@ -153,6 +162,7 @@ public class AbstractTestServerClientCase extends TestCase { /** * Not used */ + @Override public TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail) { return new TrustInfo(null, false, true); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/TestServerController.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/TestServerController.java index 0018901bf..892e34813 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/TestServerController.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/testserver/helper/TestServerController.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2016 Cloudsmith and others. + * Copyright (c) 2009, 2017 Cloudsmith 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 - * + * * Contributors: * Cloudsmith - initial API and implementation * Red Hat Inc. - Bug 460967 @@ -142,12 +142,14 @@ public class TestServerController { public static class DelegatingAuthService extends UIServices { + @Override public AuthenticationInfo getUsernamePassword(String location) { if (hookedAuthDialog != null) return hookedAuthDialog.getUsernamePassword(location); return null; } + @Override public AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo) { if (hookedAuthDialog != null) return hookedAuthDialog.getUsernamePassword(location, previousInfo); @@ -157,6 +159,7 @@ public class TestServerController { /** * Not used */ + @Override public TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail) { return new TrustInfo(null, false, true); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddJVMArgumentActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddJVMArgumentActionTest.java index 996a0c85c..0d9924187 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddJVMArgumentActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/AddJVMArgumentActionTest.java @@ -1,9 +1,9 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.touchpoint.eclipse; @@ -33,6 +33,7 @@ public class AddJVMArgumentActionTest extends AbstractProvisioningTest { super(""); } + @Override public void setUp() throws Exception { super.setUp(); tempDir = new File(System.getProperty("java.io.tmpdir"), "JVMArgs"); @@ -55,6 +56,7 @@ public class AddJVMArgumentActionTest extends AbstractProvisioningTest { launcherData = manipulator.getLauncherData(); } + @Override public void tearDown() throws Exception { delete(tempDir); super.tearDown(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java index 5e14cf70c..7214d4760 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/EclipseTouchpointTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. + * Copyright (c) 2005, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -134,7 +134,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest { IArtifactDescriptor descriptor = PublisherHelper.createArtifactDescriptor(key, osgiTarget); bundlePool.addDescriptor(descriptor); - Map<String, String> extraProperties = new HashMap<String, String>(); + Map<String, String> extraProperties = new HashMap<>(); extraProperties.put(IInstallableUnit.PROP_PARTIAL_IU, Boolean.TRUE.toString()); Dictionary mockManifest = new Properties(); @@ -172,7 +172,7 @@ public class EclipseTouchpointTest extends AbstractProvisioningTest { IArtifactDescriptor descriptor = PublisherHelper.createArtifactDescriptor(key, osgiTarget); bundlePool.addDescriptor(descriptor); - Map<String, String> extraProperties = new HashMap<String, String>(); + Map<String, String> extraProperties = new HashMap<>(); extraProperties.put(IInstallableUnit.PROP_PARTIAL_IU, Boolean.TRUE.toString()); Dictionary mockManifest = new Properties(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/JVMArgumentActionLogicTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/JVMArgumentActionLogicTest.java index 528c94ae4..d9891a274 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/JVMArgumentActionLogicTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/JVMArgumentActionLogicTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * Copyright (c) 2009, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -27,6 +27,7 @@ public class JVMArgumentActionLogicTest extends AbstractProvisioningTest { private Map parameters; private LauncherData launcherData; + @Override public void setUp() throws Exception { super.setUp(); tempDir = new File(System.getProperty("java.io.tmpdir"), "JVMArgs"); @@ -49,6 +50,7 @@ public class JVMArgumentActionLogicTest extends AbstractProvisioningTest { launcherData = manipulator.getLauncherData(); } + @Override public void tearDown() throws Exception { AbstractProvisioningTest.delete(tempDir); super.tearDown(); @@ -185,7 +187,7 @@ public class JVMArgumentActionLogicTest extends AbstractProvisioningTest { // Simulate a user injected value launcherData.addJvmArg(userValue); - // Add a larger value + // Add a larger value parameters.put(ActionConstants.PARM_JVM_ARG, largeValue); addAction.execute(Collections.unmodifiableMap(parameters)); assertTrue(Arrays.asList(launcherData.getJvmArgs()).contains(largeValue)); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/BackupStoreTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/BackupStoreTest.java index 485ef3faa..a82e591ac 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/BackupStoreTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/BackupStoreTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 EclipseSource and others. + * Copyright (c) 2014, 2017 EclipseSource 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 @@ -35,6 +35,7 @@ public class BackupStoreTest extends AbstractProvisioningTest { * </ul> * </ul> */ + @Override public void setUp() { // create some test files under user.home // do not want them under /tmp as it may be on its own file system (and even @@ -68,6 +69,7 @@ public class BackupStoreTest extends AbstractProvisioningTest { } } + @Override public void tearDown() { fullyDelete(sourceDir); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CheckAndPromptNativePackageWindowsRegistryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CheckAndPromptNativePackageWindowsRegistryTest.java index 0e24a1045..de5e77e6a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CheckAndPromptNativePackageWindowsRegistryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CheckAndPromptNativePackageWindowsRegistryTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2015 SAP SE and others. + * Copyright (c) 2015, 2017 SAP SE 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 - * + * * Contributors: * SAP SE - initial API and implementation *******************************************************************************/ @@ -53,7 +53,7 @@ public class CheckAndPromptNativePackageWindowsRegistryTest { prefsNode.put(attributeName, attributeValue); prefsNode.flush(); - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); NativeTouchpoint touchpoint = createTouchpoint(parameters); parameters.put(ActionConstants.PARM_LINUX_DISTRO, CheckAndPromptNativePackageWindowsRegistry.WINDOWS_DISTRO); parameters.put(ActionConstants.PARM_LINUX_PACKAGE_NAME, "windows package"); @@ -77,7 +77,7 @@ public class CheckAndPromptNativePackageWindowsRegistryTest { prefsNode.put(attributeName, attributeValue); prefsNode.flush(); - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); NativeTouchpoint touchpoint = createTouchpoint(parameters); parameters.put(ActionConstants.PARM_LINUX_DISTRO, CheckAndPromptNativePackageWindowsRegistry.WINDOWS_DISTRO); parameters.put(ActionConstants.PARM_LINUX_PACKAGE_NAME, "windows package"); @@ -101,7 +101,7 @@ public class CheckAndPromptNativePackageWindowsRegistryTest { prefsNode.putInt(attributeName, attributeValue); prefsNode.flush(); - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); NativeTouchpoint touchpoint = createTouchpoint(parameters); parameters.put(ActionConstants.PARM_LINUX_DISTRO, CheckAndPromptNativePackageWindowsRegistry.WINDOWS_DISTRO); parameters.put(ActionConstants.PARM_LINUX_PACKAGE_NAME, "windows package"); @@ -125,7 +125,7 @@ public class CheckAndPromptNativePackageWindowsRegistryTest { prefsNode.putInt(attributeName, attributeValue); prefsNode.flush(); - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); NativeTouchpoint touchpoint = createTouchpoint(parameters); parameters.put(ActionConstants.PARM_LINUX_DISTRO, CheckAndPromptNativePackageWindowsRegistry.WINDOWS_DISTRO); parameters.put(ActionConstants.PARM_LINUX_PACKAGE_NAME, "windows package"); @@ -145,7 +145,7 @@ public class CheckAndPromptNativePackageWindowsRegistryTest { @Test public void execute_KeyExistence() throws Exception { - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); NativeTouchpoint touchpoint = createTouchpoint(parameters); parameters.put(ActionConstants.PARM_LINUX_DISTRO, CheckAndPromptNativePackageWindowsRegistry.WINDOWS_DISTRO); parameters.put(ActionConstants.PARM_LINUX_PACKAGE_NAME, "windows package"); @@ -162,7 +162,7 @@ public class CheckAndPromptNativePackageWindowsRegistryTest { @Test public void execute_KeyExistence_DifferentKeys() throws Exception { - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); NativeTouchpoint touchpoint = createTouchpoint(parameters); parameters.put(ActionConstants.PARM_LINUX_DISTRO, CheckAndPromptNativePackageWindowsRegistry.WINDOWS_DISTRO); parameters.put(ActionConstants.PARM_LINUX_PACKAGE_NAME, "windows package"); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/UnzipActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/UnzipActionTest.java index 9c8fd12ed..d831b24f8 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/UnzipActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/UnzipActionTest.java @@ -1,9 +1,9 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2008, 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 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.tests.touchpoint.natives; @@ -202,17 +202,17 @@ public class UnzipActionTest extends AbstractProvisioningTest { String c2 = "car/c.txt"; { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_PATH, "foo"); testUnzip(parameters, getTempFolder(), new String[] {b1, c1}, new String[] {a, b, c}); } { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_PATH, "foo/"); testUnzip(parameters, getTempFolder(), new String[] {b1, c1}, new String[] {a, b, c}); } { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_PATH, "**/bar"); testUnzip(parameters, getTempFolder(), new String[] {c2}, new String[] {a, b, c, b1}); } @@ -228,19 +228,19 @@ public class UnzipActionTest extends AbstractProvisioningTest { // full path { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_INCLUDE, "foo/b.txt"); testUnzip(parameters, getTempFolder(), new String[] {b}, new String[] {a, c}); } // wildcarded path { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_INCLUDE, "*/b.txt"); testUnzip(parameters, getTempFolder(), new String[] {b}, new String[] {a, c}); } // subdir wildcarded path { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_INCLUDE, "**/c.txt"); testUnzip(parameters, getTempFolder(), new String[] {c}, new String[] {a, b}); } @@ -256,19 +256,19 @@ public class UnzipActionTest extends AbstractProvisioningTest { // full path { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_EXCLUDE, "foo/b.txt"); testUnzip(parameters, getTempFolder(), new String[] {a, c}, new String[] {b}); } // wildcarded path { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_EXCLUDE, "*/b.txt"); testUnzip(parameters, getTempFolder(), new String[] {a, c}, new String[] {b}); } // subdir wildcarded path { - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_EXCLUDE, "**/c.txt"); testUnzip(parameters, getTempFolder(), new String[] {a, b}, new String[] {c}); } @@ -282,7 +282,7 @@ public class UnzipActionTest extends AbstractProvisioningTest { String b = "foo/b.txt"; String c = "foo/bar/car/c.txt"; - Map<String, String> parameters = new HashMap<String, String>(); + Map<String, String> parameters = new HashMap<>(); parameters.put(ActionConstants.PARM_INCLUDE, "*.txt"); parameters.put(ActionConstants.PARM_EXCLUDE, "**/c.txt"); testUnzip(parameters, getTempFolder(), new String[] {a, b}, new String[] {c}); @@ -290,8 +290,8 @@ public class UnzipActionTest extends AbstractProvisioningTest { private void testUnzip(Map<String, String> params, File installFolder, String[] shoudlExistNames, String[] shoudlNotExistNames) { - ArrayList<File> shoudlExist = new ArrayList<File>(); - ArrayList<File> shoudlNotExist = new ArrayList<File>(); + ArrayList<File> shoudlExist = new ArrayList<>(); + ArrayList<File> shoudlNotExist = new ArrayList<>(); // first check that are no files in install folder for (String fileName : shoudlExistNames) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/TestUpdateListener.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/TestUpdateListener.java index d80cc0ae6..f07c74d14 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/TestUpdateListener.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/TestUpdateListener.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -37,6 +37,7 @@ public class TestUpdateListener implements IUpdateListener { return Arrays.equals(expectedEvent.getIUs().toArray(), actual.getIUs().toArray()) && expectedEvent.getProfileId().equals(actual.getProfileId()); } + @Override public void updatesAvailable(UpdateEvent event) { if (matches(event)) expectedCount++; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/UpdateCheckerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/UpdateCheckerTest.java index 944c25ef0..883e9c4c0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/UpdateCheckerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatechecker/UpdateCheckerTest.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.equinox.p2.tests.updatechecker; -import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; - import java.util.ArrayList; import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.director.IDirector; import org.eclipse.equinox.internal.provisional.p2.updatechecker.IUpdateChecker; import org.eclipse.equinox.internal.provisional.p2.updatechecker.UpdateEvent; @@ -60,7 +59,7 @@ public class UpdateCheckerTest extends AbstractProvisioningTest { public void testAddListener() { IUpdateChecker checker = getChecker(); - ArrayList<IInstallableUnit> toUpdate = new ArrayList<IInstallableUnit>(); + ArrayList<IInstallableUnit> toUpdate = new ArrayList<>(); toUpdate.add(toInstallIU); TestUpdateListener listener = new TestUpdateListener(new UpdateEvent(profile.getProfileId(), toUpdate)); checker.addUpdateCheck(profile.getProfileId(), QueryUtil.createIUAnyQuery(), IUpdateChecker.ONE_TIME_CHECK, 0, listener); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/LocalUpdatesiteTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/LocalUpdatesiteTest.java index 17cc26fe3..8ff9991e6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/LocalUpdatesiteTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/LocalUpdatesiteTest.java @@ -1,5 +1,5 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +/******************************************************************************* +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -24,6 +24,7 @@ import org.eclipse.equinox.p2.tests.TestData; public class LocalUpdatesiteTest extends AbstractProvisioningTest { protected File repoLocation; + @Override protected void setUp() throws Exception { super.setUp(); String tempDir = System.getProperty("java.io.tmpdir"); @@ -32,6 +33,7 @@ public class LocalUpdatesiteTest extends AbstractProvisioningTest { repoLocation.mkdir(); } + @Override protected void tearDown() throws Exception { getMetadataRepositoryManager().removeRepository(repoLocation.toURI()); delete(repoLocation); @@ -73,7 +75,7 @@ public class LocalUpdatesiteTest extends AbstractProvisioningTest { IInstallableUnit unit = (IInstallableUnit) iter.next(); IQuery<IInstallableUnit> memberQuery = QueryUtil.createIUCategoryMemberQuery(unit); IQueryResult<IInstallableUnit> categoryMembers = repository.query(memberQuery, new NullProgressMonitor()); - Set<String> membersId = new HashSet<String>(); + Set<String> membersId = new HashSet<>(); for (IInstallableUnit iu : categoryMembers.toUnmodifiableSet()) { membersId.add(iu.getId()); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java index f196d0d76..f0bcb5dc1 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 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 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -111,7 +111,7 @@ public class SiteXMLActionTest extends AbstractProvisioningTest { IInstallableUnit unit = (IInstallableUnit) iter.next(); IQuery<IInstallableUnit> memberQuery = QueryUtil.createIUCategoryMemberQuery(unit); IQueryResult<IInstallableUnit> categoryMembers = actionResult.query(memberQuery, new NullProgressMonitor()); - Set<String> membersId = new HashSet<String>(); + Set<String> membersId = new HashSet<>(); for (IInstallableUnit iu : categoryMembers.toUnmodifiableSet()) { membersId.add(iu.getId()); } |