Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-11-09 04:11:53 -0500
committerAlexander Kurtakov2018-11-09 05:15:24 -0500
commitf05a984ee26f854f952710f9a4487dd8f6058d8a (patch)
tree698701bb15d1e5ac988f738c32054a944ee2e33a
parentb1725570eab7d15ae3acb0d1b6b4ff8b108a5928 (diff)
downloadeclipse.platform.team-f05a984ee26f854f952710f9a4487dd8f6058d8a.tar.gz
eclipse.platform.team-f05a984ee26f854f952710f9a4487dd8f6058d8a.tar.xz
eclipse.platform.team-f05a984ee26f854f952710f9a4487dd8f6058d8a.zip
Fix many warnings from tests.cvs.core
Change-Id: Ieed46e47c0b9e34259fa90ab1a5a101ec6be4764 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/.settings/org.eclipse.jdt.core.prefs67
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/.settings/org.eclipse.jdt.ui.prefs121
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java57
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/ResourceMapperTests.java284
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/SyncInfoSetTraveralContext.java47
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/TestModelProvider.java10
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/model/ModelFile.java6
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/model/ModelProject.java16
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java10
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ConcurrencyTests.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ImportTest.java12
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java48
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RepositoryRootTest.java43
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSChangeSetTests.java32
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java13
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java78
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java13
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSHisoryTableProviderTest.java35
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CommitSetTests.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java41
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EnablementTest.java27
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java35
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ModelParticipantSyncInfoSource.java69
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchTreeTest.java8
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchWizardRadioButtonGroupTests.java104
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java36
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ReflectionUtils.java50
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SelectionPropertyTesterTest.java30
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java35
30 files changed, 727 insertions, 610 deletions
diff --git a/tests/org.eclipse.team.tests.cvs.core/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.team.tests.cvs.core/.settings/org.eclipse.jdt.core.prefs
index c3f549faf..7155a0d00 100644
--- a/tests/org.eclipse.team.tests.cvs.core/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/org.eclipse.team.tests.cvs.core/.settings/org.eclipse.jdt.core.prefs
@@ -7,6 +7,15 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
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.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
@@ -17,50 +26,108 @@ 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=100
+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
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
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.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
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=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=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.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+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=ignore
+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=ignore
+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=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
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.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/tests/org.eclipse.team.tests.cvs.core/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.team.tests.cvs.core/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..6efd3e4f9
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,121 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=false
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=false
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_modifiers=false
+cleanup.remove_redundant_semicolons=false
+cleanup.remove_redundant_type_arguments=false
+cleanup.remove_trailing_whitespaces=false
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=false
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=org.eclipse.jdt.ui.default.eclipse_clean_up_profile
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=true
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=true
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_modifiers=true
+sp_cleanup.remove_redundant_semicolons=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java
index ea95e3ec4..bd2f1eb15 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/cvsresources/EclipseSynchronizerTest.java
@@ -16,20 +16,15 @@ package org.eclipse.team.tests.ccvs.core.cvsresources;
import java.util.Arrays;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -49,6 +44,9 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
/**
* Tests the EclipseSynchronizer.
* Does not test state change broadcasts.
@@ -608,8 +606,8 @@ public class EclipseSynchronizerTest extends EclipseTest {
"hassync.txt", "deleted_nosync.txt", "deleted.txt", "hassync/", "deleted/", "deleted_nosync/" }, true);
// initially none of the resources have sync info and they all exist
- Object[] ignores = new Object[] { project1.getFolder("CVS") };
- Set expectedMembers = new HashSet(Arrays.asList(project1.members()));
+ IResource[] ignores = new IResource[] { project1.getFolder("CVS") };
+ Set<IResource> expectedMembers = new HashSet<>(Arrays.asList(project1.members()));
members = sync.members(project1);
assertBijection(expectedMembers.toArray(), members, ignores);
@@ -680,20 +678,19 @@ public class EclipseSynchronizerTest extends EclipseTest {
/**
* Assert that there exists a bijection between the elements of the arrays.
*/
- private void assertBijection(Object[] a, Object[] b, Object[] ignores) {
- List listA = new LinkedList(Arrays.asList(a));
- List listB = new LinkedList(Arrays.asList(b));
+ private <T> void assertBijection(T[] a, T[] b, T[] ignores) {
+ List<T> listA = new LinkedList<>(Arrays.asList(a));
+ List<T> listB = new LinkedList<>(Arrays.asList(b));
if (ignores != null) {
- for (int i = 0; i < ignores.length; ++i ) {
- listA.remove(ignores[i]);
- listB.remove(ignores[i]);
+ for (Object ignore : ignores) {
+ listA.remove(ignore);
+ listB.remove(ignore);
}
}
assertEquals("Should have same number of elements", listA.size(), listB.size());
- for (Iterator it = listB.iterator(); it.hasNext();) {
- Object obj = it.next();
- assertTrue("Should contain the same elements", listA.contains(obj));
- listA.remove(obj);
+ for (T t : listB) {
+ assertTrue("Should contain the same elements", listA.contains(t));
+ listA.remove(t);
}
}
@@ -706,22 +703,21 @@ public class EclipseSynchronizerTest extends EclipseTest {
* @param resourcePaths paths of resources to be generated
* @return the create project
*/
+ @Override
protected IProject createProject(String[] resourcePaths) throws CoreException {
// Create the project and build the resources
IProject project = getUniqueTestProject(getName());
buildResources(project, resourcePaths, true);
// Associate dummy sync info with al create resources
- project.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() != IResource.PROJECT) {
- sync.setResourceSync(resource, dummyResourceSync(resource));
- }
- if (resource.getType() != IResource.FILE) {
- sync.setFolderSync((IContainer)resource, dummyFolderSync((IContainer)resource));
- }
- return true;
+ project.accept(resource -> {
+ if (resource.getType() != IResource.PROJECT) {
+ sync.setResourceSync(resource, dummyResourceSync(resource));
+ }
+ if (resource.getType() != IResource.FILE) {
+ sync.setFolderSync((IContainer)resource, dummyFolderSync((IContainer)resource));
}
+ return true;
});
// Map the project to CVS so the Move/Delete hook works
@@ -737,8 +733,7 @@ public class EclipseSynchronizerTest extends EclipseTest {
* @throws CVSException
*/
protected void assertHasSyncInfo(IProject project, String[] resourcePaths) throws CVSException {
- for (int i = 0; i < resourcePaths.length; i++) {
- String path = resourcePaths[i];
+ for (String path : resourcePaths) {
IResource resource = findResource(project, path);
assertHasSyncInfo(resource);
}
@@ -779,8 +774,7 @@ public class EclipseSynchronizerTest extends EclipseTest {
* @throws CVSException
*/
private void assertHasNoSyncInfo(IProject project, String[] resourcePaths) throws CoreException {
- for (int i = 0; i < resourcePaths.length; i++) {
- String path = resourcePaths[i];
+ for (String path : resourcePaths) {
IResource resource = findResource(project, path);
assertHasNoSyncInfo(resource);
}
@@ -791,8 +785,7 @@ public class EclipseSynchronizerTest extends EclipseTest {
if (resource.getType() != IResource.FILE) {
assertNull("Folder should not have folder sync but does: " + resource.getProjectRelativePath(), sync.getFolderSync((IContainer)resource));
IResource[] members = ((IContainer)resource).members();
- for (int i = 0; i < members.length; i++) {
- IResource child = members[i];
+ for (IResource child : members) {
assertHasNoSyncInfo(child);
}
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/ResourceMapperTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/ResourceMapperTests.java
index e27771a77..433c56932 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/ResourceMapperTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/ResourceMapperTests.java
@@ -25,13 +25,24 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import junit.framework.Test;
-
+import org.eclipse.core.internal.resources.mapping.SimpleResourceMapping;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.mapping.RemoteResourceMappingContext;
+import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.resources.mapping.ResourceMappingContext;
+import org.eclipse.core.resources.mapping.ResourceTraversal;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.jface.util.Util;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamStatus;
import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IDiffVisitor;
import org.eclipse.team.core.diff.IThreeWayDiff;
import org.eclipse.team.core.mapping.IResourceDiffTree;
import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
@@ -60,23 +71,7 @@ import org.eclipse.team.internal.core.mapping.SyncInfoToDiffConverter;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.tests.ccvs.core.TeamCVSTestPlugin;
-import org.eclipse.core.internal.resources.mapping.SimpleResourceMapping;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.mapping.RemoteResourceMappingContext;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceMappingContext;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-
-import org.eclipse.jface.util.Util;
+import junit.framework.Test;
/**
* Tests for using CVS operations with deep and shallow resource mappings.
@@ -166,21 +161,18 @@ public class ResourceMapperTests extends EclipseTest {
private void assertAdded(ResourceMapping mapping, final SyncInfoTree set) throws CoreException {
// Assert that all resources covered by the mapping are now under version control (i.e. are in-sync)
// Remove the resources contained in the mapping from the set of unadded resources.
- visit(mapping, ResourceMappingContext.LOCAL_CONTEXT, new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- ICVSResource cvsResource = getCVSResource(resource);
- assertTrue("Resource was not added but should have been: " + resource.getFullPath(),
- (cvsResource.isManaged()
- || (cvsResource.isFolder()
- && ((ICVSFolder)cvsResource).isCVSFolder())));
- set.remove(resource);
- return true;
- }
- });
+ visit(mapping, ResourceMappingContext.LOCAL_CONTEXT, (IResourceVisitor) resource -> {
+ ICVSResource cvsResource = getCVSResource(resource);
+ assertTrue("Resource was not added but should have been: " + resource.getFullPath(),
+ (cvsResource.isManaged()
+ || (cvsResource.isFolder()
+ && ((ICVSFolder)cvsResource).isCVSFolder())));
+ set.remove(resource);
+ return true;
+ });
// Assert that the remaining unadded resources are still unadded
SyncInfo[] infos = set.getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
+ for (SyncInfo info : infos) {
ICVSResource cvsResource = getCVSResource(info.getLocal());
assertTrue("Resource was added but should not have been: " + info.getLocal().getFullPath(), !cvsResource.isManaged());
}
@@ -194,12 +186,12 @@ public class ResourceMapperTests extends EclipseTest {
// First, make sure the proper resources are tagged in the repo
assertTagged(mapping, branch);
// Now make sure the proper local files are tagged
- final Map remotes = getTaggedRemoteFilesByPath(mapping, branch);
- final Map locals = getTaggedLocalFilesByPath(mapping, branch);
- for (Iterator iter = remotes.keySet().iterator(); iter.hasNext();) {
- String key = (String)iter.next();
+ final Map<String, ICVSResource> remotes = getTaggedRemoteFilesByPath(mapping, branch);
+ final Map<String, ICVSFile> locals = getTaggedLocalFilesByPath(mapping, branch);
+ for (Iterator<String> iter = remotes.keySet().iterator(); iter.hasNext();) {
+ String key = iter.next();
ICVSRemoteFile remote = (ICVSRemoteFile)remotes.get(key);
- ICVSFile local = (ICVSFile)locals.get(key);
+ ICVSFile local = locals.get(key);
assertNotNull("Remotely tagged resource was not tagged locally: " + remote.getRepositoryRelativePath(), local);
assertEquals(local.getIResource().getParent().getFullPath(), remote, local, false, false /* include tags */);
assertEquals("Remotely tagged resource was not tagged locally: " + remote.getRepositoryRelativePath(), branch, local.getSyncInfo().getTag());
@@ -207,89 +199,81 @@ public class ResourceMapperTests extends EclipseTest {
iter.remove();
}
// The remote map should be empty after traversal
- for (Iterator iter = remotes.keySet().iterator(); iter.hasNext();) {
- String path = (String) iter.next();
+ for (Object element : remotes.keySet()) {
+ String path = (String) element;
fail("Remote file " + path + " was tagged remotely but not locally.");
}
// The local map should be empty after traversal
- for (Iterator iter = locals.keySet().iterator(); iter.hasNext();) {
- String path = (String) iter.next();
+ for (Object element : locals.keySet()) {
+ String path = (String) element;
fail("Local file " + path + " was tagged locally but not remotely.");
}
}
private void assertTagged(ResourceMapping mapping, final CVSTag tag) throws CoreException {
- final Map tagged = getTaggedRemoteFilesByPath(mapping, tag);
+ final Map<String, ICVSResource> tagged = getTaggedRemoteFilesByPath(mapping, tag);
// Visit all the resources in the traversal and ensure that they are tagged
- visit(mapping, ResourceMappingContext.LOCAL_CONTEXT, new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE) {
- ICVSRemoteFile file = popRemote(resource, tagged);
- assertNotNull("Resource was not tagged: " + resource.getFullPath(), file);
- }
- return true;
- }
- });
+ visit(mapping, ResourceMappingContext.LOCAL_CONTEXT, (IResourceVisitor) resource -> {
+ if (resource.getType() == IResource.FILE) {
+ ICVSRemoteFile file = popRemote(resource, tagged);
+ assertNotNull("Resource was not tagged: " + resource.getFullPath(), file);
+ }
+ return true;
+ });
- // The tagged map should be empty after traversal
- for (Iterator iter = tagged.keySet().iterator(); iter.hasNext();) {
- String path = (String) iter.next();
+ for (String path : tagged.keySet()) {
fail("Remote file " + path + " was tagged but should not have been.");
- }
+ }
}
- private Map getTaggedLocalFilesByPath(ResourceMapping mapping, final CVSTag branch) throws CoreException {
- final Map tagged = new HashMap();
+ private Map<String, ICVSFile> getTaggedLocalFilesByPath(ResourceMapping mapping, final CVSTag branch)
+ throws CoreException {
+ final Map<String, ICVSFile> tagged = new HashMap<>();
IProject[] projects = mapping.getProjects();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- project.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE) {
- ICVSFile file = (ICVSFile)getCVSResource(resource);
- ResourceSyncInfo info = file.getSyncInfo();
- if (info != null && info.getTag() != null && info.getTag().equals(branch)) {
- tagged.put(file.getRepositoryRelativePath(), file);
- }
- }
- return true;
- }
- });
+ for (IProject project : projects) {
+ project.accept(resource -> {
+ if (resource.getType() == IResource.FILE) {
+ ICVSFile file = (ICVSFile)getCVSResource(resource);
+ ResourceSyncInfo info = file.getSyncInfo();
+ if (info != null && info.getTag() != null && info.getTag().equals(branch)) {
+ tagged.put(file.getRepositoryRelativePath(), file);
+ }
+ }
+ return true;
+ });
}
return tagged;
}
- private Map getTaggedRemoteFilesByPath(ResourceMapping mapping, final CVSTag tag) throws CVSException {
+ private Map<String, ICVSResource> getTaggedRemoteFilesByPath(ResourceMapping mapping, final CVSTag tag)
+ throws CVSException {
IProject[] projects = mapping.getProjects();
ICVSResource[] remotes = getRemoteTrees(projects, tag);
- final Map tagged = getFilesByPath(remotes);
+ final Map<String, ICVSResource> tagged = getFilesByPath(remotes);
return tagged;
}
private ICVSResource[] getRemoteTrees(IProject[] projects, CVSTag tag) throws CVSException {
- List result = new ArrayList();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
+ List<ICVSResource> result = new ArrayList<>();
+ for (IProject project : projects) {
RemoteFolderTree tree = RemoteFolderTreeBuilder.buildRemoteTree(getRepository(), project, tag, DEFAULT_MONITOR);
result.add(tree);
}
- return (ICVSResource[]) result.toArray(new ICVSResource[result.size()]);
+ return result.toArray(new ICVSResource[result.size()]);
}
- private Map getFilesByPath(ICVSResource[] remotes) throws CVSException {
- Map result = new HashMap();
- for (int i = 0; i < remotes.length; i++) {
- ICVSResource resource = remotes[i];
+ private Map<String, ICVSResource> getFilesByPath(ICVSResource[] remotes) throws CVSException {
+ Map<String, ICVSResource> result = new HashMap<>();
+ for (ICVSResource resource : remotes) {
collectFiles(resource, result);
}
return result;
}
- private void collectFiles(ICVSResource resource, Map result) throws CVSException {
+ private void collectFiles(ICVSResource resource, Map<String, ICVSResource> result) throws CVSException {
if (resource.isFolder()) {
ICVSResource[] members = ((ICVSFolder)resource).members(ICVSFolder.ALL_EXISTING_MEMBERS);
- for (int i = 0; i < members.length; i++) {
- ICVSResource member = members[i];
+ for (ICVSResource member : members) {
collectFiles(member, result);
}
} else {
@@ -297,7 +281,7 @@ public class ResourceMapperTests extends EclipseTest {
}
}
- private ICVSRemoteFile popRemote(IResource resource, Map tagged) throws CVSException {
+ private ICVSRemoteFile popRemote(IResource resource, Map<String, ICVSResource> tagged) throws CVSException {
ICVSResource cvsResource = getCVSResource(resource);
ICVSRemoteFile remote = (ICVSRemoteFile)tagged.get(cvsResource.getRepositoryRelativePath());
if (remote != null) {
@@ -309,25 +293,28 @@ public class ResourceMapperTests extends EclipseTest {
private ResourceMapping asResourceMapping(final IResource[] resources, final int depth) {
return new ResourceMapping() {
private Object object = new Object();
- public Object getModelObject() {
+ @Override
+ public Object getModelObject() {
return object;
}
- public IProject[] getProjects() {
+ @Override
+ public IProject[] getProjects() {
return getProjects(resources);
}
private IProject[] getProjects(IResource[] resources) {
- Set projects = new HashSet();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ Set<IProject> projects = new HashSet<>();
+ for (IResource resource : resources) {
projects.add(resource.getProject());
}
- return (IProject[]) projects.toArray(new IProject[projects.size()]);
+ return projects.toArray(new IProject[projects.size()]);
}
- public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
+ @Override
+ public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
return new ResourceTraversal[] {
new ResourceTraversal(resources, depth, IResource.NONE)
};
}
+ @Override
public String getModelProviderId() {
return "org.eclipse.team.tests.cvs.core.modelProvider";
}
@@ -336,25 +323,23 @@ public class ResourceMapperTests extends EclipseTest {
private void assertUpdate(ResourceMapping mapper, final SyncInfoTree set) throws Exception {
final Exception[] exception = new Exception[] { null };
- visit(mapper, new SyncInfoSetTraveralContext(set), new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- SyncInfo info = set.getSyncInfo(resource);
- if (info != null) {
- set.remove(resource);
- try {
- // Assert that the local sync info matches the remote info
- assertEquals(resource.getParent().getFullPath(), getCVSResource(resource), (ICVSResource)info.getRemote(), false, false);
- } catch (CVSException e) {
- exception[0] = e;
- } catch (CoreException e) {
- exception[0] = e;
- } catch (IOException e) {
- exception[0] = e;
- }
- }
- return true;
- }
- });
+ visit(mapper, new SyncInfoSetTraveralContext(set), (IResourceVisitor) resource -> {
+ SyncInfo info = set.getSyncInfo(resource);
+ if (info != null) {
+ set.remove(resource);
+ try {
+ // Assert that the local sync info matches the remote info
+ assertEquals(resource.getParent().getFullPath(), getCVSResource(resource), (ICVSResource)info.getRemote(), false, false);
+ } catch (CVSException e1) {
+ exception[0] = e1;
+ } catch (CoreException e2) {
+ exception[0] = e2;
+ } catch (IOException e3) {
+ exception[0] = e3;
+ }
+ }
+ return true;
+ });
if (exception[0] != null) throw exception[0];
// check the the state of the remaining resources has not changed
@@ -362,16 +347,14 @@ public class ResourceMapperTests extends EclipseTest {
}
private void assertCommit(ResourceMapping mapper, final SyncInfoTree set) throws CoreException {
- visit(mapper, new SyncInfoSetTraveralContext(set), new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- SyncInfo info = set.getSyncInfo(resource);
- if (info != null) {
- set.remove(resource);
- assertTrue("Committed resource is not in-sync: " + resource.getFullPath(), getSyncInfo(resource).getKind() == SyncInfo.IN_SYNC);
- }
- return true;
- }
- });
+ visit(mapper, new SyncInfoSetTraveralContext(set), (IResourceVisitor) resource -> {
+ SyncInfo info = set.getSyncInfo(resource);
+ if (info != null) {
+ set.remove(resource);
+ assertTrue("Committed resource is not in-sync: " + resource.getFullPath(), getSyncInfo(resource).getKind() == SyncInfo.IN_SYNC);
+ }
+ return true;
+ });
// check the the state of the remaining resources has not changed
assertUnchanged(set);
}
@@ -383,8 +366,7 @@ public class ResourceMapperTests extends EclipseTest {
//TODO: Need to refresh the subscriber since flush of remote state is deep
CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().refresh(set.getResources(), IResource.DEPTH_ZERO, DEFAULT_MONITOR);
SyncInfo[] infos = set.getSyncInfos();
- for (int i = 0; i < infos.length; i++) {
- SyncInfo info = infos[i];
+ for (SyncInfo info : infos) {
assertUnchanged(info);
}
}
@@ -416,7 +398,8 @@ public class ResourceMapperTests extends EclipseTest {
private SyncInfoTree getUnaddedResource(ResourceMapping mapping) {
SyncInfoTree set = getAllOutOfSync(mapping.getProjects());
set.selectNodes(new FastSyncInfoFilter() {
- public boolean select(SyncInfo info) {
+ @Override
+ public boolean select(SyncInfo info) {
try {
if (info.getLocal().getType() != IResource.PROJECT && info.getRemote() == null && info.getBase() == null) {
ICVSResource resource = getCVSResource(info.getLocal());
@@ -439,44 +422,42 @@ public class ResourceMapperTests extends EclipseTest {
private IResourceDiffTree getAllDiffs(IProject[] projects) throws CoreException {
final ResourceDiffTree tree = new ResourceDiffTree();
- CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().accept(projects, IResource.DEPTH_INFINITE, new IDiffVisitor() {
- public boolean visit(IDiff delta) {
- tree.add(delta);
- return true;
- }
+ CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().accept(projects, IResource.DEPTH_INFINITE, delta -> {
+ tree.add(delta);
+ return true;
});
return tree;
}
private void visit(ResourceMapping mapper, ResourceMappingContext context, IResourceVisitor visitor) throws CoreException {
ResourceTraversal[] traversals = mapper.getTraversals(context, null);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
+ for (ResourceTraversal traversal : traversals) {
visit(traversal, context, visitor);
}
}
private void visit(ResourceTraversal traversal, ResourceMappingContext context, IResourceVisitor visitor) throws CoreException {
IResource[] resources = traversal.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
visit(resource, visitor, context, traversal.getDepth());
}
}
- private void visit(IResource resource, IResourceVisitor visitor, ResourceMappingContext context, int depth) throws CoreException {
- if (!visitor.visit(resource) || depth == IResource.DEPTH_ZERO || resource.getType() == IResource.FILE) return;
- Set members = new HashSet();
- members.addAll(Arrays.asList(((IContainer)resource).members(false)));
- if (context instanceof RemoteResourceMappingContext) {
- RemoteResourceMappingContext remoteContext = (RemoteResourceMappingContext) context;
- members.addAll(Arrays.asList(remoteContext.fetchMembers((IContainer)resource, DEFAULT_MONITOR)));
- }
- for (Iterator iter = members.iterator(); iter.hasNext();) {
- IResource member = (IResource) iter.next();
- visit(member, visitor, context, depth == IResource.DEPTH_ONE ? IResource.DEPTH_ZERO : IResource.DEPTH_INFINITE);
- }
- }
+ private void visit(IResource resource, IResourceVisitor visitor, ResourceMappingContext context, int depth)
+ throws CoreException {
+ if (!visitor.visit(resource) || depth == IResource.DEPTH_ZERO || resource.getType() == IResource.FILE)
+ return;
+ Set<IResource> members = new HashSet<>();
+ members.addAll(Arrays.asList(((IContainer) resource).members(false)));
+ if (context instanceof RemoteResourceMappingContext) {
+ RemoteResourceMappingContext remoteContext = (RemoteResourceMappingContext) context;
+ members.addAll(Arrays.asList(remoteContext.fetchMembers((IContainer) resource, DEFAULT_MONITOR)));
+ }
+ for (IResource member : members) {
+ visit(member, visitor, context,
+ depth == IResource.DEPTH_ONE ? IResource.DEPTH_ZERO : IResource.DEPTH_INFINITE);
+ }
+ }
private boolean isTimeout(Throwable e) {
if (e == null) {
@@ -737,8 +718,7 @@ public class ResourceMapperTests extends EclipseTest {
private void ensureRemoteCached(IResourceDiffTree tree) {
IResource[] resources = tree.getAffectedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IDiff node = tree.getDiff(resource);
if (node instanceof IThreeWayDiff) {
IThreeWayDiff twd = (IThreeWayDiff) node;
@@ -758,8 +738,7 @@ public class ResourceMapperTests extends EclipseTest {
private void ensureBaseCached(IResourceDiffTree tree, boolean includeOutgoing) throws TeamException, CoreException {
IResource[] resources = tree.getAffectedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
IDiff node = tree.getDiff(resource);
if (node instanceof IThreeWayDiff) {
IThreeWayDiff twd = (IThreeWayDiff) node;
@@ -795,8 +774,7 @@ public class ResourceMapperTests extends EclipseTest {
ResourceVariantCache cache = ResourceVariantCache.getCache(CVSProviderPlugin.ID);
if (cache != null) {
ResourceVariantCacheEntry[] entries = cache.getEntries();
- for (int i = 0; i < entries.length; i++) {
- ResourceVariantCacheEntry entry = entries[i];
+ for (ResourceVariantCacheEntry entry : entries) {
entry.dispose();
}
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/SyncInfoSetTraveralContext.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/SyncInfoSetTraveralContext.java
index c406764e7..2345e6638 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/SyncInfoSetTraveralContext.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/SyncInfoSetTraveralContext.java
@@ -13,14 +13,24 @@
*******************************************************************************/
package org.eclipse.team.tests.ccvs.core.mappings;
-import java.util.*;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
-import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.RemoteResourceMappingContext;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
+import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.core.variants.IResourceVariant;
/**
@@ -41,17 +51,12 @@ public class SyncInfoSetTraveralContext extends RemoteResourceMappingContext {
return set.getSyncInfo(file);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.ITraversalContext#contentDiffers(org.eclipse.core.resources.IFile, org.eclipse.core.runtime.IProgressMonitor)
- */
public boolean contentDiffers(IFile file, IProgressMonitor monitor) {
return getSyncInfo(file) != null;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.ITraversalContext#fetchContents(org.eclipse.core.resources.IFile, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStorage fetchRemoteContents(IFile file, IProgressMonitor monitor) throws CoreException {
+ @Override
+ public IStorage fetchRemoteContents(IFile file, IProgressMonitor monitor) throws CoreException {
SyncInfo info = getSyncInfo(file);
if (info == null)
return null;
@@ -61,34 +66,36 @@ public class SyncInfoSetTraveralContext extends RemoteResourceMappingContext {
return remote.getStorage(monitor);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.mapping.ITraversalContext#fetchMembers(org.eclipse.core.resources.IContainer, org.eclipse.core.runtime.IProgressMonitor)
- */
- public IResource[] fetchMembers(IContainer container, IProgressMonitor monitor) throws CoreException {
- Set members = new HashSet();
+ @Override
+ public IResource[] fetchMembers(IContainer container, IProgressMonitor monitor) throws CoreException {
+ Set<IResource> members = new HashSet<>();
members.addAll(Arrays.asList(container.members(false)));
members.addAll(Arrays.asList(set.members(container)));
- return (IResource[]) members.toArray(new IResource[members.size()]);
+ return members.toArray(new IResource[members.size()]);
}
- public void refresh(ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException {
+ @Override
+ public void refresh(ResourceTraversal[] traversals, int flags, IProgressMonitor monitor) throws CoreException {
// Do nothing
}
+ @Override
public boolean isThreeWay() {
- for (Iterator iter = set.iterator(); iter.hasNext();) {
- SyncInfo info = (SyncInfo) iter.next();
+ for (Iterator<SyncInfo> iter = set.iterator(); iter.hasNext();) {
+ SyncInfo info = iter.next();
return info.getComparator().isThreeWay();
}
return true;
}
+ @Override
public boolean hasRemoteChange(IResource resource, IProgressMonitor monitor) throws CoreException {
SyncInfo info = set.getSyncInfo(resource);
int direction = SyncInfo.getDirection(info.getKind());
return direction == SyncInfo.INCOMING || direction == SyncInfo.CONFLICTING;
}
+ @Override
public boolean hasLocalChange(IResource resource, IProgressMonitor monitor) throws CoreException {
SyncInfo info = set.getSyncInfo(resource);
int direction = SyncInfo.getDirection(info.getKind());
@@ -96,6 +103,7 @@ public class SyncInfoSetTraveralContext extends RemoteResourceMappingContext {
}
+ @Override
public IStorage fetchBaseContents(IFile file, IProgressMonitor monitor) throws CoreException {
SyncInfo info = getSyncInfo(file);
if (info == null)
@@ -106,6 +114,7 @@ public class SyncInfoSetTraveralContext extends RemoteResourceMappingContext {
return base.getStorage(monitor);
}
+ @Override
public IProject[] getProjects() {
return ResourcesPlugin.getWorkspace().getRoot().getProjects();
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/TestModelProvider.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/TestModelProvider.java
index 978afd638..e39a345be 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/TestModelProvider.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/TestModelProvider.java
@@ -19,13 +19,15 @@ import org.eclipse.team.core.mapping.ResourceMappingMerger;
public class TestModelProvider extends ModelProvider {
- public Object getAdapter(Class adapter) {
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IResourceMappingMerger.class) {
- return new ResourceMappingMerger() {
+ return adapter.cast(new ResourceMappingMerger() {
+ @Override
protected ModelProvider getModelProvider() {
return TestModelProvider.this;
- }
- };
+ }
+ });
}
return super.getAdapter(adapter);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/model/ModelFile.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/model/ModelFile.java
index e5263acaa..a9a41e328 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/model/ModelFile.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/model/ModelFile.java
@@ -38,18 +38,20 @@ public class ModelFile extends ModelObject {
IStorage storage) {
if (storage == null)
return new IResource[0];
- List result = new ArrayList();
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ List<IResource> result = new ArrayList<>();
+ return result.toArray(new IResource[result.size()]);
}
public ModelFile(IFile file) {
super(file);
}
+ @Override
public ModelObject[] getChildren() throws CoreException {
return null;
}
+ @Override
public String getName() {
String name = super.getName();
int index = name.lastIndexOf(".");
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/model/ModelProject.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/model/ModelProject.java
index aa953be56..731e09963 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/model/ModelProject.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/mappings/model/ModelProject.java
@@ -37,12 +37,12 @@ public class ModelProject extends ModelObject {
throws CoreException {
IProjectDescription description = project.getDescription();
String[] natureIds = description.getNatureIds();
- List result = new ArrayList();
- for (int i = 0; i < natureIds.length; i++) {
- result.add(natureIds[i]);
+ List<String> result = new ArrayList<>();
+ for (String natureId : natureIds) {
+ result.add(natureId);
}
result.add(ModelNature.NATURE_ID);
- description.setNatureIds((String[]) result.toArray(new String[result
+ description.setNatureIds(result.toArray(new String[result
.size()]));
project.setDescription(description, monitor);
}
@@ -55,11 +55,11 @@ public class ModelProject extends ModelObject {
return (IContainer) getResource();
}
+ @Override
public ModelObject[] getChildren() throws CoreException {
IResource[] members = getContainer().members();
- List result = new ArrayList();
- for (int i = 0; i < members.length; i++) {
- IResource resource = members[i];
+ List<ModelObject> result = new ArrayList<>();
+ for (IResource resource : members) {
if (ModelFile.isModFile(resource)) {
result.add(new ModelFile((IFile) resource));
} else if (resource instanceof IProject
@@ -67,7 +67,7 @@ public class ModelProject extends ModelObject {
result.add(new ModelProject((IProject) resource));
}
}
- return (ModelObject[]) result.toArray(new ModelObject[result.size()]);
+ return result.toArray(new ModelObject[result.size()]);
}
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java
index 395fbc03e..ee22b33aa 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java
@@ -19,8 +19,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -54,6 +52,8 @@ import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
+import junit.framework.Test;
+
/*
* This class tests both the CVSProvider and the CVSTeamProvider
*/
@@ -386,7 +386,7 @@ public class CVSProviderTest extends EclipseTest {
assertHasKSubstOption(project, "added.xtxt", CVSProviderPlugin.DEFAULT_TEXT_KSUBST_OPTION);
// change keyword substitution
- Map map = new HashMap();
+ Map<IFile, KSubstOption> map = new HashMap<>();
map.put(project.getFile("binary.xbin"), ksubst);
map.put(project.getFile("added.xbin"), ksubst);
map.put(project.getFile("text.xtxt"), ksubst);
@@ -434,7 +434,7 @@ public class CVSProviderTest extends EclipseTest {
assertHasKSubstOption(project, "dummy", Command.KSUBST_BINARY);
// change keyword substitution
- Map map = new HashMap();
+ Map<IFile, KSubstOption> map = new HashMap<>();
map.put(project.getFile("dummy"), ksubst);
// change from binary to text should commit a new file with
@@ -515,7 +515,7 @@ public class CVSProviderTest extends EclipseTest {
setContentsAndEnsureModified(project.getFile("a.txt"), "line 1");
setContentsAndEnsureModified(project.getFile("b.txt"), ("line 1" + EOL + "line 2" + EOL + "line3"));
- Map kMode = new HashMap();
+ Map<IFile, KSubstOption> kMode = new HashMap<>();
kMode.put(project.getFile("a.txt"), Command.KSUBST_TEXT);
kMode.put(project.getFile("b.txt"), Command.KSUBST_TEXT);
getProvider(project).setKeywordSubstitution(kMode, "", null);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ConcurrencyTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ConcurrencyTests.java
index 73c5aee6f..019382a06 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ConcurrencyTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ConcurrencyTests.java
@@ -53,7 +53,7 @@ public class ConcurrencyTests extends EclipseTest {
public void testBackgroundMemberFetch() throws CoreException, InvocationTargetException, InterruptedException {
IProject project = createProject("testBackgroundMemberFetch", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder2/", "folder2/a.txt", "folder2/folder3/", "folder2/folder3/b.txt", "folder2/folder3/c.txt"});
ICVSRemoteFolder folder = (ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(project);
- final List result = new ArrayList();
+ final List<Object> result = new ArrayList<>();
final boolean[] done = new boolean[] { false };
IElementCollector collector = new IElementCollector() {
public void add(Object element, IProgressMonitor monitor) {
@@ -83,7 +83,7 @@ public class ConcurrencyTests extends EclipseTest {
}
}
assertTrue(result.size() == project.members().length);
- for (Iterator iter = result.iterator(); iter.hasNext();) {
+ for (Iterator<Object> iter = result.iterator(); iter.hasNext();) {
ICVSRemoteResource remote = (ICVSRemoteResource) iter.next();
IResource local = project.findMember(remote.getName());
assertNotNull(local);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ImportTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ImportTest.java
index c3ff6aaf9..ac5cbb540 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ImportTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ImportTest.java
@@ -61,17 +61,17 @@ public class ImportTest extends EclipseTest {
// Assert that the two containers have equal contents
protected void assertEquals(IContainer container1, IContainer container2) throws CoreException {
assertEquals(container1.getName(), container2.getName());
- List members1 = new ArrayList();
+ List<IResource> members1 = new ArrayList<>();
members1.addAll(Arrays.asList(container1.members()));
members1.remove(container1.findMember("CVS"));
- List members2 = new ArrayList();
+ List<IResource> members2 = new ArrayList<>();
members2.addAll(Arrays.asList(container2.members()));
members2.remove(container2.findMember("CVS"));
assertTrue(members1.size() == members2.size());
for (int i=0;i<members1.size();i++) {
- IResource member1 = (IResource)members1.get(i);
+ IResource member1 = members1.get(i);
IResource member2 = container2.findMember(member1.getName());
assertNotNull(member2);
assertEquals(member1, member2);
@@ -87,19 +87,19 @@ public class ImportTest extends EclipseTest {
// Assert that the two projects have equal contents ignoreing the project name
// and the .vcm_meta file
protected void assertEquals(IProject container1, IProject container2) throws CoreException {
- List members1 = new ArrayList();
+ List<IResource> members1 = new ArrayList<>();
members1.addAll(Arrays.asList(container1.members()));
members1.remove(container1.findMember(".project"));
members1.remove(container1.findMember("CVS"));
- List members2 = new ArrayList();
+ List<IResource> members2 = new ArrayList<>();
members2.addAll(Arrays.asList(container2.members()));
members2.remove(container2.findMember(".project"));
members2.remove(container2.findMember("CVS"));
assertTrue("Number of children differs for " + container1.getFullPath(), members1.size() == members2.size());
for (int i=0;i<members1.size();i++) {
- IResource member1 = (IResource)members1.get(i);
+ IResource member1 = members1.get(i);
IResource member2 = container2.findMember(member1.getName());
assertNotNull(member2);
assertEquals(member1, member2);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java
index 0e64a8140..799187e35 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java
@@ -21,9 +21,15 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.util.Util;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
@@ -37,17 +43,8 @@ import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.tests.ccvs.core.TeamCVSTestPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.jface.util.Util;
+import junit.framework.Test;
+import junit.framework.TestSuite;
/**
* Test isModified on file, folders and projects.
@@ -57,10 +54,10 @@ public class IsModifiedTests extends EclipseTest {
Set previouslyModified = new HashSet();
Map changedResources = new HashMap();
IResourceStateChangeListener listener = new IResourceStateChangeListener() {
+ @Override
public void resourceSyncInfoChanged(IResource[] changedResources) {
try {
- for (int i = 0; i < changedResources.length; i++) {
- IResource resource = changedResources[i];
+ for (IResource resource : changedResources) {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
recordModificationState(cvsResource);
recordParents(cvsResource);
@@ -72,15 +69,18 @@ public class IsModifiedTests extends EclipseTest {
fail(e.getMessage());
}
}
+ @Override
public void externalSyncInfoChange(IResource[] changedResources) {
resourceSyncInfoChanged(changedResources);
}
private void recordChildren(ICVSFolder folder) {
try {
folder.accept(new ICVSResourceVisitor() {
+ @Override
public void visitFile(ICVSFile file) throws CVSException {
recordModificationState(file);
}
+ @Override
public void visitFolder(ICVSFolder folder) throws CVSException {
recordModificationState(folder);
folder.acceptChildren(this);
@@ -98,10 +98,10 @@ public class IsModifiedTests extends EclipseTest {
private void recordModificationState(ICVSResource cvsResource) throws CVSException {
IsModifiedTests.this.changedResources.put(cvsResource.getIResource(), cvsResource.isModified(null) ? Boolean.TRUE : Boolean.FALSE);
}
+ @Override
public void resourceModified(IResource[] changedResources) {
try {
- for (int i = 0; i < changedResources.length; i++) {
- IResource resource = changedResources[i];
+ for (IResource resource : changedResources) {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
IsModifiedTests.this.changedResources.put(resource, cvsResource.isModified(null) ? Boolean.TRUE : Boolean.FALSE);
recordParents(cvsResource);
@@ -113,8 +113,10 @@ public class IsModifiedTests extends EclipseTest {
fail(e.getMessage());
}
}
+ @Override
public void projectConfigured(IProject project) {
}
+ @Override
public void projectDeconfigured(IProject project) {
}
};
@@ -146,6 +148,7 @@ public class IsModifiedTests extends EclipseTest {
/**
* @see junit.framework.TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
previouslyModified.clear();
@@ -156,6 +159,7 @@ public class IsModifiedTests extends EclipseTest {
/**
* @see junit.framework.TestCase#tearDown()
*/
+ @Override
protected void tearDown() throws Exception {
previouslyModified.clear();
changedResources.clear();
@@ -169,19 +173,20 @@ public class IsModifiedTests extends EclipseTest {
*/
private void assertModificationState(IContainer container, String[] resources, final boolean listedResourcesShouldBeModified) throws CVSException {
final ICVSFolder rootFolder = CVSWorkspaceRoot.getCVSFolderFor(container);
- final List resourceList = new ArrayList();
+ final List<Path> resourceList = new ArrayList<>();
final Set modifiedResources = new HashSet();
if (resources != null) {
- for (int i = 0; i < resources.length; i++) {
- String string = resources[i];
+ for (String string : resources) {
resourceList.add(new Path(string));
}
}
waitForIgnoreFileHandling();
rootFolder.accept(new ICVSResourceVisitor() {
+ @Override
public void visitFile(ICVSFile file) throws CVSException {
assertModificationState(file);
}
+ @Override
public void visitFolder(ICVSFolder folder) throws CVSException {
// find the deepest mistake
folder.acceptChildren(this);
@@ -238,6 +243,7 @@ public class IsModifiedTests extends EclipseTest {
*
* @see org.eclipse.team.tests.ccvs.core.EclipseTest#createProject(java.lang.String, java.lang.String)
*/
+ @Override
protected IProject createProject(String prefix, String[] resources) throws CoreException, TeamException {
IProject project = super.createProject(prefix, resources);
assertModificationState(project, null, true);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RepositoryRootTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RepositoryRootTest.java
index 0340a6fab..66e6d126e 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RepositoryRootTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RepositoryRootTest.java
@@ -17,8 +17,6 @@ import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import junit.framework.Test;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -34,11 +32,14 @@ import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryRoot;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
+import junit.framework.Test;
+
public class RepositoryRootTest extends EclipseTest {
private RepositoryRoot repositoryRoot;
private RepositoryManager repositoryManager;
+ @Override
protected void setUp() throws Exception {
super.setUp();
repositoryManager = CVSUIPlugin.getPlugin().getRepositoryManager();
@@ -53,9 +54,9 @@ public class RepositoryRootTest extends EclipseTest {
private void clearRepositoryRootCache() {
String remotePaths[] = repositoryRoot.getKnownRemotePaths();
- for (int i = 0; i < remotePaths.length; i++) {
- repositoryRoot.removeTags(remotePaths[i],
- repositoryRoot.getAllKnownTags(remotePaths[i]));
+ for (String remotePath : remotePaths) {
+ repositoryRoot.removeTags(remotePath,
+ repositoryRoot.getAllKnownTags(remotePath));
}
assertEquals("Repository cache was not cleaned.", 0,
repositoryRoot.getAllKnownTags().length);
@@ -85,21 +86,21 @@ public class RepositoryRootTest extends EclipseTest {
return project;
}
- private void assertTags(List knownTags, CVSTag[] tagsToHave,
+ private void assertTags(List<CVSTag> knownTags, CVSTag[] tagsToHave,
CVSTag[] tagsNotToHave) {
- for (int i = 0; i < tagsToHave.length; i++) {
- assertTrue("Missing tag " + tagsToHave[i].getName(),
- knownTags.contains(tagsToHave[i]));
+ for (CVSTag element : tagsToHave) {
+ assertTrue("Missing tag " + element.getName(),
+ knownTags.contains(element));
}
- for (int i = 0; i < tagsNotToHave.length; i++) {
- assertFalse("Extraneous tag " + tagsNotToHave[i].getName(),
- knownTags.contains(tagsNotToHave[i]));
+ for (CVSTag element : tagsNotToHave) {
+ assertFalse("Extraneous tag " + element.getName(),
+ knownTags.contains(element));
}
}
private void assertProjectTags(CVSCacheTestData data) throws CVSException {
// Root should contain all known tags
- List knownTags = Arrays.asList(repositoryRoot.getAllKnownTags());
+ List<CVSTag> knownTags = Arrays.asList(repositoryRoot.getAllKnownTags());
assertTags(knownTags,
new CVSTag[] { data.branch_1, data.branch_2, data.branch_3,
data.version_1, data.version_2, data.version_3 },
@@ -181,7 +182,7 @@ public class RepositoryRootTest extends EclipseTest {
refreshTags(data.project2);
assertProjectTags(data);
// verify that parent module has tags from both projects
- List knownTags = Arrays.asList(repositoryManager
+ List<CVSTag> knownTags = Arrays.asList(repositoryManager
.getKnownTags(submoduleFolder));
assertTags(knownTags,
new CVSTag[] { data.branch_1, data.branch_2, data.branch_3,
@@ -218,7 +219,7 @@ public class RepositoryRootTest extends EclipseTest {
assertProjectTags(data);
// verify that parent modules have tags from subordinate project, but
// not the other project
- List knownTags = Arrays.asList(repositoryManager
+ List<CVSTag> knownTags = Arrays.asList(repositoryManager
.getKnownTags(submoduleFolder1));
assertTags(knownTags, new CVSTag[] { data.branch_1, data.branch_2,
data.version_1, data.version_2 }, new CVSTag[] { data.branch_3,
@@ -284,7 +285,8 @@ public class RepositoryRootTest extends EclipseTest {
subProject2Branch, true);
// check if subProjects have tags from superProject but not tags from
// each other, check if superProject has tags from all subProjects
- List knownTags = Arrays.asList(repositoryManager
+ List<CVSTag> knownTags = Arrays
+ .asList(repositoryManager
.getKnownTags(CVSWorkspaceRoot.getCVSFolderFor(superProject)));
assertTags(knownTags, new CVSTag[] { superProjectBranch,
superProjectVersion, subProject1Branch, subProject1Version,
@@ -334,7 +336,7 @@ public class RepositoryRootTest extends EclipseTest {
makeBranch(new IResource[] { project }, version1, branch1, true);
// verify if project's tags are known for subfolder
ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(folder);
- List knownTags = Arrays.asList(repositoryManager
+ List<CVSTag> knownTags = Arrays.asList(repositoryManager
.getKnownTags(cvsFolder));
assertTags(knownTags, new CVSTag[] { branch1, version1 }, new CVSTag[0]);
// verify if removing tags from subfolder is correctly handled
@@ -383,10 +385,9 @@ public class RepositoryRootTest extends EclipseTest {
// cache should contain branches from auto refresh file, but no branches
// from other files
- List knownTags = Arrays.asList(repositoryManager
- .getKnownTags(CVSWorkspaceRoot.getCVSFolderFor(project)));
- assertTags(knownTags, new CVSTag[] { branch1, version1 }, new CVSTag[] {
- branch2, version2 });
+ List<CVSTag> knownTags = Arrays
+ .asList(repositoryManager.getKnownTags(CVSWorkspaceRoot.getCVSFolderFor(project)));
+ assertTags(knownTags, new CVSTag[] { branch1, version1 }, new CVSTag[] { branch2, version2 });
}
public void testProjectWithNoTags() throws CoreException {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSChangeSetTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSChangeSetTests.java
index cf7cd1d33..4466b2304 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSChangeSetTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSChangeSetTests.java
@@ -65,7 +65,7 @@ public class CVSChangeSetTests extends CVSSyncSubscriberTest {
String message = messages[i];
ChangeSetDiffNode node = getCommitSetFor(root, message);
assertNotNull("The commit set for '" + message + "' is not in the sync view", node);
- List filesInSet = new ArrayList();
+ List<IResource> filesInSet = new ArrayList<>();
getFileChildren(node, filesInSet);
assertTrue("The number of files in the set do not match the expected number", files[i].length == filesInSet.size());
for (int j = 0; j < files[i].length; j++) {
@@ -80,14 +80,14 @@ public class CVSChangeSetTests extends CVSSyncSubscriberTest {
SubscriberParticipantPage page = (SubscriberParticipantPage)SubscriberParticipantSyncInfoSource.getSyncViewPage(participant);
TreeViewer viewer = (TreeViewer)page.getViewer();
Tree tree = viewer.getTree();
- List nodeList = new ArrayList();
+ List<ChangeSetDiffNode> nodeList = new ArrayList<>();
nodeList.addAll(Arrays.asList(nodes));
TreeItem[] items = tree.getItems();
removeTreeItemsFromList(nodeList, items);
assertTrue("Not all nodes are visible in the view", nodeList.isEmpty());
}
- private void removeTreeItemsFromList(List nodeList, TreeItem[] items) {
+ private void removeTreeItemsFromList(List<?> nodeList, TreeItem[] items) {
for (int i = 0; i < items.length; i++) {
TreeItem item = items[i];
nodeList.remove(item.getData());
@@ -97,7 +97,7 @@ public class CVSChangeSetTests extends CVSSyncSubscriberTest {
}
private ChangeSetDiffNode[] getCheckedInChangeSetNodes(ISynchronizeModelElement root) {
- List result = new ArrayList();
+ List<ChangeSetDiffNode> result = new ArrayList<>();
IDiffElement[] children = root.getChildren();
for (int i = 0; i < children.length; i++) {
IDiffElement element = children[i];
@@ -108,11 +108,11 @@ public class CVSChangeSetTests extends CVSSyncSubscriberTest {
}
}
}
- return (ChangeSetDiffNode[]) result.toArray(new ChangeSetDiffNode[result.size()]);
+ return result.toArray(new ChangeSetDiffNode[result.size()]);
}
private ChangeSetDiffNode[] getActiveChangeSetNodes(ISynchronizeModelElement root) {
- List result = new ArrayList();
+ List<ChangeSetDiffNode> result = new ArrayList<>();
IDiffElement[] children = root.getChildren();
for (int i = 0; i < children.length; i++) {
IDiffElement element = children[i];
@@ -123,13 +123,13 @@ public class CVSChangeSetTests extends CVSSyncSubscriberTest {
}
}
}
- return (ChangeSetDiffNode[]) result.toArray(new ChangeSetDiffNode[result.size()]);
+ return result.toArray(new ChangeSetDiffNode[result.size()]);
}
/**
* Adds IFiles to the list
*/
- private void getFileChildren(ISynchronizeModelElement node, List list) {
+ private void getFileChildren(ISynchronizeModelElement node, List<IResource> list) {
IResource resource = node.getResource();
if (resource != null && resource.getType() == IResource.FILE) {
list.add(resource);
@@ -260,9 +260,9 @@ public class CVSChangeSetTests extends CVSSyncSubscriberTest {
}
private IResource[] getOutOfSyncResources(ISynchronizeModelElement element) {
- ArrayList arrayList = new ArrayList();
+ ArrayList<SyncInfo> arrayList = new ArrayList<>();
getOutOfSync(element, arrayList);
- SyncInfo[] infos = (SyncInfo[]) arrayList.toArray(new SyncInfo[arrayList.size()]);
+ SyncInfo[] infos = arrayList.toArray(new SyncInfo[arrayList.size()]);
IResource[] resources = getResources(infos);
return resources;
}
@@ -275,7 +275,7 @@ public class CVSChangeSetTests extends CVSSyncSubscriberTest {
return resources;
}
- private void getOutOfSync(ISynchronizeModelElement node, List list) {
+ private void getOutOfSync(ISynchronizeModelElement node, List<SyncInfo> list) {
SyncInfo info = getSyncInfo(node);
if (info != null && info.getKind() != SyncInfo.IN_SYNC) {
list.add(info);
@@ -332,12 +332,12 @@ public class CVSChangeSetTests extends CVSSyncSubscriberTest {
*/
private void assertInRootSet(IResource[] resources) throws CoreException {
ISynchronizeModelElement[] nodes = getNonChangeSetRoots(getModelRoot(((SubscriberChangeSetManager)getActiveChangeSetManager()).getSubscriber()));
- List list = new ArrayList();
+ List<SyncInfo> list = new ArrayList<>();
for (int i = 0; i < nodes.length; i++) {
ISynchronizeModelElement element = nodes[i];
getOutOfSync(element, list);
}
- IResource[] outOfSync = getResources((SyncInfo[]) list.toArray(new SyncInfo[list.size()]));
+ IResource[] outOfSync = getResources(list.toArray(new SyncInfo[list.size()]));
// Only require that the expected resources are there but allow extra.
// This is required because of junk left over from previous tests.
// This means there is a bug somewhere. But where?
@@ -346,15 +346,15 @@ public class CVSChangeSetTests extends CVSSyncSubscriberTest {
}
private ISynchronizeModelElement[] getNonChangeSetRoots(ISynchronizeModelElement modelRoot) {
- List result = new ArrayList();
+ List<ISynchronizeModelElement> result = new ArrayList<>();
IDiffElement[] children = modelRoot.getChildren();
for (int i = 0; i < children.length; i++) {
IDiffElement element = children[i];
if (!(element instanceof ChangeSetDiffNode)) {
- result.add(element);
+ result.add((ISynchronizeModelElement) element);
}
}
- return (ISynchronizeModelElement[]) result.toArray(new ISynchronizeModelElement[result.size()]);
+ return result.toArray(new ISynchronizeModelElement[result.size()]);
}
public void testSimpleCommit() throws CoreException {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
index 572a003f7..23ae57dbc 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
@@ -34,7 +34,7 @@ import org.eclipse.team.tests.ccvs.ui.ModelParticipantSyncInfoSource;
public abstract class CVSSyncSubscriberTest extends EclipseTest {
private ISubscriberChangeListener listener;
- private List accumulatedTeamDeltas = new ArrayList();
+ private List<ISubscriberChangeEvent> accumulatedTeamDeltas = new ArrayList<>();
private static SyncInfoSource source = new ModelParticipantSyncInfoSource();
public CVSSyncSubscriberTest() {
@@ -131,13 +131,14 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
}
public static class ResourceCondition {
+ @SuppressWarnings("unused")
public boolean matches(IResource resource) throws CoreException, TeamException {
return true;
}
}
protected IResource[] collect(IResource[] resources, final ResourceCondition condition, int depth) throws CoreException, TeamException {
- final Set affected = new HashSet();
+ final Set<IResource> affected = new HashSet<>();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
if (resource.exists() || resource.isPhantom()) {
@@ -159,11 +160,11 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
}
}
}
- return (IResource[]) affected.toArray(new IResource[affected.size()]);
+ return affected.toArray(new IResource[affected.size()]);
}
protected IResource[] collectAncestors(IResource[] resources, ResourceCondition condition) throws CoreException, TeamException {
- Set affected = new HashSet();
+ Set<IResource> affected = new HashSet<>();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
while (resource.getType() != IResource.ROOT) {
@@ -175,12 +176,12 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
resource = resource.getParent();
}
}
- return (IResource[]) affected.toArray(new IResource[affected.size()]);
+ return affected.toArray(new IResource[affected.size()]);
}
protected ISubscriberChangeEvent[] deregisterSubscriberListener(Subscriber subscriber) {
subscriber.removeListener(listener);
- return (ISubscriberChangeEvent[]) accumulatedTeamDeltas.toArray(new SubscriberChangeEvent[accumulatedTeamDeltas.size()]);
+ return accumulatedTeamDeltas.toArray(new SubscriberChangeEvent[accumulatedTeamDeltas.size()]);
}
protected ISubscriberChangeListener registerSubscriberListener(Subscriber subscriber) {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
index 41cc42c21..7b6707aec 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
@@ -20,9 +20,18 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.util.Util;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.ISubscriberChangeEvent;
@@ -46,20 +55,8 @@ import org.eclipse.team.tests.ccvs.core.mappings.model.ModelProject;
import org.eclipse.team.tests.ccvs.core.mappings.model.mapping.ModelResourceMapping;
import org.eclipse.team.tests.ccvs.ui.ModelParticipantSyncInfoSource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-
-import org.eclipse.jface.util.Util;
+import junit.framework.Test;
+import junit.framework.TestSuite;
/**
* This class tests the CVSWorkspaceSubscriber
@@ -91,6 +88,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
}
+ @Override
protected boolean isFailOnSyncInfoMismatch() {
return CVSTestSetup.FAIL_ON_BAD_DIFF ;
}
@@ -104,6 +102,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
* The shareProject method is invoked when creating new projects.
* @see org.eclipse.team.tests.ccvs.core.EclipseTest#shareProject(org.eclipse.core.resources.IProject)
*/
+ @Override
protected void shareProject(final IProject project) throws TeamException, CoreException {
mapNewProject(project);
// Everything should be outgoing addition except he project
@@ -120,27 +119,19 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
assertTrue(kind == SyncInfo.IN_SYNC);
return;
}
- rootResource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- assertSyncEquals(rootResource.getName(), getSubscriber(), resource, kind);
- return true;
- }
+ rootResource.accept((IResourceVisitor) resource -> {
+ assertSyncEquals(rootResource.getName(), getSubscriber(), resource, kind);
+ return true;
}, depth, true);
}
private void assertAllSyncEquals(IResource[] resources, int kind, int depth) throws CoreException {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
assertAllSyncEquals(resource, kind, depth);
}
}
- /* (non-Javadoc)
- *
- * Override to check that the proper sync state is achieved.
- *
- * @see org.eclipse.team.tests.ccvs.core.EclipseTest#setContentsAndEnsureModified(org.eclipse.core.resources.IFile)
- */
+ @Override
protected void setContentsAndEnsureModified(IFile file) throws CoreException, TeamException {
// The delta will indicate to any interested parties that the sync state of the
// file has changed
@@ -163,12 +154,11 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
assertSyncEquals(message, getSubscriber(), resource, syncKind);
}
- /* (non-Javadoc)
- * @see org.eclipse.team.tests.ccvs.core.EclipseTest#addResources(org.eclipse.core.resources.IResource[])
- */
+ @Override
protected void addResources(IResource[] resources) throws TeamException, CVSException, CoreException {
// first, get affected children
IResource[] affectedChildren = collect(resources, new ResourceCondition() {
+ @Override
public boolean matches(IResource resource) throws TeamException {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
return (!cvsResource.isManaged() && !cvsResource.isIgnored());
@@ -176,22 +166,22 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
}, IResource.DEPTH_INFINITE);
// also get affected parents
IResource[] affectedParents = collectAncestors(resources, new ResourceCondition() {
+ @Override
public boolean matches(IResource resource) throws CoreException, TeamException {
if (resource.getType() == IResource.PROJECT) return false;
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
return (!cvsResource.isManaged() && !cvsResource.isIgnored());
}
});
- Set affected = new HashSet();
+ Set<IResource> affected = new HashSet<>();
affected.addAll(Arrays.asList(affectedChildren));
affected.addAll(Arrays.asList(affectedParents));
registerSubscriberListener();
super.addResources(resources);
ISubscriberChangeEvent[] changes = deregisterSubscriberListener();
- assertSyncChangesMatch(changes, (IResource[]) affected.toArray(new IResource[affected.size()]));
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ assertSyncChangesMatch(changes, affected.toArray(new IResource[affected.size()]));
+ for (IResource resource : resources) {
if (resource.getType() == IResource.FILE) {
assertSyncEquals("Add", resource, SyncInfo.OUTGOING | SyncInfo.ADDITION);
} else {
@@ -209,14 +199,14 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
/* (non-Javadoc)
* @see org.eclipse.team.tests.ccvs.core.EclipseTest#deleteResources(org.eclipse.core.resources.IResource[])
*/
+ @Override
protected void deleteResources(IResource[] resources) throws TeamException, CoreException {
IResource[] affected = collect(resources, new ResourceCondition(), IResource.DEPTH_INFINITE);
registerSubscriberListener();
super.deleteResources(resources);
ISubscriberChangeEvent[] changes = deregisterSubscriberListener();
assertSyncChangesMatch(changes, affected);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
// After deletion, folders should be in-sync while files should be outgoing deletions
if (resource.getType() == IResource.FILE) {
assertSyncEquals("Delete", resource, SyncInfo.OUTGOING | SyncInfo.DELETION);
@@ -233,8 +223,10 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
/* (non-Javadoc)
* @see org.eclipse.team.tests.ccvs.core.EclipseTest#commitResources(org.eclipse.core.resources.IResource[])
*/
+ @Override
protected void commitResources(IResource[] resources, int depth) throws TeamException, CVSException, CoreException {
IResource[] affected = collect(resources, new ResourceCondition() {
+ @Override
public boolean matches(IResource resource) throws CoreException, TeamException {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
return (!cvsResource.isFolder() && cvsResource.isManaged() && cvsResource.isModified(DEFAULT_MONITOR));
@@ -244,8 +236,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
super.commitResources(resources, depth);
ISubscriberChangeEvent[] changes = deregisterSubscriberListener();
assertSyncChangesMatch(changes, affected);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (resource.exists())
assertSyncEquals("Commit", resource, SyncInfo.IN_SYNC);
}
@@ -254,8 +245,10 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
/* (non-Javadoc)
* @see org.eclipse.team.tests.ccvs.core.EclipseTest#unmanageResources(org.eclipse.core.resources.IResource[])
*/
+ @Override
protected void unmanageResources(IResource[] resources) throws CoreException, TeamException {
IResource[] affected = collect(resources, new ResourceCondition() {
+ @Override
public boolean matches(IResource resource) throws CoreException, TeamException {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
return (cvsResource.isManaged());
@@ -265,8 +258,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
super.unmanageResources(resources);
ISubscriberChangeEvent[] changes = deregisterSubscriberListener();
assertSyncChangesMatch(changes, affected);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
if (resource.exists())
assertSyncEquals("Unmanage", resource, SyncInfo.IN_SYNC);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java
index 2487ac2ef..02dd4d60a 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java
@@ -15,7 +15,6 @@ package org.eclipse.team.tests.ccvs.core.subscriber;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
@@ -51,8 +50,8 @@ import junit.framework.AssertionFailedError;
public class SyncInfoSource {
protected static IProgressMonitor DEFAULT_MONITOR = new NullProgressMonitor();
- protected List mergeSubscribers = new ArrayList();
- protected List compareSubscribers = new ArrayList();
+ protected List<CVSMergeSubscriber> mergeSubscribers = new ArrayList<>();
+ protected List<CVSCompareSubscriber> compareSubscribers = new ArrayList<>();
public CVSMergeSubscriber createMergeSubscriber(IProject project, CVSTag root, CVSTag branch) {
return createMergeSubscriber(project, root, branch, false /*default*/);
@@ -74,6 +73,9 @@ public class SyncInfoSource {
// Nothing to do
}
+ /**
+ * @throws TeamException
+ */
public Subscriber createWorkspaceSubscriber() throws TeamException {
return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
}
@@ -117,8 +119,7 @@ public class SyncInfoSource {
}
public void tearDown() {
- for (Iterator it = mergeSubscribers.iterator(); it.hasNext(); ) {
- CVSMergeSubscriber s = (CVSMergeSubscriber) it.next();
+ for (CVSMergeSubscriber s : mergeSubscribers) {
s.cancel();
}
}
@@ -145,7 +146,7 @@ public class SyncInfoSource {
// Only test if kinds are equal
assertDiffKindEquals(message, subscriber, resource, SyncInfoToDiffConverter.asDiffFlags(syncKind));
}
- junit.framework.Assert.assertTrue(message + ": improper sync state for " + resource + " expected " +
+ Assert.assertTrue(message + ": improper sync state for " + resource + " expected " +
SyncInfo.kindToString(kindOther) + " but was " +
SyncInfo.kindToString(kind), kind == kindOther);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSHisoryTableProviderTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSHisoryTableProviderTest.java
index a3b5a945b..e0f442c5b 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSHisoryTableProviderTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CVSHisoryTableProviderTest.java
@@ -13,7 +13,6 @@
*******************************************************************************/
package org.eclipse.team.tests.ccvs.ui;
-import java.util.Iterator;
import java.util.List;
import junit.framework.Test;
@@ -39,7 +38,7 @@ import org.eclipse.team.tests.ccvs.core.EclipseTest;
public class CVSHisoryTableProviderTest extends EclipseTest {
- public void testAllNegatives() throws Exception {
+ public void testAllNegatives() {
Display display = Display.getCurrent();
Shell shell = new Shell(display);
Composite composite = new Composite(shell, SWT.NONE);
@@ -58,12 +57,11 @@ public class CVSHisoryTableProviderTest extends EclipseTest {
assertEquals(6, items.length);
// List columns = layout.columns;
- List/* <ColumnLayoutData> */columns = (List) ReflectionUtils.getField(
+ List<ColumnLayoutData> columns = (List<ColumnLayoutData>) ReflectionUtils.getField(
layout, "columns");
// same weight for all columns
int weight = ((ColumnWeightData) columns.get(0)).weight;
- for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
- ColumnLayoutData column = (ColumnLayoutData) iterator.next();
+ for (ColumnLayoutData column : columns) {
assertTrue(column instanceof ColumnWeightData);
ColumnWeightData c = (ColumnWeightData) column;
assertTrue(c.weight > 0);
@@ -72,7 +70,7 @@ public class CVSHisoryTableProviderTest extends EclipseTest {
// layout.layout(tree, false /*ignored in TableLayout*/);
}
- public void testAllZeros() throws Exception {
+ public void testAllZeros() {
Display display = Display.getCurrent();
Shell shell = new Shell(display);
Composite composite = new Composite(shell, SWT.NONE);
@@ -93,12 +91,11 @@ public class CVSHisoryTableProviderTest extends EclipseTest {
assertEquals(6, items.length);
// List columns = layout.columns;
- List/* <ColumnLayoutData> */columns = (List) ReflectionUtils.getField(
+ List <ColumnLayoutData> columns = (List<ColumnLayoutData>) ReflectionUtils.getField(
layout, "columns");
// same weight for all columns
int weight = ((ColumnWeightData) columns.get(0)).weight;
- for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
- ColumnLayoutData column = (ColumnLayoutData) iterator.next();
+ for (ColumnLayoutData column : columns) {
assertTrue(column instanceof ColumnWeightData);
ColumnWeightData c = (ColumnWeightData) column;
assertTrue(c.weight > 0);
@@ -106,7 +103,7 @@ public class CVSHisoryTableProviderTest extends EclipseTest {
}
}
- public void testNewBranchColumn() throws Exception {
+ public void testNewBranchColumn() {
Display display = Display.getCurrent();
Shell shell = new Shell(display);
Composite composite = new Composite(shell, SWT.NONE);
@@ -130,10 +127,9 @@ public class CVSHisoryTableProviderTest extends EclipseTest {
assertEquals(6, items.length);
// List columns = layout.columns;
- List/* <ColumnLayoutData> */columns = (List) ReflectionUtils.getField(
+ List<ColumnLayoutData> columns = (List<ColumnLayoutData>) ReflectionUtils.getField(
layout, "columns");
- for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
- ColumnLayoutData column = (ColumnLayoutData) iterator.next();
+ for (ColumnLayoutData column : columns) {
assertTrue(column instanceof ColumnPixelData);
ColumnPixelData c = (ColumnPixelData) column;
assertTrue(c.width > 0);
@@ -145,7 +141,7 @@ public class CVSHisoryTableProviderTest extends EclipseTest {
assertEquals(pixels, branchesColumnWidth);
}
- public void testAllPositives() throws Exception {
+ public void testAllPositives() {
Display display = Display.getCurrent();
Shell shell = new Shell(display);
Composite composite = new Composite(shell, SWT.NONE);
@@ -169,17 +165,16 @@ public class CVSHisoryTableProviderTest extends EclipseTest {
assertEquals(6, items.length);
// List columns = layout.columns;
- List/* <ColumnLayoutData> */columns = (List) ReflectionUtils.getField(
+ List<ColumnLayoutData> columns = (List<ColumnLayoutData>) ReflectionUtils.getField(
layout, "columns");
- for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
- ColumnLayoutData column = (ColumnLayoutData) iterator.next();
+ for (ColumnLayoutData column : columns) {
assertTrue(column instanceof ColumnPixelData);
ColumnPixelData c = (ColumnPixelData) column;
assertEquals(100, c.width);
}
}
- public void testHiddenColumn() throws Exception {
+ public void testHiddenColumn() {
Display display = Display.getCurrent();
Shell shell = new Shell(display);
Composite composite = new Composite(shell, SWT.NONE);
@@ -203,9 +198,9 @@ public class CVSHisoryTableProviderTest extends EclipseTest {
assertEquals(6, items.length);
// List columns = layout.columns;
- List/* <ColumnLayoutData> */columns = (List) ReflectionUtils.getField(
+ List<ColumnPixelData> columns = (List<ColumnPixelData>) ReflectionUtils.getField(
layout, "columns");
- ColumnPixelData[] columnsArray = (ColumnPixelData[]) columns.toArray(new ColumnPixelData[0]);
+ ColumnPixelData[] columnsArray = columns.toArray(new ColumnPixelData[0]);
assertEquals(100, columnsArray[0].width);
assertEquals(0, columnsArray[1].width); // keep user settings
assertEquals(100, columnsArray[2].width);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CommitSetTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CommitSetTests.java
index ccf3afd36..81a9145b3 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CommitSetTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CommitSetTests.java
@@ -34,8 +34,8 @@ import org.eclipse.team.tests.ccvs.core.EclipseTest;
*/
public class CommitSetTests extends EclipseTest {
- private List addedSets = new ArrayList();
- private List removedSets = new ArrayList();
+ private List<ChangeSet> addedSets = new ArrayList<>();
+ private List<ChangeSet> removedSets = new ArrayList<>();
private IChangeSetChangeListener listener = new IChangeSetChangeListener() {
public void setAdded(ChangeSet set) {
addedSets.add(set);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java
index b6db03f60..a6e170e23 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java
@@ -13,15 +13,20 @@
*******************************************************************************/
package org.eclipse.team.tests.ccvs.ui;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.ICVSFile;
+import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
+import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
@@ -29,6 +34,9 @@ import org.eclipse.team.internal.ccvs.ui.operations.RemoteCompareOperation;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.ui.IWorkbenchPart;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
public class CompareOperationTests extends CVSOperationTest {
public class TestRemoteCompareOperation extends RemoteCompareOperation {
@@ -41,6 +49,7 @@ public class CompareOperationTests extends CVSOperationTest {
/*
* Override to prevent compare editor from opening and to capture the results
*/
+ @Override
protected void openCompareEditor(CompareTreeBuilder builder) {
this.leftTree = builder.getLeftTree();
this.rightTree = builder.getRightTree();
@@ -86,23 +95,20 @@ public class CompareOperationTests extends CVSOperationTest {
IResource[] filesWithoutRevisions = getResources(project, filePathsWithoutRevisions);
ICVSRemoteFile[] files= getAllFiles(folder);
assertTrue("The number of remote files with differences does not match the expected number", files.length == (filePathsWithoutRevisions.length + filePathsWithRevisions.length));
- for (int i = 0; i < files.length; i++) {
- ICVSRemoteFile remoteFile = files[i];
- for (int j = 0; j < filesWithRevisions.length; j++) {
- IResource local = filesWithRevisions[j];
+ for (ICVSRemoteFile remoteFile : files) {
+ for (IResource local : filesWithRevisions) {
ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)local);
if (cvsFile.getRepositoryRelativePath().equals(remoteFile.getRepositoryRelativePath())) {
ResourceSyncInfo info = cvsFile.getSyncInfo();
assertNotNull(info);
String localRevision = info.getRevision();
assertNotNull(localRevision);
- String remoteRevision = files[i].getRevision();
+ String remoteRevision = remoteFile.getRevision();
assertNotNull(remoteRevision);
assertEquals("Revisions do not match for " + local.getProjectRelativePath(), localRevision, remoteRevision);
}
}
- for (int j = 0; j < filesWithoutRevisions.length; j++) {
- IResource local = filesWithoutRevisions[j];
+ for (IResource local : filesWithoutRevisions) {
ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)local);
if (cvsFile.getRepositoryRelativePath().equals(remoteFile.getRepositoryRelativePath())) {
ResourceSyncInfo info = cvsFile.getSyncInfo();
@@ -116,19 +122,18 @@ public class CompareOperationTests extends CVSOperationTest {
}
private ICVSRemoteFile[] getAllFiles(ICVSRemoteFolder folder) {
- List result = new ArrayList();
+ List<ICVSRemoteFile> result = new ArrayList<>();
ICVSRemoteResource[] children = ((RemoteFolder)folder).getChildren();
if (children != null) {
- for (int i = 0; i < children.length; i++) {
- ICVSRemoteResource resource = children[i];
+ for (ICVSRemoteResource resource : children) {
if (resource.isContainer()) {
result.addAll(Arrays.asList(getAllFiles((ICVSRemoteFolder)resource)));
} else {
- result.add(resource);
+ result.add((ICVSRemoteFile) resource);
}
}
}
- return (ICVSRemoteFile[]) result.toArray(new ICVSRemoteFile[result.size()]);
+ return result.toArray(new ICVSRemoteFile[result.size()]);
}
public void testCompareWithLatest() throws TeamException, CoreException {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java
index 0224464d3..e0f87ee3e 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java
@@ -92,7 +92,7 @@ public class CreatePatchTest extends EclipseTest {
}
//TODO Temporary switched off, see Bug 400540
- public void _testCreateWorkspacePatch() throws Exception {
+ public void _testCreateWorkspacePatch() {
copyIntoWorkspace("exp_addition.txt", "addition.txt");
openGenerateDiffFileWizard(new IResource[] { testProject });
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EnablementTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EnablementTest.java
index bfc2c0e4e..6d69c1440 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EnablementTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/EnablementTest.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
@@ -60,8 +61,8 @@ public class EnablementTest extends EclipseTest {
return createProject(actionName, new String[] { "file.txt", "folder1/", "folder1/a.txt" });
}
- protected List getManagedResources(IProject testProject, boolean includeFolders, boolean multiple) {
- List result = new ArrayList();
+ protected List<IResource> getManagedResources(IProject testProject, boolean includeFolders, boolean multiple) {
+ List<IResource> result = new ArrayList<>();
if (includeFolders) {
result.add(testProject.getFolder("folder1"));
} else {
@@ -73,8 +74,8 @@ public class EnablementTest extends EclipseTest {
return result;
}
- protected List getAddedResources(IProject testProject) throws CoreException, TeamException {
- List result = new ArrayList();
+ protected List<IResource> getAddedResources(IProject testProject) throws CoreException, TeamException {
+ List<IResource> result = new ArrayList<>();
IFile file = testProject.getFile("added.txt");
if (!file.exists()) {
addResources(testProject, new String[] {"added.txt"}, false);
@@ -83,8 +84,8 @@ public class EnablementTest extends EclipseTest {
return result;
}
- protected List getIgnoredResources(IProject testProject) throws CoreException, TeamException {
- List result = new ArrayList();
+ protected List<IResource> getIgnoredResources(IProject testProject) throws CoreException, TeamException {
+ List<IResource> result = new ArrayList<>();
IFile file = testProject.getFile("ignored.txt");
if (!file.exists()) {
file.create(getRandomContents(), false, null);
@@ -100,8 +101,8 @@ public class EnablementTest extends EclipseTest {
return result;
}
- protected List getUnmanagedResources(IProject testProject) throws CoreException, TeamException {
- List result = new ArrayList();
+ protected List<IResource> getUnmanagedResources(IProject testProject) throws CoreException, TeamException {
+ List<IResource> result = new ArrayList<>();
IFile file = testProject.getFile("unmanaged.txt");
if (!file.exists()) {
file.create(getRandomContents(), false, null);
@@ -115,8 +116,8 @@ public class EnablementTest extends EclipseTest {
* @param project
* @return Collection
*/
- protected List getResourceWithUnmanagedParent(IProject project) throws CoreException {
- List result = new ArrayList();
+ protected List<IResource> getResourceWithUnmanagedParent(IProject project) throws CoreException {
+ List<IResource> result = new ArrayList<>();
IFolder folder = project.getFolder("newFolder");
if(!folder.exists()) folder.create(false, true, null);
IFile file = folder.getFile("unmanaged.txt");
@@ -127,8 +128,8 @@ public class EnablementTest extends EclipseTest {
return result;
}
- protected List getOverlappingResources(IProject testProject, boolean includeFiles) {
- List result = new ArrayList();
+ protected List<IResource> getOverlappingResources(IProject testProject, boolean includeFiles) {
+ List<IResource> result = new ArrayList<>();
result.add(testProject);
result.add(testProject.getFolder("folder1"));
if (includeFiles) {
@@ -137,7 +138,7 @@ public class EnablementTest extends EclipseTest {
return result;
}
- protected ISelection asSelection(List resources) {
+ protected ISelection asSelection(List<IResource> resources) {
return new StructuredSelection(resources);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java
index 85721ddb5..aeb3a0415 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java
@@ -16,9 +16,6 @@ package org.eclipse.team.tests.ccvs.ui;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -27,10 +24,28 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.ui.actions.*;
+import org.eclipse.team.internal.ccvs.ui.actions.AddAction;
+import org.eclipse.team.internal.ccvs.ui.actions.BranchAction;
+import org.eclipse.team.internal.ccvs.ui.actions.CommitAction;
+import org.eclipse.team.internal.ccvs.ui.actions.CompareWithRevisionAction;
+import org.eclipse.team.internal.ccvs.ui.actions.CompareWithTagAction;
+import org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction;
+import org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction;
+import org.eclipse.team.internal.ccvs.ui.actions.MergeAction;
+import org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRemoteAction;
+import org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithSelectableTagAction;
+import org.eclipse.team.internal.ccvs.ui.actions.SetKeywordSubstitutionAction;
+import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
+import org.eclipse.team.internal.ccvs.ui.actions.SyncAction;
+import org.eclipse.team.internal.ccvs.ui.actions.TagLocalAction;
+import org.eclipse.team.internal.ccvs.ui.actions.UnmanageAction;
+import org.eclipse.team.internal.ccvs.ui.actions.UpdateAction;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.ui.IActionDelegate;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
/**
* Test the menu enablement code for the CVS menus
*/
@@ -75,7 +90,7 @@ public class MenuEnablementTest extends EnablementTest {
* @param b
*/
private void assertEnablement(IActionDelegate action, IProject project, int kind, boolean expectedEnablement) throws CoreException, TeamException {
- List resources = new ArrayList();
+ List<IResource> resources = new ArrayList<>();
boolean multiple = (kind & SINGLE_ONLY) == 0;
boolean includeFolders = ((kind & FOLDERS) > 0) || ((kind & FILES) == 0);
if ((kind & MANAGED) > 0) {
@@ -124,13 +139,13 @@ public class MenuEnablementTest extends EnablementTest {
}
private void assertDisabledForFolderFileOverlap(IActionDelegate action, IProject project) {
- List resources = getOverlappingResources(project, true /* include files */);
+ List<IResource> resources = getOverlappingResources(project, true /* include files */);
assertEnablement(action, asSelection(resources), false /* enabled */);
}
private void assertDisabledForClosedProject(IActionDelegate action, IProject project) throws CoreException {
project.close(null);
- List resources = new ArrayList();
+ List<IResource> resources = new ArrayList<>();
resources.add(project);
assertEnablement(action, asSelection(resources), false /* enabled */);
project.open(null);
@@ -140,13 +155,13 @@ public class MenuEnablementTest extends EnablementTest {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("Non-CVS");
if (!project.exists())
project.create(null);
- List resources = new ArrayList();
+ List<IResource> resources = new ArrayList<>();
resources.add(project);
assertEnablement(action, asSelection(resources), false /* enabled */);
}
private void assertEnabledForFolderOnlyOverlap(IActionDelegate action, IProject project) {
- List resources = getOverlappingResources(project, false /* include files */);
+ List<IResource> resources = getOverlappingResources(project, false /* include files */);
assertEnablement(action, asSelection(resources), true /* enabled */);
}
@@ -363,7 +378,7 @@ public class MenuEnablementTest extends EnablementTest {
IActionDelegate action = new UnmanageAction();
IProject project = createTestProject(action);
assertDisabledForCommonReasons(action, project);
- List resources = new ArrayList();
+ List<IResource> resources = new ArrayList<>();
resources.add(project);
ensureAllSyncInfoLoaded(project);
assertEnablement(action, asSelection(resources), true);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ModelParticipantSyncInfoSource.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ModelParticipantSyncInfoSource.java
index c3aac32dc..20d6a61cd 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ModelParticipantSyncInfoSource.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ModelParticipantSyncInfoSource.java
@@ -106,6 +106,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
public IContainer getResource() {
return container;
}
+ @Override
public boolean equals(Object obj) {
if (obj == this)
return true;
@@ -115,12 +116,14 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
}
return false;
}
+ @Override
public int hashCode() {
return getResource().hashCode();
}
- public Object getAdapter(Class adapter) {
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
if (adapter == IResource.class || adapter == IContainer.class)
- return container;
+ return adapter.cast(container);
return super.getAdapter(adapter);
}
}
@@ -130,18 +133,23 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
public ZeroDepthResourceMapping(ZeroDepthContainer container) {
this.container = container;
}
+ @Override
public Object getModelObject() {
return container;
}
+ @Override
public String getModelProviderId() {
return ModelProvider.RESOURCE_MODEL_PROVIDER_ID;
}
+ @Override
public IProject[] getProjects() {
return new IProject[] { container.getResource().getProject() };
}
+ @Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) {
return new ResourceTraversal[] { new ResourceTraversal(new IResource[] { container.getResource() }, IResource.DEPTH_ZERO, IResource.NONE)};
}
+ @Override
public boolean contains(ResourceMapping mapping) {
if (mapping.getModelProviderId().equals(this.getModelProviderId())) {
Object object = mapping.getModelObject();
@@ -163,10 +171,10 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
public static ModelSynchronizeParticipant getParticipant(Subscriber subscriber) {
// show the sync view
ISynchronizeParticipantReference[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
- for (int i = 0; i < participants.length; i++) {
+ for (ISynchronizeParticipantReference participant2 : participants) {
ISynchronizeParticipant participant;
try {
- participant = participants[i].getParticipant();
+ participant = participant2.getParticipant();
} catch (TeamException e) {
return null;
}
@@ -183,10 +191,12 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
return null;
}
+ @Override
public void assertSyncEquals(String message, Subscriber subscriber, IResource resource, int syncKind) throws CoreException {
assertDiffKindEquals(message, subscriber, resource, SyncInfoToDiffConverter.asDiffFlags(syncKind));
}
+ @Override
protected IDiff getDiff(Subscriber subscriber, IResource resource) throws CoreException {
waitForCollectionToFinish(subscriber);
IDiff subscriberDiff = subscriber.getDiff(resource);
@@ -195,12 +205,15 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
return contextDiff;
}
+ @Override
public void refresh(Subscriber subscriber, IResource[] resources) throws TeamException {
RefreshParticipantJob job = new RefreshModelParticipantJob(getParticipant(subscriber), "Refresh", "Refresh", Utils.getResourceMappings(resources), new IRefreshSubscriberListener() {
+ @Override
public void refreshStarted(IRefreshEvent event) {
// Do nothing
}
+ @Override
public IWorkbenchAction refreshDone(IRefreshEvent event) {
// Do nothing
return null;
@@ -233,8 +246,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
return false;
Job[] jobs = Job.getJobManager().find(family);
boolean waited = false;
- for (int i = 0; i < jobs.length; i++) {
- Job job = jobs[i];
+ for (Job job : jobs) {
while (job.getState() != Job.NONE) {
waited = true;
while (Display.getCurrent().readAndDispatch()) {}
@@ -329,6 +341,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
return p.getContext().getDiffTree().getDiff(resource);
}
+ @Override
protected SyncInfo getSyncInfo(Subscriber subscriber, IResource resource) throws TeamException {
try {
IDiff diff = getDiff(subscriber, resource);
@@ -338,6 +351,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
}
}
+ @Override
protected void assertProjectRemoved(Subscriber subscriber, IProject project) {
super.assertProjectRemoved(subscriber, project);
waitForCollectionToFinish(subscriber);
@@ -365,6 +379,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
return null;
}
+ @Override
public CVSMergeSubscriber createMergeSubscriber(IProject project, CVSTag root, CVSTag branch) {
CVSMergeSubscriber mergeSubscriber = super.createMergeSubscriber(project, root, branch);
ModelSynchronizeParticipant participant = new ModelMergeParticipant(MergeSubscriberContext.createContext(createScopeManager(project, mergeSubscriber), mergeSubscriber));
@@ -372,6 +387,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
return mergeSubscriber;
}
+ @Override
public Subscriber createWorkspaceSubscriber() throws TeamException {
ISynchronizeManager synchronizeManager = TeamUI.getSynchronizeManager();
ISynchronizeParticipantReference[] participants = synchronizeManager.get(WorkspaceModelParticipant.ID);
@@ -387,6 +403,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
return subscriber;
}
+ @Override
public CVSCompareSubscriber createCompareSubscriber(IResource resource, CVSTag tag) {
CVSCompareSubscriber s = super.createCompareSubscriber(resource, tag);
ModelSynchronizeParticipant participant = new ModelCompareParticipant(CompareSubscriberContext.createContext(createScopeManager(resource, s), s));
@@ -394,12 +411,14 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
return s;
}
+ @Override
public void disposeSubscriber(Subscriber subscriber) {
ISynchronizeParticipant participant = getParticipant(subscriber);
ISynchronizeManager synchronizeManager = TeamUI.getSynchronizeManager();
synchronizeManager.removeSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
}
+ @Override
public void mergeResources(Subscriber subscriber, IResource[] resources, boolean allowOverwrite) throws TeamException {
// Try a merge first
internalMergeResources(subscriber, resources, false);
@@ -415,8 +434,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
private void assertInSync(Subscriber subscriber, IResource[] resources) throws CoreException {
waitForCollectionToFinish(subscriber);
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ for (IResource resource : resources) {
assertSyncEquals("merge failed", subscriber, resource, SyncInfo.IN_SYNC);
}
@@ -424,9 +442,11 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
private void internalMergeResources(Subscriber subscriber, IResource[] resources, final boolean allowOverwrite) throws TeamException {
ResourceMergeHandler handler = new ResourceMergeHandler(getConfiguration(subscriber), allowOverwrite) {
+ @Override
protected boolean promptToConfirm() {
return true;
}
+ @Override
protected void promptForNoChanges() {
// Do nothing
}
@@ -440,6 +460,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
waitForCollectionToFinish(subscriber);
}
+ @Override
public void markAsMerged(Subscriber subscriber, IResource[] resources) throws InvocationTargetException, InterruptedException, TeamException {
ResourceMarkAsMergedHandler handler = new ResourceMarkAsMergedHandler(getConfiguration(subscriber));
handler.updateEnablement(new StructuredSelection(resources));
@@ -451,14 +472,17 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
waitForCollectionToFinish(subscriber);
}
+ @Override
public void updateResources(Subscriber subscriber, IResource[] resources) throws CoreException {
mergeResources(subscriber, resources, false);
}
+ @Override
public void overrideAndUpdateResources(Subscriber subscriber, boolean shouldPrompt, IResource[] resources) throws CoreException {
mergeResources(subscriber, resources, true);
}
+ @Override
public void commitResources(Subscriber subscriber, IResource[] resources) throws CoreException {
try {
new CommitWizard.AddAndCommitOperation(null,
@@ -472,22 +496,20 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
}
private IResource[] getChangedFiles(Subscriber subscriber, IResource[] resources) throws CoreException {
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ List<IResource> result = new ArrayList<>();
+ for (IResource resource : resources) {
if (resource.getType() == IResource.FILE) {
IDiff diff = subscriber.getDiff(resource);
if (diff != null)
result.add(resource);
}
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
private IResource[] getNewResources(Subscriber subscriber, IResource[] resources) throws CoreException {
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ List<IResource> result = new ArrayList<>();
+ for (IResource resource : resources) {
IDiff diff = subscriber.getDiff(resource);
if (diff instanceof IThreeWayDiff) {
IThreeWayDiff twd = (IThreeWayDiff) diff;
@@ -498,22 +520,22 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
}
}
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
private ResourceMapping[] asResourceMappings(IResource[] resources) {
- List result = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
+ List<ResourceMapping> result = new ArrayList<>();
+ for (IResource resource : resources) {
if (resource.getType() == IResource.FILE) {
result.add(Utils.getResourceMapping(resource));
} else {
result.add(new ZeroDepthResourceMapping(new ZeroDepthContainer((IContainer)resource)));
}
}
- return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
+ return result.toArray(new ResourceMapping[result.size()]);
}
+ @Override
public void overrideAndCommitResources(Subscriber subscriber, IResource[] resources) throws CoreException {
try {
markAsMerged(subscriber, resources);
@@ -548,6 +570,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
throw new AssertionFailedError("The page for " + subscriber.getName() + " could not be retrieved");
}
+ @Override
public void assertViewMatchesModel(Subscriber subscriber) {
waitForCollectionToFinish(subscriber);
TreeItem[] rootItems = getTreeItems(subscriber);
@@ -555,8 +578,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
ResourceDiffTree tree = (ResourceDiffTree)p.getContext().getDiffTree();
ResourceDiffTree copy = new ResourceDiffTree();
IDiff[] diffs = tree.getDiffs();
- for (int i = 0; i < diffs.length; i++) {
- IDiff diff = diffs[i];
+ for (IDiff diff : diffs) {
copy.add(diff);
}
assertTreeMatchesDiffs(rootItems, copy);
@@ -573,8 +595,7 @@ public class ModelParticipantSyncInfoSource extends ParticipantSyncInfoSource {
if (items == null || items.length == 0) {
return;
}
- for (int i = 0; i < items.length; i++) {
- TreeItem item = items[i];
+ for (TreeItem item : items) {
assertItemInTree(item, copy);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchTreeTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchTreeTest.java
index 752043524..9c6ffba85 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchTreeTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchTreeTest.java
@@ -13,13 +13,11 @@
*******************************************************************************/
package org.eclipse.team.tests.ccvs.ui;
-import junit.framework.Test;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Item;
@@ -42,12 +40,14 @@ import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import junit.framework.Test;
+
public class PatchTreeTest extends EclipseTest {
public void testChangeSetModelSorter() throws CoreException {
MyTreeViewer tree = new MyTreeViewer();
tree.init();
- ViewerSorter sorter = tree.getSorter();
+ ViewerComparator sorter = tree.getSorter();
UnchangedResourceModelElement elementZ = new UnchangedResourceModelElement(
null, getUniqueTestProject("z"));
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchWizardRadioButtonGroupTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchWizardRadioButtonGroupTests.java
index 582f64605..c339d3508 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchWizardRadioButtonGroupTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/PatchWizardRadioButtonGroupTests.java
@@ -68,11 +68,6 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
return suite;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.tests.ccvs.core.EclipseTest#setUp()
- */
protected void setUp() throws Exception {
Shell shell = new Shell(Display.getCurrent());
Composite composite = new Composite(shell, SWT.NONE);
@@ -94,7 +89,7 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
return null;
}
- public void testSingleSelection() throws Exception {
+ public void testSingleSelection() {
button1.setEnabled(true);
button1.setSelection(true);
group.add(FORMAT_UNIFIED, button1);
@@ -114,7 +109,7 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
assertEquals(false, button3.getSelection());
}
- public void testMultipleSelection() throws Exception {
+ public void testMultipleSelection() {
button1.setEnabled(true);
button1.setSelection(true);
group.add(FORMAT_UNIFIED, button1);
@@ -134,7 +129,7 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
assertEquals(true, button3.getSelection());
}
- public void testSelectDisabled1() throws Exception {
+ public void testSelectDisabled1() {
button1.setEnabled(true);
button1.setSelection(false);
group.add(FORMAT_UNIFIED, button1);
@@ -155,7 +150,7 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
assertTrue(getButtonForCode(group.getSelected()).getSelection());
}
- public void testSelectDisabled2() throws Exception {
+ public void testSelectDisabled2() {
button1.setSelection(false);
group.add(FORMAT_UNIFIED, button1);
@@ -182,7 +177,7 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
assertTrue(getButtonForCode(group.getSelected()).getSelection());
}
- public void testSelectDisabled3() throws Exception {
+ public void testSelectDisabled3() {
button1.setSelection(true);
group.add(FORMAT_UNIFIED, button1);
@@ -210,7 +205,7 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
assertTrue(getButtonForCode(group.getSelected()).getSelection());
}
- public void testSetEnablement() throws Exception {
+ public void testSetEnablement() {
button1.setSelection(true);
group.add(FORMAT_UNIFIED, button1);
@@ -241,7 +236,7 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
private class MyRadioButtonGroup {
Object groupObject;
- Class clazz;
+ Class<?> clazz;
public MyRadioButtonGroup() {
@@ -250,26 +245,18 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
null, null, false);
clazz = Class
.forName("org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard$RadioButtonGroup");
- Constructor[] constructors = clazz.getDeclaredConstructors();
+ Constructor<?>[] constructors = clazz.getDeclaredConstructors();
constructors[0].setAccessible(true);
groupObject = constructors[0]
.newInstance(new Object[] { wizard });
- } catch (ClassNotFoundException e) {
- fail(e.getMessage());
- } catch (InstantiationException e) {
- fail(e.getMessage());
- } catch (IllegalAccessException e) {
- fail(e.getMessage());
- } catch (IllegalArgumentException e) {
- fail(e.getMessage());
- } catch (InvocationTargetException e) {
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
fail(e.getMessage());
}
}
public void add(int buttonCode, Button button) {
try {
- Class partypes[] = new Class[2];
+ Class<?> partypes[] = new Class[2];
partypes[0] = Integer.TYPE;
partypes[1] = Button.class;
Method method = clazz.getMethod("add", partypes);
@@ -278,36 +265,20 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
arglist[0] = Integer.valueOf(buttonCode);
arglist[1] = button;
method.invoke(groupObject, arglist);
- } catch (SecurityException e) {
- fail(e.getMessage());
- } catch (NoSuchMethodException e) {
- fail(e.getMessage());
- } catch (IllegalArgumentException e) {
- fail(e.getMessage());
- } catch (IllegalAccessException e) {
- fail(e.getMessage());
- } catch (InvocationTargetException e) {
+ } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
fail(e.getMessage());
}
}
public int getSelected() {
try {
- Class partypes[] = new Class[0];
+ Class<?> partypes[] = new Class[0];
Method method = clazz.getMethod("getSelected", partypes);
method.setAccessible(true);
Object arglist[] = new Object[0];
Object retobj = method.invoke(groupObject, arglist);
return ((Integer) retobj).intValue();
- } catch (SecurityException e) {
- fail(e.getMessage());
- } catch (NoSuchMethodException e) {
- fail(e.getMessage());
- } catch (IllegalArgumentException e) {
- fail(e.getMessage());
- } catch (IllegalAccessException e) {
- fail(e.getMessage());
- } catch (InvocationTargetException e) {
+ } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
fail(e.getMessage());
}
return 0;
@@ -315,21 +286,13 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
public int selectEnabledOnly() {
try {
- Class partypes[] = new Class[0];
+ Class<?> partypes[] = new Class[0];
Method method = clazz.getMethod("selectEnabledOnly", partypes);
method.setAccessible(true);
Object arglist[] = new Object[0];
Object retobj = method.invoke(groupObject, arglist);
return ((Integer) retobj).intValue();
- } catch (SecurityException e) {
- fail(e.getMessage());
- } catch (NoSuchMethodException e) {
- fail(e.getMessage());
- } catch (IllegalArgumentException e) {
- fail(e.getMessage());
- } catch (IllegalAccessException e) {
- fail(e.getMessage());
- } catch (InvocationTargetException e) {
+ } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
fail(e.getMessage());
}
return 0;
@@ -338,7 +301,7 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
public void setEnablement(boolean enabled, int[] buttonsToChange,
int defaultSelection) {
try {
- Class partypes[] = new Class[3];
+ Class<?> partypes[] = new Class[3];
partypes[0] = Boolean.TYPE;
partypes[1] = buttonsToChange.getClass();
partypes[2] = Integer.TYPE;
@@ -349,22 +312,14 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
arglist[1] = buttonsToChange;
arglist[2] = Integer.valueOf(defaultSelection);
method.invoke(groupObject, arglist);
- } catch (SecurityException e) {
- fail(e.getMessage());
- } catch (NoSuchMethodException e) {
- fail(e.getMessage());
- } catch (IllegalArgumentException e) {
- fail(e.getMessage());
- } catch (IllegalAccessException e) {
- fail(e.getMessage());
- } catch (InvocationTargetException e) {
+ } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
fail(e.getMessage());
}
}
public void setEnablement(boolean enabled, int[] buttonsToChange) {
try {
- Class partypes[] = new Class[2];
+ Class<?> partypes[] = new Class[2];
partypes[0] = Boolean.TYPE;
partypes[1] = buttonsToChange.getClass();
Method method = clazz.getMethod("setEnablement", partypes);
@@ -373,15 +328,7 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
arglist[0] = Boolean.valueOf(enabled);
arglist[1] = buttonsToChange;
method.invoke(groupObject, arglist);
- } catch (SecurityException e) {
- fail(e.getMessage());
- } catch (NoSuchMethodException e) {
- fail(e.getMessage());
- } catch (IllegalArgumentException e) {
- fail(e.getMessage());
- } catch (IllegalAccessException e) {
- fail(e.getMessage());
- } catch (InvocationTargetException e) {
+ } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
fail(e.getMessage());
}
}
@@ -389,22 +336,13 @@ public class PatchWizardRadioButtonGroupTests extends TestCase {
}
static private int getFieldValue(String fieldName) {
- Class clazz;
try {
- clazz = Class
+ Class<?> clazz = Class
.forName("org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard$OptionsPage");
Field field = clazz.getField(fieldName);
field.setAccessible(true);
return ((Integer) field.get(null)).intValue();
- } catch (ClassNotFoundException e) {
- fail(e.getMessage());
- } catch (SecurityException e) {
- fail(e.getMessage());
- } catch (NoSuchFieldException e) {
- fail(e.getMessage());
- } catch (IllegalArgumentException e) {
- fail(e.getMessage());
- } catch (IllegalAccessException e) {
+ } catch (ClassNotFoundException | SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
fail(e.getMessage());
}
return -1;
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java
index 81a820ff0..1012510c3 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java
@@ -24,9 +24,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -54,6 +51,9 @@ import org.eclipse.team.ui.IScmUrlImportWizardPage;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.ui.PlatformUI;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
public class ProjectSetImporterTests extends EclipseTest {
private final static String PSF_FILENAME = "temp.psf";
@@ -82,6 +82,7 @@ public class ProjectSetImporterTests extends EclipseTest {
return new CVSTestSetup(suite);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
PSF_FILE.delete();
@@ -209,11 +210,11 @@ public class ProjectSetImporterTests extends EclipseTest {
ProjectSetCapability c = new CVSTeamProviderType().getProjectSetCapability();
// this is what every bundle importer should do, should this be in PDE?
- List references = new ArrayList();
- for (int i = 0; i < selection.length; i++) {
- references.add(c.asReference(selection[i].getUri(), selection[i].getProject()));
+ List<String> references = new ArrayList<>();
+ for (ScmUrlImportDescription element : selection) {
+ references.add(c.asReference(element.getUri(), element.getProject()));
}
- c.addToWorkspace((String[]) references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), null);
+ c.addToWorkspace(references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), null);
assertExistsInWorkspace(project);
}
@@ -230,11 +231,11 @@ public class ProjectSetImporterTests extends EclipseTest {
ProjectSetCapability c = new CVSTeamProviderType().getProjectSetCapability();
// this is what every bundle importer should do, should this be in PDE?
- List references = new ArrayList();
- for (int i = 0; i < selection.length; i++) {
- references.add(c.asReference(selection[i].getUri(), /*selection[i].getProject()*/ null));
+ List<String> references = new ArrayList<>();
+ for (ScmUrlImportDescription element : selection) {
+ references.add(c.asReference(element.getUri(), /*selection[i].getProject()*/ null));
}
- c.addToWorkspace((String[]) references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), null);
+ c.addToWorkspace(references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), null);
IProject project1 = ResourcesPlugin.getWorkspace().getRoot().getProject("project1");
assertExistsInWorkspace(project1);
}
@@ -247,13 +248,14 @@ public class ProjectSetImporterTests extends EclipseTest {
final IScmUrlImportWizardPage[] pages = TeamUI.getPages("org.eclipse.team.core.cvs.importer");
assertEquals(1, pages.length);
- String s = ProjectSetCapability.SCHEME_SCM + ":cvs:" + CVSTestSetup.REPOSITORY_LOCATION + ":" + project.getName() + ";tag=tag";;
+ String s = ProjectSetCapability.SCHEME_SCM + ":cvs:" + CVSTestSetup.REPOSITORY_LOCATION + ":" + project.getName() + ";tag=tag";
ScmUrlImportDescription d = new ScmUrlImportDescription(s, project.getName());
ScmUrlImportDescription[] selection = new ScmUrlImportDescription[] {d};
pages[0].setSelection(selection);
assertTrue(pages[0] instanceof CVSScmUrlImportWizardPage);
Wizard wizard = new Wizard() {
+ @Override
public boolean performFinish() {
// update SCM URLs in descriptions
pages[0].finish();
@@ -282,7 +284,7 @@ public class ProjectSetImporterTests extends EclipseTest {
}
public void testCvsBundleImporter() throws TeamException, CoreException {
- IBundleImporter cvsBundleImporter = getBundleImporter("org.eclipse.team.core.cvs.importer");;
+ IBundleImporter cvsBundleImporter = getBundleImporter("org.eclipse.team.core.cvs.importer");
// CVS Bundle Importer should be available
assertNotNull(cvsBundleImporter);
@@ -293,7 +295,7 @@ public class ProjectSetImporterTests extends EclipseTest {
String s = ProjectSetCapability.SCHEME_SCM + ":cvs:" + CVSTestSetup.REPOSITORY_LOCATION + ":" + project.getName();
Map[] manifests = new Map[1];
- Map map = new HashMap();
+ Map<String, String> map = new HashMap<>();
map.put(BundleImporterDelegate.ECLIPSE_SOURCE_REFERENCES, s);
manifests[0] = map;
@@ -306,9 +308,9 @@ public class ProjectSetImporterTests extends EclipseTest {
private static IBundleImporter getBundleImporter(final String id) {
IBundleImporter[] importers = Team.getBundleImporters();
- for (int i = 0; i < importers.length; i++) {
- if (importers[i].getId().equals(id))
- return importers[i];
+ for (IBundleImporter importer : importers) {
+ if (importer.getId().equals(id))
+ return importer;
}
return null;
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ReflectionUtils.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ReflectionUtils.java
index 6a6d5a9a7..56df81d8d 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ReflectionUtils.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ReflectionUtils.java
@@ -24,8 +24,8 @@ import org.eclipse.team.tests.ccvs.core.EclipseTest;
public class ReflectionUtils {
public static Object construct(String className, ClassLoader classLoader,
- Class[] constructorTypes, Object[] constructorArgs) {
- Class clazz = null;
+ Class<?>[] constructorTypes, Object[] constructorArgs) {
+ Class<?> clazz = null;
try {
clazz = Class.forName(className, true, classLoader);
} catch (ClassNotFoundException e) {
@@ -33,7 +33,7 @@ public class ReflectionUtils {
} catch (ExceptionInInitializerError e) {
EclipseTest.fail(e.getMessage());
}
- Constructor constructor = null;
+ Constructor<?> constructor = null;
try {
constructor = clazz.getDeclaredConstructor(constructorTypes);
} catch (SecurityException e) {
@@ -45,23 +45,17 @@ public class ReflectionUtils {
constructor.setAccessible(true);
try {
return constructor.newInstance(constructorArgs);
- } catch (IllegalArgumentException e) {
- EclipseTest.fail(e.getMessage());
- } catch (InvocationTargetException e) {
- EclipseTest.fail(e.getMessage());
- } catch (InstantiationException e) {
- EclipseTest.fail(e.getMessage());
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
EclipseTest.fail(e.getMessage());
}
return null;
}
- public static Object callMethod(Object object, String name, Class types[],
+ public static Object callMethod(Object object, String name, Class<?> types[],
Object args[]) {
try {
Method method = null;
- Class clazz = object.getClass();
+ Class<?> clazz = object.getClass();
NoSuchMethodException ex = null;
while (method == null && clazz != null) {
try {
@@ -79,22 +73,14 @@ public class ReflectionUtils {
method.setAccessible(true);
Object ret = method.invoke(object, args);
return ret;
- } catch (IllegalArgumentException e) {
- EclipseTest.fail(e.getMessage());
- } catch (IllegalAccessException e) {
- EclipseTest.fail(e.getMessage());
- } catch (SecurityException e) {
- EclipseTest.fail(e.getMessage());
- } catch (NoSuchMethodException e) {
- EclipseTest.fail(e.getMessage());
- } catch (InvocationTargetException e) {
+ } catch (IllegalArgumentException | IllegalAccessException | SecurityException | NoSuchMethodException | InvocationTargetException e) {
EclipseTest.fail(e.getMessage());
}
return null;
}
public static Object callMethod(Object object, String name, Object args[]) {
- Class types[] = new Class[args.length];
+ Class<?> types[] = new Class[args.length];
for (int i = 0; i < args.length; i++) {
types[i] = args[i].getClass();
}
@@ -104,7 +90,7 @@ public class ReflectionUtils {
public static Object getField(Object object, String name) {
try {
Field field = null;
- Class clazz = object.getClass();
+ Class<?> clazz = object.getClass();
NoSuchFieldException ex = null;
while (field == null && clazz != null) {
try {
@@ -122,13 +108,7 @@ public class ReflectionUtils {
field.setAccessible(true);
Object ret = field.get(object);
return ret;
- } catch (IllegalArgumentException e) {
- EclipseTest.fail(e.getMessage());
- } catch (IllegalAccessException e) {
- EclipseTest.fail(e.getMessage());
- } catch (SecurityException e) {
- EclipseTest.fail(e.getMessage());
- } catch (NoSuchFieldException e) {
+ } catch (IllegalArgumentException | IllegalAccessException | SecurityException | NoSuchFieldException e) {
EclipseTest.fail(e.getMessage());
}
return null;
@@ -137,7 +117,7 @@ public class ReflectionUtils {
public static void setField(Object object, String name, Object value) {
try {
Field field = null;
- Class clazz = object.getClass();
+ Class<?> clazz = object.getClass();
NoSuchFieldException ex = null;
while (field == null && clazz != null) {
try {
@@ -154,13 +134,7 @@ public class ReflectionUtils {
}
field.setAccessible(true);
field.set(object, value);
- } catch (IllegalArgumentException e) {
- EclipseTest.fail(e.getMessage());
- } catch (IllegalAccessException e) {
- EclipseTest.fail(e.getMessage());
- } catch (SecurityException e) {
- EclipseTest.fail(e.getMessage());
- } catch (NoSuchFieldException e) {
+ } catch (IllegalArgumentException | IllegalAccessException | SecurityException | NoSuchFieldException e) {
EclipseTest.fail(e.getMessage());
}
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SelectionPropertyTesterTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SelectionPropertyTesterTest.java
index 27d14ac30..e91b292c6 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SelectionPropertyTesterTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SelectionPropertyTesterTest.java
@@ -16,9 +16,6 @@ package org.eclipse.team.tests.ccvs.ui;
import java.util.Arrays;
import java.util.List;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -30,6 +27,9 @@ import org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.ui.IActionDelegate;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
public class SelectionPropertyTesterTest extends EnablementTest {
/**
@@ -76,7 +76,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
SelectionPropertyTester tester = new SelectionPropertyTester();
IActionDelegate action = new CommitAction();
IProject project = createTestProject(action);
- List resources = getManagedResources(project, false, false);
+ List<IResource> resources = getManagedResources(project, false, false);
assertEquals(
false,
tester
@@ -92,7 +92,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
SelectionPropertyTester tester = new SelectionPropertyTester();
IActionDelegate action = new CommitAction();
IProject project = createTestProject(action);
- List resources = getManagedResources(project, false, false);
+ List<IResource> resources = getManagedResources(project, false, false);
assertEquals(
false,
tester
@@ -110,7 +110,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
SelectionPropertyTester tester = new SelectionPropertyTester();
IActionDelegate action = new CommitAction();
IProject project = createTestProject(action);
- List resources = getManagedResources(project, false, false);
+ List<IResource> resources = getManagedResources(project, false, false);
assertEquals(
false,
tester
@@ -128,7 +128,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
SelectionPropertyTester tester = new SelectionPropertyTester();
IActionDelegate action = new CommitAction();
IProject project = createTestProject(action);
- List resources = getManagedResources(project, false, false);
+ List<IResource> resources = getManagedResources(project, false, false);
boolean testResult = tester
.test(
asSelection(resources),
@@ -144,7 +144,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
SelectionPropertyTester tester = new SelectionPropertyTester();
IActionDelegate action = new IgnoreAction();
IProject project = createTestProject(action);
- List resources = getManagedResources(project, false, false);
+ List<IResource> resources = getManagedResources(project, false, false);
boolean testResult = tester
.test(
asSelection(resources),
@@ -160,7 +160,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
SelectionPropertyTester tester = new SelectionPropertyTester();
IActionDelegate action = new BranchAction();
IProject project = createTestProject(action);
- List resources = getManagedResources(project, false, false);
+ List<IResource> resources = getManagedResources(project, false, false);
boolean testResult = tester
.test(
asSelection(resources),
@@ -176,7 +176,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
SelectionPropertyTester tester = new SelectionPropertyTester();
IActionDelegate action = new CommitAction();
IProject project = createTestProject(action);
- List resources = getUnmanagedResources(project);
+ List<IResource> resources = getUnmanagedResources(project);
boolean testResult = tester
.test(
asSelection(resources),
@@ -192,7 +192,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
SelectionPropertyTester tester = new SelectionPropertyTester();
IActionDelegate action = new IgnoreAction();
IProject project = createTestProject(action);
- List resources = getUnmanagedResources(project);
+ List<IResource> resources = getUnmanagedResources(project);
boolean testResult = tester
.test(
asSelection(resources),
@@ -208,7 +208,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
SelectionPropertyTester tester = new SelectionPropertyTester();
IActionDelegate action = new BranchAction();
IProject project = createTestProject(action);
- List resources = getUnmanagedResources(project);
+ List<IResource> resources = getUnmanagedResources(project);
boolean testResult = tester
.test(
asSelection(resources),
@@ -231,7 +231,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
IProject project = getUniqueTestProject(actionName);
IResource[] buildResources = buildResources(project, resourcesNames,
true);
- List resources = Arrays.asList(buildResources);
+ List<IResource> resources = Arrays.asList(buildResources);
boolean testResult = tester
.test(
asSelection(resources),
@@ -252,7 +252,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
IProject project = getUniqueTestProject(actionName);
IResource[] buildResources = buildResources(project, resourcesNames,
true);
- List resources = Arrays.asList(buildResources);
+ List<IResource> resources = Arrays.asList(buildResources);
boolean testResult = tester
.test(
asSelection(resources),
@@ -273,7 +273,7 @@ public class SelectionPropertyTesterTest extends EnablementTest {
IProject project = getUniqueTestProject(actionName);
IResource[] buildResources = buildResources(project, resourcesNames,
true);
- List resources = Arrays.asList(buildResources);
+ List<IResource> resources = Arrays.asList(buildResources);
boolean testResult = tester
.test(
asSelection(resources),
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java
index 5a8c8d22a..e8fd6b18a 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkTest.java
@@ -17,7 +17,6 @@ import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.zip.ZipException;
import org.eclipse.core.commands.ExecutionException;
@@ -43,7 +42,7 @@ import org.eclipse.ui.handlers.IHandlerService;
*/
public abstract class BenchmarkTest extends EclipseTest {
- private HashMap groups;
+ private HashMap<String, PerformanceMeter> groups;
private PerformanceMeter currentMeter;
protected BenchmarkTest() {
@@ -90,21 +89,19 @@ public abstract class BenchmarkTest extends EclipseTest {
}
protected void setupGroups(String[] performance_groups, String globalName, boolean global) {
- groups = new HashMap();
+ groups = new HashMap<>();
Performance perf = Performance.getDefault();
PerformanceMeter meter = null;
if (global) {
// Use one meter for all groups - provides a single timing result
meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this));
- for (int i = 0; i < performance_groups.length; i++) {
- String suffix = performance_groups[i];
+ for (String suffix : performance_groups) {
groups.put(suffix, meter);
}
perf.tagAsGlobalSummary(meter, globalName, Dimension.ELAPSED_PROCESS);
} else {
// Use a meter for each group, provides fine grain results
- for (int i = 0; i < performance_groups.length; i++) {
- String suffix = performance_groups[i];
+ for (String suffix : performance_groups) {
meter = perf.createPerformanceMeter(perf.getDefaultScenarioId(this) + suffix);
Performance.getDefault().setComment(meter, Performance.EXPLAINS_DEGRADATION_COMMENT, "The current setup for the CVS test does not provide reliable timings. Only consistent test failures over time can be considered significant.");
groups.put(suffix, meter);
@@ -120,31 +117,30 @@ public abstract class BenchmarkTest extends EclipseTest {
* started and stopped using startGroup/endGroup
*/
protected void commitGroups(boolean global) {
- for (Iterator iter = groups.values().iterator(); iter.hasNext();) {
- PerformanceMeter meter = (PerformanceMeter) iter.next();
+ for (PerformanceMeter meter : groups.values()) {
meter.commit();
if(global)
break;
}
}
- protected void setUp() throws Exception {
+ @Override
+ protected void setUp() throws Exception {
super.setUp();
setModelSync(false);
}
- protected void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
try {
if (groups != null) {
Performance perf = Performance.getDefault();
try {
- for (Iterator iter = groups.values().iterator(); iter.hasNext();) {
- PerformanceMeter meter = (PerformanceMeter) iter.next();
- perf.assertPerformanceInRelativeBand(meter, Dimension.ELAPSED_PROCESS, -100, 20);
+ for (PerformanceMeter meter : groups.values()) {
+ perf.assertPerformanceInRelativeBand(meter, Dimension.ELAPSED_PROCESS, -100, 20);
}
} finally {
- for (Iterator iter = groups.values().iterator(); iter.hasNext();) {
- PerformanceMeter meter = (PerformanceMeter) iter.next();
+ for (PerformanceMeter meter : groups.values()) {
meter.dispose();
}
}
@@ -161,7 +157,7 @@ public abstract class BenchmarkTest extends EclipseTest {
*/
protected void startGroup(String key) {
assertNull(currentMeter);
- currentMeter = (PerformanceMeter)groups.get(key);
+ currentMeter = groups.get(key);
currentMeter.start();
}
@@ -225,10 +221,7 @@ public abstract class BenchmarkTest extends EclipseTest {
try {
handlerService.executeCommand(
"org.eclipse.ui.window.closeAllPerspectives", null);
- } catch (ExecutionException e1) {
- } catch (NotDefinedException e1) {
- } catch (NotEnabledException e1) {
- } catch (NotHandledException e1) {
+ } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e1) {
}
// Now open our empty perspective
PlatformUI.getWorkbench().showPerspective("org.eclipse.team.tests.cvs.ui.perspective1", PlatformUI.getWorkbench().getActiveWorkbenchWindow());

Back to the top