Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-11-15 14:37:12 -0500
committerAlexander Kurtakov2017-11-15 14:37:12 -0500
commitdb56a7eb86825cf43f9b5b763ba38912f9c1d69b (patch)
treeaf0e79b6b7d9a978997a7d5a234246122edb617f
parent4c90517290482c613a11c58346f7e2fd2ece015d (diff)
downloadrt.equinox.p2-db56a7eb86825cf43f9b5b763ba38912f9c1d69b.tar.gz
rt.equinox.p2-db56a7eb86825cf43f9b5b763ba38912f9c1d69b.tar.xz
rt.equinox.p2-db56a7eb86825cf43f9b5b763ba38912f9c1d69b.zip
* Bump BREE. * Enable more warnings. * Update minor version. * Generify. * Add missing Override/Deprecate annotations. * Try-with-resources. Change-Id: Ib552796cc41bf978877264fd32078f5c936b774d Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/.settings/org.eclipse.jdt.core.prefs30
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java48
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java52
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ActionTest.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/UninstallActionTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/UpdateActionTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallationHistoryPageTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstalledSoftwarePageTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InvokeByHandlerTests.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RepositoryManipulationPageTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UninstallWizardTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/misc/LicenseManagerTest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/InstallOperationTests.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/OperationFactoryTest.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UninstallOperationTests.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AbstractQueryTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AnyRequiredCapabilityTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AvailableIUWrapperTest.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/CategoryElementWrapperTest.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/LatestIUVersionElementWrapperTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/MockQueryProvider.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryDescriptorTest.java46
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableMetadataRepositoryManagerTest.java23
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java14
36 files changed, 271 insertions, 250 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/.classpath b/bundles/org.eclipse.equinox.p2.tests.ui/.classpath
index 64c5e31b7..eca7bdba8 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/.classpath
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/.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/J2SE-1.5"/>
+ <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.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.tests.ui/.settings/org.eclipse.jdt.core.prefs
index a69c5a497..5cd7f49e4 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/.settings/org.eclipse.jdt.core.prefs
@@ -10,18 +10,23 @@ 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.5
+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.5
+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
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -33,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
@@ -53,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=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
@@ -63,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=ignore
@@ -71,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.rawTypeReference=warning
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
@@ -93,12 +100,16 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
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
@@ -106,6 +117,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=enabled
+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
@@ -118,7 +130,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=warning
-org.eclipse.jdt.core.compiler.source=1.5
+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.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
index b589824ca..c6bf1964a 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/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.ui
-Bundle-Version: 1.1.300.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.100",
@@ -20,7 +20,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.100",
org.eclipse.equinox.p2.tests;bundle-version="1.2.0",
org.eclipse.equinox.p2.ui.sdk;bundle-version="1.0.200",
org.eclipse.equinox.p2.ui.importexport;bundle-version="1.0.1"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.equinox.internal.p2.operations,
org.eclipse.equinox.p2.operations;version="[2.0.0,3.0.0)"
Eclipse-BundleShape: dir
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
index de54651a7..dfcbd43c6 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.tests.ui</artifactId>
- <version>1.1.300-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
index bc3401e88..e4ed54776 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 WindRiver Corporation and others.
+ * 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
@@ -38,7 +38,7 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
- ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<P2ImportExport, P2ImportExport>(TestActivator.getContext(), P2ImportExport.class, null);
+ ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<>(TestActivator.getContext(), P2ImportExport.class, null);
tracker.open();
importexportService = tracker.getService();
assertNotNull("Fail to get ImportExport service", importexportService);
@@ -64,17 +64,17 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
IMetadataRepository repo = metaManager.loadRepository(uri, null);
assertNotNull("Fail to load remote repo", repo);
IInstallableUnit iu = AbstractProvisioningTest.createIU("A", Version.create("1.0.0"));
- OutputStream output = new FileOutputStream(testFile);
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
- assertTrue("Not expected return result.", status.isOK());
- output.close();
- InputStream input = new FileInputStream(testFile);
- List<IUDetail> ius = importexportService.importP2F(input);
- assertEquals("Exported the number of features is not expected.", 1, ius.size());
- assertTrue("Exported feature is not expected.", iu.equals(ius.get(0).getIU()));
- assertEquals("Exported the number of referred repositories is not expected.", 1, ius.get(0).getReferencedRepositories().size());
- assertEquals("Exported referred repository is not expected.", uri, ius.get(0).getReferencedRepositories().get(0));
- input.close();
+ try (OutputStream output = new FileOutputStream(testFile)) {
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
+ assertTrue("Not expected return result.", status.isOK());
+ }
+ try (InputStream input = new FileInputStream(testFile)) {
+ List<IUDetail> ius = importexportService.importP2F(input);
+ assertEquals("Exported the number of features is not expected.", 1, ius.size());
+ assertTrue("Exported feature is not expected.", iu.equals(ius.get(0).getIU()));
+ assertEquals("Exported the number of referred repositories is not expected.", 1, ius.get(0).getReferencedRepositories().size());
+ assertEquals("Exported referred repository is not expected.", uri, ius.get(0).getReferencedRepositories().get(0));
+ }
} finally {
testFile.delete();
}
@@ -110,17 +110,17 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
IMetadataRepository repo = metaManager.loadRepository(uri, null);
assertNotNull("Fail to load remote repo", repo);
IInstallableUnit iu = AbstractProvisioningTest.createIU("A", Version.create("1.0.0"));
- OutputStream output = new FileOutputStream(testFile);
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
- assertTrue("Not expected return result.", status.isOK());
- output.close();
- InputStream input = new FileInputStream(testFile);
- List<IUDetail> ius = importexportService.importP2F(input);
- assertEquals("Exported the number of features is not expected.", 1, ius.size());
- assertTrue("Exported feature is not expected.", iu.equals(ius.get(0).getIU()));
- assertEquals("Exported the number of referred repositories is not expected.", 1, ius.get(0).getReferencedRepositories().size());
- assertEquals("Exported referred repository is not expected.", uri, ius.get(0).getReferencedRepositories().get(0));
- input.close();
+ try (OutputStream output = new FileOutputStream(testFile)) {
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
+ assertTrue("Not expected return result.", status.isOK());
+ }
+ try (InputStream input = new FileInputStream(testFile)) {
+ List<IUDetail> ius = importexportService.importP2F(input);
+ assertEquals("Exported the number of features is not expected.", 1, ius.size());
+ assertTrue("Exported feature is not expected.", iu.equals(ius.get(0).getIU()));
+ assertEquals("Exported the number of referred repositories is not expected.", 1, ius.get(0).getReferencedRepositories().size());
+ assertEquals("Exported referred repository is not expected.", uri, ius.get(0).getReferencedRepositories().get(0));
+ }
} finally {
testFile.delete();
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
index 12f4c3b16..7c17ea06d 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 WindRiver Corporation and others.
+ * 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
@@ -32,7 +32,7 @@ public class ImportExportTests extends AbstractProvisioningTest {
private P2ImportExport importexportService;
private List<IStatus> getChildren(IStatus s) {
- List<IStatus> rt = new ArrayList<IStatus>();
+ List<IStatus> rt = new ArrayList<>();
if (s.isMultiStatus()) {
for (IStatus child : s.getChildren()) {
rt.addAll(getChildren(child));
@@ -45,7 +45,7 @@ public class ImportExportTests extends AbstractProvisioningTest {
@Override
protected void setUp() throws Exception {
super.setUp();
- ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<P2ImportExport, P2ImportExport>(TestActivator.getContext(), P2ImportExport.class, null);
+ ServiceTracker<P2ImportExport, P2ImportExport> tracker = new ServiceTracker<>(TestActivator.getContext(), P2ImportExport.class, null);
tracker.open();
importexportService = tracker.getService();
assertNotNull("Fail to get ImportExport service", importexportService);
@@ -60,8 +60,8 @@ public class ImportExportTests extends AbstractProvisioningTest {
public void testLoadP2f() throws IOException {
File p2fFile = getTestData("Error load test file.", "testData/importexport/test.p2f");
- InputStream input = new FileInputStream(p2fFile);
- try {
+
+ try (InputStream input = new FileInputStream(p2fFile)) {
List<IUDetail> iuDetails = importexportService.importP2F(input);
assertTrue("Should load two features from the p2f file.", iuDetails.size() == 2);
int counter = 0;
@@ -75,32 +75,26 @@ public class ImportExportTests extends AbstractProvisioningTest {
}
}
assertEquals("Load unexpected content.", 2, counter);
- } finally {
- input.close();
}
}
public void testLoadUnknownP2f() throws IOException {
File p2fFile = getTestData("Error load test file.", "testData/importexport/unknownformat.p2f");
- InputStream input = new FileInputStream(p2fFile);
- try {
+
+ try (InputStream input = new FileInputStream(p2fFile)) {
List<IUDetail> iuDetails = importexportService.importP2F(input);
assertEquals("Should not load any detail.", 0, iuDetails.size());
- } finally {
- input.close();
}
}
public void testIncompatibleP2f() throws IOException {
File p2fFile = getTestData("Error load test file.", "testData/importexport/incompatible.p2f");
- InputStream input = new FileInputStream(p2fFile);
- try {
+
+ try (InputStream input = new FileInputStream(p2fFile)) {
importexportService.importP2F(input);
assertTrue("Didn't complain the given file is not supported by current version.", false);
} catch (VersionIncompatibleException e) {
// expected
- } finally {
- input.close();
}
}
@@ -112,16 +106,16 @@ public class ImportExportTests extends AbstractProvisioningTest {
IMetadataRepository repo = metaManager.loadRepository(localRepoFile.toURI(), null);
assertNotNull("Fail to load local repo", repo);
IInstallableUnit iu = createIU("A", Version.create("1.0.0"));
- OutputStream output = new FileOutputStream(testFile);
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
- assertFalse("Not expected return result.", status.isOK());
- assertTrue("Should be a multiple status", status.isMultiStatus());
- boolean hasFeaturesIgnored = false;
- for (IStatus s : getChildren(status))
- if (s.getCode() == ImportExportImpl.IGNORE_LOCAL_REPOSITORY)
- hasFeaturesIgnored = true;
- assertTrue("Should have features ignored due to they're installed from local repository.", hasFeaturesIgnored);
- output.close();
+ try (OutputStream output = new FileOutputStream(testFile)) {
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
+ assertFalse("Not expected return result.", status.isOK());
+ assertTrue("Should be a multiple status", status.isMultiStatus());
+ boolean hasFeaturesIgnored = false;
+ for (IStatus s : getChildren(status))
+ if (s.getCode() == ImportExportImpl.IGNORE_LOCAL_REPOSITORY)
+ hasFeaturesIgnored = true;
+ assertTrue("Should have features ignored due to they're installed from local repository.", hasFeaturesIgnored);
+ }
} finally {
testFile.delete();
}
@@ -135,10 +129,10 @@ public class ImportExportTests extends AbstractProvisioningTest {
IMetadataRepository repo = metaManager.loadRepository(localRepoFile.toURI(), null);
assertNotNull("Fail to load local repo", repo);
IInstallableUnit iu = createIU("A", Version.create("1.0.0"));
- OutputStream output = new FileOutputStream(testFile);
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, true, null);
- assertTrue(status.isOK());
- output.close();
+ try (OutputStream output = new FileOutputStream(testFile)) {
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, true, null);
+ assertTrue(status.isOK());
+ }
} finally {
testFile.delete();
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
index 851e491f4..30d22260b 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -58,8 +58,9 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes
protected IInstallableUnit uninstalled;
protected IInstallableUnit category;
protected ProvisioningUI ui;
- protected ServiceRegistration regLicenseManager;
+ protected ServiceRegistration<LicenseManager> regLicenseManager;
+ @Override
protected void setUp() throws Exception {
super.setUp();
// create test profile
@@ -73,9 +74,9 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes
// register alternate services
SimpleLicenseManager manager = new SimpleLicenseManager(TESTPROFILE);
- Dictionary<String, Object> properties = new Hashtable<String, Object>(5);
+ Dictionary<String, Object> properties = new Hashtable<>(5);
properties.put(Constants.SERVICE_RANKING, Integer.valueOf(1));
- regLicenseManager = TestActivator.getContext().registerService(LicenseManager.class.getName(), manager, properties);
+ regLicenseManager = TestActivator.getContext().registerService(LicenseManager.class, manager, properties);
profileElement = new ProfileElement(null, TESTPROFILE);
install((top1 = createIU(TOPLEVELIU, Version.create("1.0.0"))), true, false);
@@ -97,6 +98,7 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes
artifactManager.addRepository(testRepoLocation);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
metaManager.removeRepository(testRepoLocation);
@@ -155,6 +157,7 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes
protected ProfileModificationJob getLongTestOperation() {
return new ProfileModificationJob("Test Operation", getSession(), TESTPROFILE, null, null) {
+ @Override
public IStatus runModal(IProgressMonitor monitor) {
while (true) {
// spin unless cancelled
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ActionTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ActionTest.java
index e3ec79edd..9ff635477 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ActionTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -21,30 +21,22 @@ public abstract class ActionTest extends AbstractProvisioningUITest {
return new ISelectionProvider() {
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
+ @Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
// Ignore because the selection won't change
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
+ @Override
public ISelection getSelection() {
return new StructuredSelection(selections);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
+ @Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
// ignore because the selection is static
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
+ @Override
public void setSelection(ISelection sel) {
throw new UnsupportedOperationException("This ISelectionProvider is static, and cannot be modified."); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java
index c597e9e0b..9706eb32f 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -70,11 +70,11 @@ public class ElementUtilsTest extends ProfileModificationActionTest {
manager.setEnabled(uri2, false);
getArtifactRepositoryManager().setEnabled(uri2, false);
- List children = new ArrayList();
+ List<MetadataRepositoryElement> children = new ArrayList<>();
children.add(new MetadataRepositoryElement(null, known1, true));
// Add known2, this is as if a user added it in the pref page
children.add(new MetadataRepositoryElement(null, known2, true));
- MetadataRepositoryElement[] elements = (MetadataRepositoryElement[]) children.toArray(new MetadataRepositoryElement[children.size()]);
+ MetadataRepositoryElement[] elements = children.toArray(new MetadataRepositoryElement[children.size()]);
// Add a visible repo not known by the elements
URI uri3 = new URI("http://example.com/3");
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/UninstallActionTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/UninstallActionTest.java
index bca37fbcd..a08323269 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/UninstallActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/UninstallActionTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -25,6 +25,7 @@ public class UninstallActionTest extends ProfileModificationActionTest {
super(UninstallActionTest.this.getProvisioningUI(), UninstallActionTest.this.getSelectionProvider(sel), profile.getProfileId());
}
+ @Override
public List<IInstallableUnit> getSelectedIUs() {
return super.getSelectedIUs();
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/UpdateActionTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/UpdateActionTest.java
index b55f63d79..2ecc1101d 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/UpdateActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/UpdateActionTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -25,6 +25,7 @@ public class UpdateActionTest extends ProfileModificationActionTest {
super(UpdateActionTest.this.getProvisioningUI(), UpdateActionTest.this.getSelectionProvider(sel), profile.getProfileId(), true);
}
+ @Override
public List<IInstallableUnit> getSelectedIUs() {
return super.getSelectedIUs();
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java
index 390aa85b4..968fa9934 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.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
@@ -41,6 +41,7 @@ public class InstallWithRemediationTest extends WizardTest {
@IUDescription(content = "package: egit \n" + "singleton: true\n" + "version: 1 \n" + "depends: TopLevelIU = 1")
public IInstallableUnit anotherIUToInstall;
+ @Override
protected void setUp() throws Exception {
super.setUp();
IULoader.loadIUs(this);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
index 936705c4c..eb8c88355 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.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
@@ -41,6 +41,7 @@ public class InstallWizardTest extends WizardTest {
IInstallableUnit toInstall;
+ @Override
protected void setUp() throws Exception {
super.setUp();
InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription();
@@ -55,7 +56,7 @@ public class InstallWizardTest extends WizardTest {
}
public void testInstallWizardResolved() {
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(toInstall);
InstallOperation op = new InstallOperation(getSession(), iusInvolved);
op.setProfileId(TESTPROFILE);
@@ -101,7 +102,7 @@ public class InstallWizardTest extends WizardTest {
}
public void testInstallWizard() throws Exception {
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(toInstall);
InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved);
op.setProfileId(TESTPROFILE);
@@ -130,7 +131,7 @@ public class InstallWizardTest extends WizardTest {
}
public void testInstallWizardWithoutLicenceBypass() throws Exception {
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(toInstall);
InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved);
op.setProfileId(TESTPROFILE);
@@ -160,7 +161,7 @@ public class InstallWizardTest extends WizardTest {
}
public void testInstallWizardWithLicenceBypass() throws Exception {
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(toInstall);
InstallOperation op = new MyNewInstallOperation(getSession(), iusInvolved);
op.setProfileId(TESTPROFILE);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallationHistoryPageTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallationHistoryPageTest.java
index cc861c902..e986f4a35 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallationHistoryPageTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallationHistoryPageTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -40,6 +40,7 @@ public class InstallationHistoryPageTest extends AbstractProvisioningUITest {
super(ProvUI.getDefaultParentShell());
}
+ @Override
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
page = new RevertProfilePage();
@@ -55,6 +56,7 @@ public class InstallationHistoryPageTest extends AbstractProvisioningUITest {
super(ProvUI.getDefaultParentShell());
}
+ @Override
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
page = new RevertProfilePageWithCompare();
@@ -86,6 +88,7 @@ public class InstallationHistoryPageTest extends AbstractProvisioningUITest {
final Object family = jobFamily.get(provider);
Job.getJobManager().addJobChangeListener(new JobChangeAdapter() {
+ @Override
public void done(IJobChangeEvent e) {
if (e.getJob().belongsTo(family)) {
done++;
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstalledSoftwarePageTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstalledSoftwarePageTest.java
index c8630139d..32b6bac3c 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstalledSoftwarePageTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstalledSoftwarePageTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -28,6 +28,7 @@ public class InstalledSoftwarePageTest extends AbstractProvisioningUITest {
super(ProvUI.getDefaultParentShell());
}
+ @Override
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
InstalledSoftwarePage page = new InstalledSoftwarePage();
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InvokeByHandlerTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InvokeByHandlerTests.java
index ea4daca49..ec0e17326 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InvokeByHandlerTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InvokeByHandlerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -31,23 +31,13 @@ public class InvokeByHandlerTests extends AbstractProvisioningUITest {
private static final String UPDATE = "org.eclipse.equinox.p2.ui.sdk.update";
public void testInstallHandler() throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- Display.getDefault().getActiveShell().close();
- }
-
- });
+ Display.getDefault().asyncExec(() -> Display.getDefault().getActiveShell().close());
runCommand(INSTALL);
}
public void testUpdateHandler() throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- Display.getDefault().getActiveShell().close();
- }
-
- });
+ Display.getDefault().asyncExec(() -> Display.getDefault().getActiveShell().close());
runCommand(UPDATE);
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java
index 308e0b6cc..b2a630b0c 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RemediationTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -23,6 +23,7 @@ import org.eclipse.equinox.internal.p2.ui.sdk.SimpleLicenseManager;
import org.eclipse.equinox.p2.metadata.*;
import org.eclipse.equinox.p2.operations.Update;
import org.eclipse.equinox.p2.operations.UpdateOperation;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.tests.*;
@@ -58,13 +59,10 @@ public class RemediationTest extends WizardTest {
IInstallableUnit toInstall;
- public void setUp() throws Exception {
- }
-
public void visibleSetup(int type) throws Exception {
//Clearout repositories
name = "PROFILE_" + type;
- URI[] repos = getMetadataRepositoryManager().getKnownRepositories(IMetadataRepositoryManager.REPOSITORIES_ALL);
+ URI[] repos = getMetadataRepositoryManager().getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
for (URI uri : repos) {
getMetadataRepositoryManager().removeRepository(uri);
}
@@ -80,9 +78,9 @@ public class RemediationTest extends WizardTest {
// register alternate services
SimpleLicenseManager manager = new SimpleLicenseManager(name);
- Dictionary<String, Object> properties = new Hashtable<String, Object>(5);
+ Dictionary<String, Object> properties = new Hashtable<>(5);
properties.put(Constants.SERVICE_RANKING, Integer.valueOf(1));
- regLicenseManager = TestActivator.getContext().registerService(LicenseManager.class.getName(), manager, properties);
+ regLicenseManager = TestActivator.getContext().registerService(LicenseManager.class, manager, properties);
profileElement = new ProfileElement(null, name);
IULoader.loadIUs(this);
ILicense[] licenses = new ILicense[] {MetadataFactory.createLicense(URI.create("http://eclipse.org"), "license text"), MetadataFactory.createLicense(URI.create("http://apache.org"), "license text2")};
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RepositoryManipulationPageTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RepositoryManipulationPageTest.java
index c9621c422..678100a9a 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RepositoryManipulationPageTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/RepositoryManipulationPageTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -31,6 +31,7 @@ public class RepositoryManipulationPageTest extends AbstractProvisioningUITest {
RepositoryManipulationPage page;
+ @Override
protected Control createDialogArea(Composite parent) {
page = new RepositoryManipulationPage();
page.init(PlatformUI.getWorkbench());
@@ -40,11 +41,13 @@ public class RepositoryManipulationPageTest extends AbstractProvisioningUITest {
return page.getControl();
}
+ @Override
protected void okPressed() {
if (page.performOk())
super.okPressed();
}
+ @Override
protected void cancelPressed() {
if (page.performCancel())
super.cancelPressed();
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UninstallWizardTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UninstallWizardTest.java
index 245fae3d4..8a16fde97 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UninstallWizardTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UninstallWizardTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -33,7 +33,7 @@ public class UninstallWizardTest extends WizardTest {
* This is the normal SDK workflow.
*/
public void testUninstallWizardResolved() {
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(top1);
iusInvolved.add(top2);
UninstallOperation op = getProvisioningUI().getUninstallOperation(iusInvolved, null);
@@ -77,7 +77,7 @@ public class UninstallWizardTest extends WizardTest {
*/
public void testUninstallWizardUnresolved() {
// This test is pretty useless right now but at least it opens the wizard
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(top1);
iusInvolved.add(top2);
UninstallOperation operation = getProvisioningUI().getUninstallOperation(iusInvolved, null);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java
index 73dd6ef8d..971b1483b 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/UpdateWizardTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -34,6 +34,7 @@ public class UpdateWizardTest extends WizardTest {
private static final String MAIN_IU = "MainIU";
IInstallableUnit main, mainUpgrade1, mainUpgrade2, mainUpgradeWithLicense;
+ @Override
protected void setUp() throws Exception {
super.setUp();
InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription();
@@ -64,7 +65,7 @@ public class UpdateWizardTest extends WizardTest {
* This is the SDK
*/
public void testUpdateWizardResolved() {
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(main);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
@@ -99,7 +100,7 @@ public class UpdateWizardTest extends WizardTest {
}
public void testUpdateWizardResolvedWithLicense() {
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(main);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
@@ -132,7 +133,7 @@ public class UpdateWizardTest extends WizardTest {
* Tests the wizard when a prior resolution has been done, but is in error.
*/
public void testUpdateWizardResolvedError() {
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(main);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
@@ -154,7 +155,7 @@ public class UpdateWizardTest extends WizardTest {
* directly on the resolution page
*/
public void testUpdateWizardResolvedSkipSelections() {
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(main);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
@@ -176,7 +177,7 @@ public class UpdateWizardTest extends WizardTest {
* Tests the wizard when multiple versions are available.
*/
public void testBug277554MultipleVersions() {
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(main);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/misc/LicenseManagerTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/misc/LicenseManagerTest.java
index 57d672d19..b0d5b3e74 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/misc/LicenseManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/misc/LicenseManagerTest.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
@@ -27,14 +27,17 @@ public class LicenseManagerTest extends AbstractProvisioningUITest {
this.body = body;
}
+ @Override
public URI getLocation() {
return null;
}
+ @Override
public String getBody() {
return body;
}
+ @Override
public String getUUID() {
return id;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/InstallOperationTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/InstallOperationTests.java
index 12de2c8aa..4161891be 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/InstallOperationTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/InstallOperationTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010-2012 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
@@ -105,7 +105,7 @@ public class InstallOperationTests extends AbstractProvisioningUITest {
IExpression expr = ExpressionUtil.parse(orExpression);
IMatchExpression<IInstallableUnit> 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));
IInstallableUnit newIUB = MetadataFactory.createInstallableUnit(iud);
@@ -116,7 +116,7 @@ public class InstallOperationTests extends AbstractProvisioningUITest {
//Setup the profile
installAsRoots(profile, new IInstallableUnit[] {installed}, true, createPlanner(), createEngine());
- List<IInstallableUnit> ius = new ArrayList<IInstallableUnit>();
+ List<IInstallableUnit> ius = new ArrayList<>();
ius.add(newIUB);
InstallOperation op = new InstallOperation(getSession(), ius);
op.setProfileId(TESTPROFILE);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/OperationFactoryTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/OperationFactoryTest.java
index 4bcb74ae8..c8c9925b7 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/OperationFactoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/OperationFactoryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -33,9 +33,9 @@ public class OperationFactoryTest extends AbstractProvisioningTest {
public void testCreateInstallOperation() {
OperationFactory of = new OperationFactory();
- Collection<IVersionedId> versions = new ArrayList<IVersionedId>();
+ Collection<IVersionedId> versions = new ArrayList<>();
versions.add(new VersionedId("aBundle", "1.0.0"));
- Collection<URI> coll = new ArrayList<URI>();
+ Collection<URI> coll = new ArrayList<>();
coll.add(getTestData("Simple repository", "testData/testRepos/simple.1").toURI());
try {
of.createInstallOperation(versions, coll, new NullProgressMonitor());
@@ -46,9 +46,9 @@ public class OperationFactoryTest extends AbstractProvisioningTest {
public void testCreateInstallOperationWithUnspecifiedVersion() {
OperationFactory of = new OperationFactory();
- Collection<IVersionedId> versions = new ArrayList<IVersionedId>();
+ Collection<IVersionedId> versions = new ArrayList<>();
versions.add(new VersionedId("aBundle", (Version) null));
- Collection<URI> coll = new ArrayList<URI>();
+ Collection<URI> coll = new ArrayList<>();
coll.add(getTestData("Simple repository", "testData/testRepos/simple.1").toURI());
try {
of.createInstallOperation(versions, coll, new NullProgressMonitor());
@@ -59,7 +59,7 @@ public class OperationFactoryTest extends AbstractProvisioningTest {
public void testMissingVersionedIdInInstallOperation() {
OperationFactory of = new OperationFactory();
- Collection<IVersionedId> versions = new ArrayList<IVersionedId>();
+ Collection<IVersionedId> versions = new ArrayList<>();
versions.add(new VersionedId("aBundle", "1.0.0"));
Exception exceptionMet = null;
try {
@@ -102,9 +102,9 @@ public class OperationFactoryTest extends AbstractProvisioningTest {
//install something using the install operation
OperationFactory of = new OperationFactory();
- Collection<IVersionedId> versions = new ArrayList<IVersionedId>();
+ Collection<IVersionedId> versions = new ArrayList<>();
versions.add(new VersionedId("aBundle", (Version) null));
- Collection<URI> coll = new ArrayList<URI>();
+ Collection<URI> coll = new ArrayList<>();
coll.add(getTestData("Simple repository", "testData/testRepos/simple.1").toURI());
try {
InstallOperation iop = of.createInstallOperation(versions, coll, new NullProgressMonitor());
@@ -120,7 +120,7 @@ public class OperationFactoryTest extends AbstractProvisioningTest {
private void testUninstall(IVersionedId vid, boolean shouldFail) {
OperationFactory of = new OperationFactory();
- Collection<IVersionedId> toRemove = new ArrayList<IVersionedId>();
+ Collection<IVersionedId> toRemove = new ArrayList<>();
toRemove.add(vid);
Exception expectedException = null;
try {
@@ -138,9 +138,9 @@ public class OperationFactoryTest extends AbstractProvisioningTest {
createProfileWithOneIU(getUniqueString());
OperationFactory of = new OperationFactory();
{
- Collection<IVersionedId> toUpdate = new ArrayList<IVersionedId>();
+ Collection<IVersionedId> toUpdate = new ArrayList<>();
toUpdate.add(new VersionedId("doesNotExist", (Version) null));
- Collection<URI> repos = new ArrayList<URI>();
+ Collection<URI> repos = new ArrayList<>();
repos.add(getTestData("second repository", "testData/testRepos/simple.2").toURI());
Exception expectedException = null;
try {
@@ -152,9 +152,9 @@ public class OperationFactoryTest extends AbstractProvisioningTest {
}
{
- Collection<IVersionedId> toUpdate = new ArrayList<IVersionedId>();
+ Collection<IVersionedId> toUpdate = new ArrayList<>();
toUpdate.add(new VersionedId("aBundle", Version.parseVersion("1.0.0")));
- Collection<URI> repos = new ArrayList<URI>();
+ Collection<URI> repos = new ArrayList<>();
repos.add(getTestData("second repository", "testData/testRepos/simple.2").toURI());
try {
UpdateOperation op = of.createUpdateOperation(toUpdate, repos, new NullProgressMonitor());
@@ -166,7 +166,7 @@ public class OperationFactoryTest extends AbstractProvisioningTest {
}
{
- Collection<URI> repos = new ArrayList<URI>();
+ Collection<URI> repos = new ArrayList<>();
repos.add(getTestData("second repository", "testData/testRepos/simple.2").toURI());
try {
UpdateOperation op = of.createUpdateOperation(null, repos, new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UninstallOperationTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UninstallOperationTests.java
index a405e5d90..a6cbb2a61 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UninstallOperationTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UninstallOperationTests.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
@@ -27,7 +27,7 @@ import org.eclipse.equinox.p2.tests.ui.AbstractProvisioningUITest;
public class UninstallOperationTests extends AbstractProvisioningUITest {
public void testUninstallContactsNoRepositories() {
- HashSet<IInstallableUnit> ius = new HashSet<IInstallableUnit>();
+ HashSet<IInstallableUnit> ius = new HashSet<>();
ius.add(top1);
UninstallOperation op = new UninstallOperation(getSession(), ius);
// We set the provisioning context to the same one we use for install
@@ -43,7 +43,7 @@ public class UninstallOperationTests extends AbstractProvisioningUITest {
IQueryable<IInstallableUnit> queryable = pc.getMetadata(getMonitor());
assertTrue("metadata queryable should be empty", queryable.query(QueryUtil.ALL_UNITS, getMonitor()).isEmpty());
IQueryable<IArtifactRepository> artifactQueryable = pc.getArtifactRepositories(getMonitor());
- IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION);
+ IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION);
assertTrue("artifact queryable should be empty", artifactQueryable.query(all, getMonitor()).isEmpty());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java
index cb00d3216..3213c812b 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.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
@@ -26,6 +26,7 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
IInstallableUnit a140WithDifferentId;
IInstallableUnitPatch firstPatchForA1, secondPatchForA1, thirdPatchForA1, patchFora2;
+ @Override
protected void setUp() throws Exception {
super.setUp();
a1 = createIU("A", Version.create("1.0.0"));
@@ -53,7 +54,7 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
public void testChooseUpdateOverPatch() {
createTestMetdataRepository(new IInstallableUnit[] {a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2});
install(a1, true, false);
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(a1);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
@@ -67,7 +68,7 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
public void testForcePatchOverUpdate() {
createTestMetdataRepository(new IInstallableUnit[] {a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2});
install(a1, true, false);
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(a1);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
@@ -92,7 +93,7 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
createTestMetdataRepository(new IInstallableUnit[] {a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2});
install(a1, true, false);
install(firstPatchForA1, true, false);
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(a1);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
@@ -108,7 +109,7 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
public void testChooseNotTheNewest() {
createTestMetdataRepository(new IInstallableUnit[] {a1, a120WithDifferentId, a130, firstPatchForA1, patchFora2});
install(a1, true, false);
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(a1);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
@@ -134,13 +135,13 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
public void testChooseLatestPatches() {
createTestMetdataRepository(new IInstallableUnit[] {a1, firstPatchForA1, secondPatchForA1, thirdPatchForA1});
install(a1, true, false);
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(a1);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
IProfileChangeRequest request = op.getProfileChangeRequest();
// the latest two patches were selected
- HashSet chosen = new HashSet();
+ HashSet<IInstallableUnit> chosen = new HashSet<>();
assertTrue("1.0", request.getAdditions().size() == 2);
chosen.addAll(request.getAdditions());
assertTrue("1.1", chosen.contains(secondPatchForA1));
@@ -152,7 +153,7 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
public void testLatestHasDifferentId() {
createTestMetdataRepository(new IInstallableUnit[] {a1, firstPatchForA1, secondPatchForA1, thirdPatchForA1, a120WithDifferentId, a130, a140WithDifferentId});
install(a1, true, false);
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(a1);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
op.resolveModal(getMonitor());
@@ -168,7 +169,7 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
public void testRemoveSelectionAfterResolve() {
createTestMetdataRepository(new IInstallableUnit[] {a1, a130, b1, b12});
install(a1, true, false);
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(a1);
iusInvolved.add(b1);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
@@ -185,7 +186,7 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
public void testSearchForUpdatesInJob() {
createTestMetdataRepository(new IInstallableUnit[] {a1, a130, b1, b12});
install(a1, true, false);
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(a1);
iusInvolved.add(b1);
UpdateOperation op = getProvisioningUI().getUpdateOperation(iusInvolved, null);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AbstractQueryTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AbstractQueryTest.java
index ad48e91b7..7fea3220f 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AbstractQueryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AbstractQueryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -22,6 +22,7 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI;
* Abstract class to set up the mock query provider
*/
public abstract class AbstractQueryTest extends AbstractProvisioningTest {
+ @Override
protected void setUp() throws Exception {
super.setUp();
// use test query provider
@@ -37,6 +38,7 @@ public abstract class AbstractQueryTest extends AbstractProvisioningTest {
manipulator.setMetadataRepositoryFlags(IRepositoryManager.REPOSITORIES_ALL);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
RepositoryTracker manipulator = ProvisioningUI.getDefaultUI().getRepositoryTracker();
@@ -45,8 +47,10 @@ public abstract class AbstractQueryTest extends AbstractProvisioningTest {
// ProvUI.setQueryProvider(null);
}
- protected IQuery getMockQuery() {
- return new MatchQuery() {
+ protected IQuery<?> getMockQuery() {
+ return new MatchQuery<Object>() {
+ @Deprecated
+ @Override
public boolean isMatch(Object candidate) {
return true;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AnyRequiredCapabilityTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AnyRequiredCapabilityTest.java
index 61ce696c9..f44062bc0 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AnyRequiredCapabilityTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AnyRequiredCapabilityTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -26,10 +26,10 @@ public class AnyRequiredCapabilityTest extends AbstractQueryTest {
IRequirement requires = MetadataFactory.createRequirement("org.eclipse.equinox.p2.iu", "test.bundle", ANY_VERSION, null, false, false);
IInstallableUnit match = createIU("test.bundle");
IInstallableUnit noMatch = createIU("another.bundle");
- List items = new ArrayList();
+ List<IInstallableUnit> items = new ArrayList<>();
items.add(match);
items.add(noMatch);
- IQueryResult result = QueryUtil.createMatchQuery(requires.getMatches()).perform(items.iterator());
+ IQueryResult<IInstallableUnit> result = QueryUtil.createMatchQuery(requires.getMatches()).perform(items.iterator());
assertEquals("1.0", 1, queryResultSize(result));
assertEquals("1.1", match, result.iterator().next());
}
@@ -46,9 +46,9 @@ public class AnyRequiredCapabilityTest extends AbstractQueryTest {
metadataRepositoryManager.addRepository(location);
QueryableMetadataRepositoryManager manager = new QueryableMetadataRepositoryManager(ProvisioningUI.getDefaultUI(), false);
IRequirement requires = MetadataFactory.createRequirement("org.eclipse.equinox.p2.iu", "test.bundle", ANY_VERSION, null, false, false);
- IQueryResult result = manager.query(QueryUtil.createMatchQuery(requires.getMatches()), getMonitor());
+ IQueryResult<IInstallableUnit> result = manager.query(QueryUtil.createMatchQuery(requires.getMatches()), getMonitor());
assertEquals("1.0", 1, queryResultSize(result));
- IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit iu = result.iterator().next();
assertEquals("1.1", "test.bundle", iu.getId());
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AvailableIUWrapperTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AvailableIUWrapperTest.java
index bb0cf14d0..9d0538e25 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AvailableIUWrapperTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AvailableIUWrapperTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -48,10 +48,10 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
*/
public void testCollectObject() {
AvailableIUWrapper wrapper = createWrapper();
- Collector<Object> collector = new Collector<Object>();
+ Collector<Object> collector = new Collector<>();
Object object = new Object();
collector.accept(object);
- Collection results = wrapper.getElements(collector);
+ Collection<?> results = wrapper.getElements(collector);
assertEquals("1.0", 1, results.size());
assertEquals("1.1", object, results.iterator().next());
}
@@ -61,10 +61,10 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
*/
public void testCollectIU() {
AvailableIUWrapper wrapper = createWrapper();
- Collector<IInstallableUnit> collector = new Collector<IInstallableUnit>();
+ Collector<IInstallableUnit> collector = new Collector<>();
IInstallableUnit unit = createIU("f1");
collector.accept(unit);
- Collection results = wrapper.getElements(collector);
+ Collection<?> results = wrapper.getElements(collector);
assertEquals("1.0", 1, results.size());
IInstallableUnit collectedIU = getIU(results.iterator().next());
assertEquals("1.1", unit, collectedIU);
@@ -75,18 +75,18 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
*/
public void testMakeCategory() {
AvailableIUWrapper wrapper = createWrapper(true);
- Collector<IInstallableUnit> collector = new Collector<IInstallableUnit>();
- Map<String, String> properties = new HashMap<String, String>();
+ Collector<IInstallableUnit> collector = new Collector<>();
+ Map<String, String> properties = new HashMap<>();
properties.put(InstallableUnitDescription.PROP_TYPE_CATEGORY, "true");
IInstallableUnit category = createIU("category", Version.createOSGi(1, 0, 0), NO_REQUIRES, properties, false);
IInstallableUnit unit = createIU("basicIU");
collector.accept(category);
collector.accept(unit);
- Collection results = wrapper.getElements(collector);
+ Collection<?> results = wrapper.getElements(collector);
assertEquals("1.0", 2, collector.size());
boolean categoryFound = false;
- for (Iterator it = results.iterator(); it.hasNext();) {
+ for (Iterator<?> it = results.iterator(); it.hasNext();) {
Object element = it.next();
IInstallableUnit collected = getIU(element);
if (collected.equals(category)) {
@@ -104,18 +104,18 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
*/
public void testNoMakeCategory() {
AvailableIUWrapper wrapper = createWrapper(false);
- Collector<IInstallableUnit> collector = new Collector<IInstallableUnit>();
- Map<String, String> properties = new HashMap<String, String>();
+ Collector<IInstallableUnit> collector = new Collector<>();
+ Map<String, String> properties = new HashMap<>();
properties.put(InstallableUnitDescription.PROP_TYPE_CATEGORY, "true");
IInstallableUnit category = createIU("category", Version.createOSGi(1, 0, 0), NO_REQUIRES, properties, false);
IInstallableUnit unit = createIU("basicIU");
collector.accept(category);
collector.accept(unit);
- Collection results = wrapper.getElements(collector);
+ Collection<?> results = wrapper.getElements(collector);
assertEquals("1.0", 2, results.size());
boolean categoryFound = false;
- for (Iterator it = results.iterator(); it.hasNext();) {
+ for (Iterator<?> it = results.iterator(); it.hasNext();) {
Object element = it.next();
IInstallableUnit collected = getIU(element);
if (collected.equals(category)) {
@@ -134,7 +134,7 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
public void testHideInstalled() {
IProfile profile = createProfile("TestProfile");
AvailableIUWrapper wrapper = createWrapper(true);
- Collector<IInstallableUnit> collector = new Collector<IInstallableUnit>();
+ Collector<IInstallableUnit> collector = new Collector<>();
IInstallableUnit installed = createIU("installed");
IInstallableUnit notInstalled = createIU("notInstalled");
install(profile, new IInstallableUnit[] {installed}, true, createPlanner(), createEngine());
@@ -144,7 +144,7 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
collector.accept(installed);
collector.accept(notInstalled);
- Collection results = wrapper.getElements(collector);
+ Collection<?> results = wrapper.getElements(collector);
assertEquals("1.1", 1, results.size());
Object iuElement = results.iterator().next();
@@ -161,7 +161,7 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
IExpression expr = ExpressionUtil.parse(orExpression);
IMatchExpression<IInstallableUnit> 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));
IInstallableUnit newIUB = MetadataFactory.createInstallableUnit(iud);
@@ -172,14 +172,14 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
//Setup the profile
IProfile profile = createProfile("TestProfile");
AvailableIUWrapper wrapper = createWrapper(true);
- Collector<IInstallableUnit> collector = new Collector<IInstallableUnit>();
+ Collector<IInstallableUnit> collector = new Collector<>();
installAsRoots(profile, new IInstallableUnit[] {installed}, true, createPlanner(), createEngine());
wrapper.markInstalledIUs(profile, true);
//now feed in the installed and non-installed units, and the installed unit should be ignored.
collector.accept(newIUB);
- Collection results = wrapper.getElements(collector);
+ Collection<?> results = wrapper.getElements(collector);
//Verify
assertEquals("1.1", 1, results.size());
@@ -188,7 +188,8 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
Assert.assertTrue(((AvailableIUElement) iuElement).isUpdate());
}
- protected IQuery getMockQuery() {
+ @Override
+ protected IQuery<IInstallableUnit> getMockQuery() {
return QueryUtil.createIUPropertyQuery("key", "value");
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/CategoryElementWrapperTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/CategoryElementWrapperTest.java
index f435c6cf9..2f099661c 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/CategoryElementWrapperTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/CategoryElementWrapperTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -40,9 +40,9 @@ public class CategoryElementWrapperTest extends AbstractQueryTest {
public void testCollectObject() {
CategoryElementWrapper wrapper = createWrapper();
- Collector collector = new Collector();
+ Collector<String> collector = new Collector<>();
collector.accept("AnObjectThatIsNotAnIU");
- Iterator results = wrapper.getElements(collector).iterator();
+ Iterator<?> results = wrapper.getElements(collector).iterator();
// Collection should either be empty or explain its emptiness.
while (results.hasNext())
assertTrue("1.0", results.next() instanceof EmptyElementExplanation);
@@ -53,12 +53,12 @@ public class CategoryElementWrapperTest extends AbstractQueryTest {
*/
public void testIsEmpty() {
CategoryElementWrapper wrapper = createWrapper();
- Collector collector = new Collector();
+ Collector<IInstallableUnit> collector = new Collector<>();
assertTrue("1.1", collector.isEmpty());
IInstallableUnit category1 = createIU("category1");
collector.accept(category1);
- Collection results = wrapper.getElements(collector);
+ Collection<?> results = wrapper.getElements(collector);
assertTrue("1.2", !results.isEmpty());
}
@@ -67,12 +67,12 @@ public class CategoryElementWrapperTest extends AbstractQueryTest {
*/
public void testSize() {
CategoryElementWrapper wrapper = createWrapper();
- Collector collector = new Collector();
+ Collector<IInstallableUnit> collector = new Collector<>();
assertEquals("1.1", 0, collector.size());
IInstallableUnit category1 = createIU("category1");
collector.accept(category1);
- Collection results = wrapper.getElements(collector);
+ Collection<?> results = wrapper.getElements(collector);
assertEquals("1.2", 1, collector.size());
assertEquals("1.3", category1, ((CategoryElement) results.iterator().next()).getIU());
@@ -91,12 +91,12 @@ public class CategoryElementWrapperTest extends AbstractQueryTest {
public void testCategoryMerging() {
CategoryElementWrapper wrapper = createWrapper();
- Collector collector = new Collector();
+ Collector<IInstallableUnit> collector = new Collector<>();
assertEquals("1.1", 0, collector.size());
IInstallableUnit category1 = createNamedCategory("qualifier1.foo", "Foo", DEFAULT_VERSION);
collector.accept(category1);
- Collection results = wrapper.getElements(collector);
+ Collection<?> results = wrapper.getElements(collector);
assertEquals("1.2", 1, collector.size());
assertEquals("1.3", category1, ((CategoryElement) results.iterator().next()).getIU());
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/LatestIUVersionElementWrapperTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/LatestIUVersionElementWrapperTest.java
index 9023e4c48..ff122e2e4 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/LatestIUVersionElementWrapperTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/LatestIUVersionElementWrapperTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -27,6 +27,7 @@ public class LatestIUVersionElementWrapperTest extends AvailableIUWrapperTest {
/**
* Returns the IU corresponding to the collected element.
*/
+ @Override
protected IInstallableUnit getIU(Object collected) {
if (collected instanceof IInstallableUnit)
return (IInstallableUnit) collected;
@@ -37,20 +38,20 @@ public class LatestIUVersionElementWrapperTest extends AvailableIUWrapperTest {
* Tests that only the latest version is collected.
*/
public void testCollectLatestIU() {
- IQuery latestIuVersionElementQuery = QueryUtil.createLatestIUQuery();
+ IQuery<IInstallableUnit> latestIuVersionElementQuery = QueryUtil.createLatestIUQuery();
IInstallableUnit unit1 = createIU("f1", Version.createOSGi(1, 0, 0));
IInstallableUnit unit2 = createIU("f1", Version.createOSGi(1, 0, 1));
- List listOfIUs = new ArrayList();
+ List<IInstallableUnit> listOfIUs = new ArrayList<>();
listOfIUs.add(unit1);
listOfIUs.add(unit2);
- IQueryResult collector = latestIuVersionElementQuery.perform(listOfIUs.iterator());
+ IQueryResult<IInstallableUnit> collector = latestIuVersionElementQuery.perform(listOfIUs.iterator());
assertEquals("1.0", 1, queryResultSize(collector));
IInstallableUnit collectedIU = getIU(collector.iterator().next());
assertEquals("1.1", unit2, collectedIU);
}
public void testMultipleIUsAndVersions() {
- IQuery latestIuVersionElementQuery = QueryUtil.createLatestIUQuery();
+ IQuery<IInstallableUnit> latestIuVersionElementQuery = QueryUtil.createLatestIUQuery();
IInstallableUnit unit1 = createIU("A", Version.createOSGi(1, 0, 0));
IInstallableUnit unit2 = createIU("A", Version.createOSGi(1, 0, 1));
IInstallableUnit unit3 = createIU("B", Version.createOSGi(1, 0, 1));
@@ -58,13 +59,13 @@ public class LatestIUVersionElementWrapperTest extends AvailableIUWrapperTest {
IInstallableUnit unit5 = createIU("C", Version.createOSGi(0, 1, 1));
// We should get unit 2, unit 3 and unit 5
- List listOfIUs = new ArrayList();
+ List<IInstallableUnit> listOfIUs = new ArrayList<>();
listOfIUs.add(unit1);
listOfIUs.add(unit2);
listOfIUs.add(unit3);
listOfIUs.add(unit4);
listOfIUs.add(unit5);
- IQueryResult collector = latestIuVersionElementQuery.perform(listOfIUs.iterator());
+ IQueryResult<IInstallableUnit> collector = latestIuVersionElementQuery.perform(listOfIUs.iterator());
// Should be 3 units
assertEquals("1.0", 3, queryResultSize(collector));
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/MockQueryProvider.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/MockQueryProvider.java
index d52faee9f..e3a27ddaa 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/MockQueryProvider.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/MockQueryProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -22,14 +22,15 @@ import org.eclipse.equinox.p2.ui.ProvisioningUI;
* A fake query provider for unit testing.
*/
public class MockQueryProvider extends QueryProvider {
- private IQuery query;
+ private IQuery<?> query;
- public MockQueryProvider(IQuery query, ProvisioningUI ui) {
+ public MockQueryProvider(IQuery<?> query, ProvisioningUI ui) {
super(ui);
this.query = query;
}
+ @Override
public ElementQueryDescriptor getQueryDescriptor(QueriedElement element) {
- return new ElementQueryDescriptor(new MockQueryable(element), query, new Collector());
+ return new ElementQueryDescriptor(new MockQueryable(element), query, new Collector<>());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryDescriptorTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryDescriptorTest.java
index 9daddbf3b..e20c3097e 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryDescriptorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryDescriptorTest.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
@@ -21,10 +21,11 @@ import org.eclipse.equinox.p2.query.*;
*/
public class QueryDescriptorTest extends TestCase {
- class SimpleQueryable implements IQueryable {
- List elements = Arrays.asList(new String[] {"a", "b", "c", "d", "e"});
+ class SimpleQueryable implements IQueryable<String> {
+ List<String> elements = Arrays.asList(new String[] {"a", "b", "c", "d", "e"});
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ @Override
+ public IQueryResult<String> query(IQuery<String> query, IProgressMonitor monitor) {
return query.perform(elements.iterator());
}
}
@@ -36,6 +37,7 @@ public class QueryDescriptorTest extends TestCase {
this.string = string;
}
+ @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -47,22 +49,23 @@ public class QueryDescriptorTest extends TestCase {
return this.string.equals(other.string);
}
+ @Override
public int hashCode() {
return string.hashCode();
}
}
class StringWrapper extends ElementWrapper {
+ @Override
protected Object wrap(Object item) {
return new WrappedString((String) item);
}
}
- class SimpleMatchQuery extends MatchQuery {
+ class SimpleMatchQuery extends MatchQuery<Object> {
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.query.MatchQuery#isMatch(java.lang.Object)
- */
+ @Override
+ @Deprecated
public boolean isMatch(Object candidate) {
if (candidate == "a" || candidate == "b")
return true;
@@ -70,10 +73,9 @@ public class QueryDescriptorTest extends TestCase {
}
}
- class SimpleMatchQuery2 extends MatchQuery {
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.query.MatchQuery#isMatch(java.lang.Object)
- */
+ class SimpleMatchQuery2 extends MatchQuery<Object> {
+ @Override
+ @Deprecated
public boolean isMatch(Object candidate) {
if (candidate == "b" || candidate == "c")
return true;
@@ -82,33 +84,33 @@ public class QueryDescriptorTest extends TestCase {
}
public void testSimpleDescriptorWithWrapper() {
- ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), new SimpleMatchQuery(), new Collector(), new StringWrapper());
- Collection collection = eqDescriptor.performQuery(null);
+ ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), new SimpleMatchQuery(), new Collector<>(), new StringWrapper());
+ Collection<?> collection = eqDescriptor.performQuery(null);
assertEquals("1.0", 2, collection.size());
assertTrue("1.1", collection.contains(new WrappedString("a")));
assertTrue("1.1", collection.contains(new WrappedString("b")));
}
public void testSimpleDescriptorWithoutWrapper() {
- ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), new SimpleMatchQuery(), new Collector());
- Collection collection = eqDescriptor.performQuery(null);
+ ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), new SimpleMatchQuery(), new Collector<>());
+ Collection<?> collection = eqDescriptor.performQuery(null);
assertEquals("1.0", 2, collection.size());
assertTrue("1.1", collection.contains("a"));
assertTrue("1.1", collection.contains("b"));
}
public void testCompoundDescriptorAND() {
- IQuery query = QueryUtil.createCompoundQuery(new SimpleMatchQuery(), new SimpleMatchQuery2(), true);
- ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), query, new Collector(), new StringWrapper());
- Collection collection = eqDescriptor.performQuery(null);
+ IQuery<Object> query = QueryUtil.createCompoundQuery(new SimpleMatchQuery(), new SimpleMatchQuery2(), true);
+ ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), query, new Collector<>(), new StringWrapper());
+ Collection<?> collection = eqDescriptor.performQuery(null);
assertEquals("1.0", 1, collection.size());
assertTrue("1.1", collection.contains(new WrappedString("b")));
}
public void testCompoundDescriptorOR() {
- IQuery query = QueryUtil.createCompoundQuery(new SimpleMatchQuery(), new SimpleMatchQuery2(), false);
- ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), query, new Collector(), new StringWrapper());
- Collection collection = eqDescriptor.performQuery(null);
+ IQuery<Object> query = QueryUtil.createCompoundQuery(new SimpleMatchQuery(), new SimpleMatchQuery2(), false);
+ ElementQueryDescriptor eqDescriptor = new ElementQueryDescriptor(new SimpleQueryable(), query, new Collector<>(), new StringWrapper());
+ Collection<?> collection = eqDescriptor.performQuery(null);
assertEquals("1.0", 3, collection.size());
assertTrue("1.1", collection.contains(new WrappedString("a")));
assertTrue("1.1", collection.contains(new WrappedString("b")));
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java
index 5a5556e1e..0b716d604 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.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
@@ -30,11 +30,12 @@ public class QueryProviderTests extends AbstractProvisioningUITest {
static final String C = "C";
IMetadataRepository testRepo;
+ @Override
protected void setUp() throws Exception {
super.setUp();
- HashMap categoryProperties = new HashMap();
+ HashMap<String, String> categoryProperties = new HashMap<>();
categoryProperties.put("org.eclipse.equinox.p2.type.category", "true");
- HashMap groupProperties = new HashMap();
+ HashMap<String, String> groupProperties = new HashMap<>();
groupProperties.put("org.eclipse.equinox.p2.type.group", "true");
category = createIU(CAT, Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, NESTED), categoryProperties, true);
nestedCategory = createIU(NESTED, Version.create("1.0.0"), createRequiredCapabilities(IInstallableUnit.NAMESPACE_IU_ID, A), categoryProperties, true);
@@ -67,12 +68,12 @@ public class QueryProviderTests extends AbstractProvisioningUITest {
IUElementListRoot root = new IUElementListRoot();
AvailableIUElement element = new AvailableIUElement(root, a, TESTPROFILE, getPolicy().getShowDrilldownRequirements());
root.setChildren(new Object[] {element});
- ArrayList<IInstallableUnit> iusInvolved = new ArrayList<IInstallableUnit>();
+ ArrayList<IInstallableUnit> iusInvolved = new ArrayList<>();
iusInvolved.add(a);
InstallOperation op = new InstallOperation(getSession(), iusInvolved);
op.setProfileId(TESTPROFILE);
op.resolveModal(getMonitor());
- IQueryable queryable = op.getProvisioningPlan().getAdditions();
+ IQueryable<IInstallableUnit> queryable = op.getProvisioningPlan().getAdditions();
element.setQueryable(queryable);
Object[] children = element.getChildren(element);
assertTrue("1.1", children.length == 1);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java
index 26fce1a61..35c53b59a 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableArtifactRepositoryManagerTest.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,6 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.ui.query;
+import java.net.URI;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.ui.QueryableArtifactRepositoryManager;
import org.eclipse.equinox.internal.p2.ui.RepositoryLocationQuery;
@@ -22,6 +23,7 @@ public class QueryableArtifactRepositoryManagerTest extends AbstractQueryTest {
private static final String repositoryTwo = "http://two.lan";
private int repoCount = 0;
+ @Override
public void setUp() throws Exception {
super.setUp();
@@ -32,6 +34,7 @@ public class QueryableArtifactRepositoryManagerTest extends AbstractQueryTest {
repoCount = repoManager.getKnownRepositories(0).length;
}
+ @Override
public void tearDown() throws Exception {
IArtifactRepositoryManager repoManager = getArtifactRepositoryManager();
repoManager.removeRepository(URIUtil.fromString(repositoryOne));
@@ -43,7 +46,7 @@ public class QueryableArtifactRepositoryManagerTest extends AbstractQueryTest {
public void testQuery() {
QueryableArtifactRepositoryManager manager = getQueryableManager();
- IQueryResult result = manager.locationsQueriable().query(new RepositoryLocationQuery(), getMonitor());
+ IQueryResult<URI> result = manager.locationsQueriable().query(new RepositoryLocationQuery(), getMonitor());
assertTrue(queryResultSize(result) == repoCount);
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableMetadataRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableMetadataRepositoryManagerTest.java
index d1ad12841..67b1b0e1e 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableMetadataRepositoryManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryableMetadataRepositoryManagerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -42,6 +42,7 @@ public class QueryableMetadataRepositoryManagerTest extends AbstractQueryTest {
ProvisioningUI ui;
ProvisioningSession session;
+ @Override
protected void setUp() throws Exception {
ui = ProvisioningUI.getDefaultUI();
session = ui.getSession();
@@ -107,7 +108,7 @@ public class QueryableMetadataRepositoryManagerTest extends AbstractQueryTest {
metadataRepositoryManager.addRepository(broken);
QueryableMetadataRepositoryManager manager = getQueryableManager();
- IQueryResult result = manager.query(QueryUtil.createIUQuery("test.bundle", Version.createOSGi(1, 0, 0)), new CancelingProgressMonitor());
+ IQueryResult<IInstallableUnit> result = manager.query(QueryUtil.createIUQuery("test.bundle", Version.createOSGi(1, 0, 0)), new CancelingProgressMonitor());
assertTrue("1.0", result.isEmpty());
}
@@ -176,18 +177,18 @@ public class QueryableMetadataRepositoryManagerTest extends AbstractQueryTest {
metadataRepositoryManager.addRepository(broken);
QueryableMetadataRepositoryManager manager = getQueryableManager();
- IQueryResult result = manager.query(QueryUtil.createIUQuery("test.bundle", Version.createOSGi(1, 0, 0)), getMonitor());
+ IQueryResult<IInstallableUnit> result = manager.query(QueryUtil.createIUQuery("test.bundle", Version.createOSGi(1, 0, 0)), getMonitor());
assertEquals("1.0", 1, queryResultSize(result));
- IInstallableUnit iu = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit iu = result.iterator().next();
assertEquals("1.1", "test.bundle", iu.getId());
// RepoLocationQuery must cause repository URI's to be collected and no repository
// loading should occur.
- result = manager.locationsQueriable().query(new RepositoryLocationQuery(), getMonitor());
- assertEquals("2.0", 3, queryResultSize(result));
- assertContains("2.1", result, existing);
- assertContains("2.1", result, nonExisting);
- assertContains("2.1", result, broken);
+ IQueryResult<URI> result2 = manager.locationsQueriable().query(new RepositoryLocationQuery(), getMonitor());
+ assertEquals("2.0", 3, queryResultSize(result2));
+ assertContains("2.1", result2, existing);
+ assertContains("2.1", result2, nonExisting);
+ assertContains("2.1", result2, broken);
// null IUPropertyQuery collects all IUs
result = manager.query(QueryUtil.createIUQuery((String) null), getMonitor());
@@ -216,7 +217,7 @@ public class QueryableMetadataRepositoryManagerTest extends AbstractQueryTest {
MetadataRepositories rootElement = new MetadataRepositories(context, ui, manager);
QueryProvider queryProvider = new QueryProvider(ui);
ElementQueryDescriptor queryDescriptor = queryProvider.getQueryDescriptor(rootElement);
- Collection collection = queryDescriptor.performQuery(null);
+ Collection<?> collection = queryDescriptor.performQuery(null);
assertEquals("1.0", 5, collection.size());
}
@@ -240,7 +241,7 @@ public class QueryableMetadataRepositoryManagerTest extends AbstractQueryTest {
MetadataRepositories rootElement = new MetadataRepositories(context, ui, manager);
QueryProvider queryProvider = new QueryProvider(ui);
ElementQueryDescriptor queryDescriptor = queryProvider.getQueryDescriptor(rootElement);
- Collection collection = queryDescriptor.performQuery(null);
+ Collection<?> collection = queryDescriptor.performQuery(null);
assertEquals("1.0", 1, collection.size());
AvailableIUElement next = (AvailableIUElement) collection.iterator().next();
assertEquals("1.1", Version.createOSGi(3, 0, 0), next.getIU().getVersion());
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java
index afd07351d..7979f1692 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/TranslationSupportTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -28,14 +28,16 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
*/
public class TranslationSupportTests extends AbstractQueryTest {
Profile profile;
- IQueryable oldTranslationSource;
+ IQueryable<IInstallableUnit> oldTranslationSource;
+ @Override
protected void setUp() throws Exception {
super.setUp();
profile = (Profile) createProfile("testLocalizedLicense");
oldTranslationSource = TranslationSupport.getInstance().setTranslationSource(profile);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
TranslationSupport.getInstance().setTranslationSource(oldTranslationSource);
@@ -52,9 +54,9 @@ public class TranslationSupportTests extends AbstractQueryTest {
fail("1.99", e);
return;
}
- IQueryResult result = repository.query(QueryUtil.createIUQuery("test.feature.feature.group"), getMonitor());
+ IQueryResult<IInstallableUnit> result = repository.query(QueryUtil.createIUQuery("test.feature.feature.group"), getMonitor());
assertTrue("1.0", !result.isEmpty());
- IInstallableUnit unit = (IInstallableUnit) result.iterator().next();
+ IInstallableUnit unit = result.iterator().next();
ICopyright copyright = unit.getCopyright(null);
assertEquals("1.1", "Test Copyright", copyright.getBody());
@@ -97,7 +99,7 @@ public class TranslationSupportTests extends AbstractQueryTest {
// Create fragment with a German license
org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription installableUnitFragmentDescription = new org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription();
IProvidedCapability providedCapability = MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.localization", "de", Version.createOSGi(1, 0, 0));
- ArrayList list = new ArrayList();
+ ArrayList<IProvidedCapability> list = new ArrayList<>();
list.add(providedCapability);
installableUnitFragmentDescription.addProvidedCapabilities(list);
installableUnitFragmentDescription.setId("german fragment");
@@ -111,7 +113,7 @@ public class TranslationSupportTests extends AbstractQueryTest {
// Create a French fragment with an fr_CA license
installableUnitFragmentDescription = new org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription();
providedCapability = MetadataFactory.createProvidedCapability("org.eclipse.equinox.p2.localization", "fr", Version.createOSGi(1, 0, 0));
- list = new ArrayList();
+ list = new ArrayList<>();
list.add(providedCapability);
installableUnitFragmentDescription.addProvidedCapabilities(list);
installableUnitFragmentDescription.setId("cnd french fragment");

Back to the top