Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/.classpath8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/.settings/org.eclipse.jdt.core.prefs111
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/.settings/org.eclipse.jdt.ui.prefs16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/META-INF/MANIFEST.MF9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/build.properties1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/AllTests.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Bug209233Test.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java75
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java67
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java66
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Pack200OptimizerTest.java50
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/AllTests.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/ArtifactRepositoryMock.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchStepTest.java64
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchZipStepTest.java83
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JarDeltaProcessorTest.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/AutomatedTests.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestActivator.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestData.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/AllTests.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/DirectByteArrayOutputStreamTest.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/SarEntryTest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/SarTest.java51
25 files changed, 275 insertions, 590 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/.classpath b/bundles/org.eclipse.equinox.p2.tests.optimizers/.classpath
index 64c5e31b7..3e5654f17 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/.classpath
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/.classpath
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="src">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.tests.optimizers/.settings/org.eclipse.jdt.core.prefs
index ee7892211..e2a30177b 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/.settings/org.eclipse.jdt.core.prefs
@@ -9,18 +9,23 @@ org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -32,7 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -49,7 +54,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
@@ -58,28 +63,30 @@ 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=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
@@ -88,12 +95,16 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
@@ -101,6 +112,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
@@ -110,12 +122,15 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@@ -124,17 +139,25 @@ org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
+org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@@ -154,26 +177,36 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true
+org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -183,15 +216,18 @@ org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@@ -199,7 +235,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do no
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
@@ -210,7 +246,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
@@ -239,10 +275,11 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
@@ -257,12 +294,14 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invoca
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
@@ -271,7 +310,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
@@ -286,11 +325,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invoc
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
@@ -313,6 +353,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -341,6 +382,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invoc
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
@@ -350,6 +392,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=inser
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -359,19 +402,37 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=800
+org.eclipse.jdt.core.formatter.lineSplit=120
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.tests.optimizers/.settings/org.eclipse.jdt.ui.prefs
index 56bcc3e9b..96866c323 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/.settings/org.eclipse.jdt.ui.prefs
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/.settings/org.eclipse.jdt.ui.prefs
@@ -1,8 +1,7 @@
-#Sun Sep 23 11:58:07 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_core
-formatter_settings_version=11
+formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
+formatter_settings_version=14
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=;
org.eclipse.jdt.ui.ondemandthreshold=3
@@ -12,18 +11,25 @@ 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=false
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=false
sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=false
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=true
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
@@ -35,6 +41,8 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_modifiers=false
+sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=false
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
@@ -48,8 +56,10 @@ sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.optimizers/META-INF/MANIFEST.MF
index 8c120ec73..6a3caa43c 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: p2 Optimizers Test Plug-in
Bundle-SymbolicName: org.eclipse.equinox.p2.tests.optimizers;singleton:=true
-Bundle-Version: 1.0.200.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.eclipse.equinox.p2.tests.optimizers.TestActivator
Export-Package: org.eclipse.equinox.p2.tests.artifact.optimizers;version="2.0.0",
org.eclipse.equinox.p2.tests.artifact.processors;version="2.0.0",
@@ -17,14 +17,11 @@ Require-Bundle: org.eclipse.equinox.common;bundle-version="3.4.0",
org.eclipse.equinox.p2.artifact.processors;bundle-version="1.0.100",
org.eclipse.equinox.p2.metadata;bundle-version="2.2.0",
org.eclipse.equinox.p2.core;bundle-version="2.3.0"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Import-Package: ie.wombat.jbdiff,
- org.eclipse.equinox.internal.p2.artifact.optimizers,
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Import-Package: org.eclipse.equinox.internal.p2.artifact.optimizers,
org.eclipse.equinox.internal.p2.artifact.optimizers.jardelta,
- org.eclipse.equinox.internal.p2.artifact.optimizers.jbdiff,
org.eclipse.equinox.internal.p2.artifact.optimizers.pack200,
org.eclipse.equinox.internal.p2.artifact.processors.jardelta,
- org.eclipse.equinox.internal.p2.artifact.processors.jbdiff,
org.eclipse.equinox.internal.p2.artifact.processors.pack200,
org.eclipse.equinox.internal.p2.artifact.repository,
org.eclipse.equinox.internal.p2.core.helpers,
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/build.properties b/bundles/org.eclipse.equinox.p2.tests.optimizers/build.properties
index 826f51f8b..10268fa23 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/build.properties
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/build.properties
@@ -12,5 +12,4 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml,\
testData/
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/pom.xml b/bundles/org.eclipse.equinox.p2.tests.optimizers/pom.xml
index dc2d698dd..e4fa05621 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/pom.xml
@@ -9,7 +9,7 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.tests.optimizers</artifactId>
- <version>1.0.200-SNAPSHOT</version>
+ <version>1.1.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/AllTests.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/AllTests.java
index 6c28f5203..49c2074df 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,20 +11,14 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.optimizers;
-import junit.framework.*;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
/**
* Performs all automated director tests.
*/
-public class AllTests extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTestSuite(JBDiffStepTest.class);
- suite.addTestSuite(JBDiffZipStepTest.class);
- suite.addTestSuite(Pack200OptimizerTest.class);
- suite.addTestSuite(JarDeltaOptimizerTest.class);
- suite.addTestSuite(Bug209233Test.class);
- return suite;
- }
+@RunWith(Suite.class)
+@Suite.SuiteClasses({Pack200OptimizerTest.class, JarDeltaOptimizerTest.class})
+public class AllTests {
+ //test suite
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Bug209233Test.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Bug209233Test.java
deleted file mode 100644
index 4c3ac6ac8..000000000
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Bug209233Test.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.p2.tests.artifact.optimizers;
-
-import ie.wombat.jbdiff.JBDiff;
-import java.io.*;
-import java.util.Arrays;
-import junit.framework.TestCase;
-import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
-import org.eclipse.equinox.p2.tests.optimizers.TestData;
-
-/**
- * ... <code>Bug209233Test</code> ...
- */
-public class Bug209233Test extends TestCase {
-
- // public void testGenerateTestDataDiff() throws IOException {
- // File predecessor = TestData.getTempFile("sar", "org.eclipse.jdt_3.2.0.v20060605-1400.sar");
- // File current = TestData.getTempFile("sar", "org.eclipse.jdt_3.3.0.v20070607-1300.sar");
- // File diff = File.createTempFile("org.eclipse.jdt_3.2.0-3.3.0~", ".jbdiff");
- // JBDiff.bsdiff(predecessor, current, diff);
- // }
-
- public void testDiffJdt32SarToJdt33Sar() throws IOException {
-
- InputStream current = TestData.get("sar", "org.eclipse.jdt_3.3.0.v20070607-1300.sar");
- ByteArrayOutputStream currentBS = new ByteArrayOutputStream();
- FileUtils.copyStream(current, true, currentBS, true);
- byte[] currentBytes = currentBS.toByteArray();
-
- InputStream predecessor = TestData.get("sar", "org.eclipse.jdt_3.2.0.v20060605-1400.sar");
- ByteArrayOutputStream predecessorBS = new ByteArrayOutputStream();
- FileUtils.copyStream(predecessor, true, predecessorBS, true);
- byte[] predecessorBytes = predecessorBS.toByteArray();
-
- byte[] actualBytes = JBDiff.bsdiff(predecessorBytes, predecessorBytes.length, currentBytes, currentBytes.length);
-
- InputStream expected = TestData.get("optimizers", "org.eclipse.jdt_3.2.0-3.3.0.jbdiff");
- ByteArrayOutputStream expectedBS = new ByteArrayOutputStream();
- FileUtils.copyStream(expected, true, expectedBS, true);
- byte[] expectedBytes = expectedBS.toByteArray();
-
- assertEquals("Different lengths.", expectedBytes.length, actualBytes.length);
- assertTrue("Different bytes.", Arrays.equals(expectedBytes, actualBytes));
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java
deleted file mode 100644
index 3fb34e15d..000000000
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 compeople AG and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.p2.tests.artifact.optimizers;
-
-import java.io.*;
-import java.util.Arrays;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.internal.p2.artifact.optimizers.jbdiff.JBDiffStep;
-import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
-import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
-import org.eclipse.equinox.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
-import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
-import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
-import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
-import org.eclipse.equinox.p2.tests.artifact.processors.ArtifactRepositoryMock;
-import org.eclipse.equinox.p2.tests.optimizers.TestData;
-
-/**
- * Test the <code>JBDiffStepTest</code> processing step.
- */
-public class JBDiffStepTest extends OptimizerTest {
-
- // public void testGenerateTestDataExe32To33() throws IOException {
- // File exe32 = TestData.getTempFile("optimizers", "eclipse-3.2.exe");
- // File exe33 = TestData.getTempFile("optimizers", "eclipse-3.3.exe");
- // File diff = File.createTempFile("eclipse-3.2-3.3~", ".jbdiff");
- // JBDiff.bsdiff(exe32, exe33, diff);
- // }
-
- /**
- * Test diffing the launcher.
- *
- * @throws IOException
- */
- public void testDiffEclipseExe32to33() throws IOException {
-
- IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/eclipse-3.2.exe");
- MockableJBDiffStep differ = new MockableJBDiffStep(repoMock);
- IProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0", true);
- IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.1"));
- ArtifactDescriptor descriptor = new ArtifactDescriptor(key);
- differ.initialize(getAgent(), stepDescriptor, descriptor);
-
- ByteArrayOutputStream destination = new ByteArrayOutputStream();
- differ.link(destination, new NullProgressMonitor());
-
- InputStream inputStream = TestData.get("optimizers", "eclipse-3.3.exe");
- FileUtils.copyStream(inputStream, true, differ, true);
-
- inputStream = TestData.get("optimizers", "eclipse-3.2-3.3.jbdiff");
- ByteArrayOutputStream expected = new ByteArrayOutputStream();
- FileUtils.copyStream(inputStream, true, expected, true);
- assertTrue(Arrays.equals(expected.toByteArray(), destination.toByteArray()));
- }
-
- /**
- * Need to inject a repository!
- */
- private static class MockableJBDiffStep extends JBDiffStep {
- public MockableJBDiffStep(IArtifactRepository repository) {
- super(repository);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java
deleted file mode 100644
index f7edd45cb..000000000
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 compeople AG and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.p2.tests.artifact.optimizers;
-
-import java.io.*;
-import java.util.Arrays;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.internal.p2.artifact.optimizers.jbdiff.JBDiffZipStep;
-import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
-import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
-import org.eclipse.equinox.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
-import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
-import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
-import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
-import org.eclipse.equinox.p2.tests.artifact.processors.ArtifactRepositoryMock;
-import org.eclipse.equinox.p2.tests.optimizers.TestData;
-
-/**
- * Test the <code>JBDiffZipTest</code> processing step.
- */
-public class JBDiffZipStepTest extends OptimizerTest {
-
- /**
- * Test diffing the <b>normalized</b> jars. This is indicated by the extension ".njar".
- *
- * @throws IOException
- */
- public void testDiffJdt32to33() throws IOException {
- IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/org.eclipse.jdt_3.2.0.v20060605-1400.njar");
- MockableJBDiffZipStep differ = new MockableJBDiffZipStep(repoMock);
- IProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0", true);
- IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.1"));
- ArtifactDescriptor descriptor = new ArtifactDescriptor(key);
- differ.initialize(getAgent(), stepDescriptor, descriptor);
-
- ByteArrayOutputStream destination = new ByteArrayOutputStream();
- differ.link(destination, new NullProgressMonitor());
-
- InputStream inputStream = TestData.get("optimizers", "org.eclipse.jdt_3.3.0.v20070607-1300.njar");
- FileUtils.copyStream(inputStream, true, differ, true);
-
- inputStream = TestData.get("optimizers", "org.eclipse.jdt_3.2.0-3.3.0.jbdiff");
- ByteArrayOutputStream expected = new ByteArrayOutputStream();
- FileUtils.copyStream(inputStream, true, expected, true);
-
- assertTrue("Different diff bytes.", Arrays.equals(expected.toByteArray(), destination.toByteArray()));
- }
-
- /**
- * Need to inject a repository!
- */
- private static class MockableJBDiffZipStep extends JBDiffZipStep {
- public MockableJBDiffZipStep(IArtifactRepository repository) {
- super(repository);
- }
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java
index 3f9faf65a..c682ef5d9 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,31 +26,37 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
import org.eclipse.equinox.p2.tests.artifact.processors.ArtifactRepositoryMock;
import org.eclipse.equinox.p2.tests.optimizers.TestData;
+import org.junit.Test;
/**
* Test the <code>JarDelta</code> processing step.
*/
public class JarDeltaOptimizerTest extends OptimizerTest {
- // public void testPrepare() throws IOException {
- // IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/testdata_1.0.0.1.jar");
- // ProcessingStep step = new MockableJarDeltaOptimizerStep(repoMock);
- // ProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0.0.1", true);
- // IArtifactKey key = new ArtifactKey("ns", "cl", "id1", Version.create("1.0.0.2"));
- // ArtifactDescriptor descriptor = new ArtifactDescriptor(key);
- // step.initialize(stepDescriptor, descriptor);
- // ByteArrayOutputStream destination = new ByteArrayOutputStream();
- // step.link(destination, new NullProgressMonitor());
+ // public void testPrepare() throws IOException {
+ // IArtifactRepository repoMock =
+ // ArtifactRepositoryMock.getMock("testData/optimizers/testdata_1.0.0.1.jar");
+ // ProcessingStep step = new MockableJarDeltaOptimizerStep(repoMock);
+ // ProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id",
+ // "ns,cl,id1,1.0.0.1", true);
+ // IArtifactKey key = new ArtifactKey("ns", "cl", "id1",
+ // Version.create("1.0.0.2"));
+ // ArtifactDescriptor descriptor = new ArtifactDescriptor(key);
+ // step.initialize(stepDescriptor, descriptor);
+ // ByteArrayOutputStream destination = new ByteArrayOutputStream();
+ // step.link(destination, new NullProgressMonitor());
//
- // InputStream inputStream = TestActivator.getContext().getBundle().getEntry("testData/optimizers/testdata_1.0.0.2.jar").openStream();
- // FileUtils.copyStream(inputStream, true, step, true);
- // destination.close();
+ // InputStream inputStream =
+ // TestActivator.getContext().getBundle().getEntry("testData/optimizers/testdata_1.0.0.2.jar").openStream();
+ // FileUtils.copyStream(inputStream, true, step, true);
+ // destination.close();
//
- // inputStream = new ByteArrayInputStream(destination.toByteArray());
- // FileOutputStream file = new FileOutputStream("d:/jardelta.jar");
- // FileUtils.copyStream(inputStream, true, file, true);
- // }
+ // inputStream = new ByteArrayInputStream(destination.toByteArray());
+ // FileOutputStream file = new FileOutputStream("d:/jardelta.jar");
+ // FileUtils.copyStream(inputStream, true, file, true);
+ // }
+ @Test
public void testOptimization() throws IOException {
IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/testdata_1.0.0.1.jar");
ProcessingStep step = new MockableJarDeltaOptimizerStep(repoMock);
@@ -58,22 +64,22 @@ public class JarDeltaOptimizerTest extends OptimizerTest {
IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.0.0.2"));
ArtifactDescriptor descriptor = new ArtifactDescriptor(key);
step.initialize(getAgent(), stepDescriptor, descriptor);
- ByteArrayOutputStream destination = new ByteArrayOutputStream();
- step.link(destination, new NullProgressMonitor());
+ try (ByteArrayOutputStream destination = new ByteArrayOutputStream()) {
+ step.link(destination, new NullProgressMonitor());
- InputStream inputStream = TestData.get("optimizers", "testdata_1.0.0.2.jar");
- FileUtils.copyStream(inputStream, true, step, true);
- destination.close();
+ InputStream inputStream = TestData.get("optimizers", "testdata_1.0.0.2.jar");
+ FileUtils.copyStream(inputStream, true, step, true);
+ destination.close();
- inputStream = TestData.get("optimizers", "testdata_1.0.0.1-2.jar");
- ByteArrayOutputStream expected = new ByteArrayOutputStream();
- FileUtils.copyStream(inputStream, true, expected, true);
+ inputStream = TestData.get("optimizers", "testdata_1.0.0.1-2.jar");
+ ByteArrayOutputStream expected = new ByteArrayOutputStream();
+ FileUtils.copyStream(inputStream, true, expected, true);
- ZipInputStream expectedJar = new ZipInputStream(new ByteArrayInputStream(expected.toByteArray()));
- ZipInputStream testJar = new ZipInputStream(new ByteArrayInputStream(destination.toByteArray()));
- TestData.assertEquals(expectedJar, testJar);
- expectedJar.close();
- testJar.close();
+ try (ZipInputStream expectedJar = new ZipInputStream(new ByteArrayInputStream(expected.toByteArray()));
+ ZipInputStream testJar = new ZipInputStream(new ByteArrayInputStream(destination.toByteArray()))) {
+ TestData.assertEquals(expectedJar, testJar);
+ }
+ }
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java
index 887ed8499..7df22600f 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2015 IBM Corporation and others.
+ * Copyright (c) 2011, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,22 +11,14 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.optimizers;
-import junit.framework.TestCase;
import org.eclipse.equinox.internal.p2.artifact.optimizers.Activator;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
-public abstract class OptimizerTest extends TestCase {
- public OptimizerTest(String name) {
- super(name);
- }
-
- public OptimizerTest() {
- super();
- }
+public abstract class OptimizerTest {
protected static IProvisioningAgent getAgent() {
- //get the global agent for the currently running system
+ // get the global agent for the currently running system
return ServiceHelper.getService(Activator.getContext(), IProvisioningAgent.class);
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Pack200OptimizerTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Pack200OptimizerTest.java
index 2401e14c3..9a12a4163 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Pack200OptimizerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Pack200OptimizerTest.java
@@ -10,40 +10,36 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.optimizers;
+import static org.junit.Assert.assertTrue;
+
import java.io.*;
import java.util.Arrays;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.optimizers.pack200.Pack200OptimizerStep;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
import org.eclipse.equinox.p2.tests.optimizers.TestActivator;
+import org.junit.Test;
import org.osgi.framework.Bundle;
-public class Pack200OptimizerTest extends TestCase {
-
- public Pack200OptimizerTest(String name) {
- super(name);
- }
-
- public Pack200OptimizerTest() {
- super("");
- }
+public class Pack200OptimizerTest {
- // public void testPrepare() throws IOException {
- // // Setup the step
- // ProcessingStep step = new Pack200OptimizerStep();
- // FileOutputStream destination = new FileOutputStream("c:/packed.pack.gz");
- // step.link(destination, new NullProgressMonitor());
+ // public void testPrepare() throws IOException {
+ // // Setup the step
+ // ProcessingStep step = new Pack200OptimizerStep();
+ // FileOutputStream destination = new FileOutputStream("c:/packed.pack.gz");
+ // step.link(destination, new NullProgressMonitor());
//
- // // drive the source data through the step
- // Bundle bundle = TestActivator.getContext().getBundle();
- // InputStream inputStream = bundle.getEntry("testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar").openStream();
- // FileUtils.copyStream(inputStream, true, step, true);
+ // // drive the source data through the step
+ // Bundle bundle = TestActivator.getContext().getBundle();
+ // InputStream inputStream =
+ // bundle.getEntry("testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar").openStream();
+ // FileUtils.copyStream(inputStream, true, step, true);
//
- // destination.close();
- // }
+ // destination.close();
+ // }
+ @Test
public void testPack() throws IOException {
// Setup the step
ProcessingStep step = new Pack200OptimizerStep();
@@ -52,7 +48,8 @@ public class Pack200OptimizerTest extends TestCase {
// drive the source data through the step
Bundle bundle = TestActivator.getContext().getBundle();
- InputStream inputStream = bundle.getEntry("testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar").openStream();
+ InputStream inputStream = bundle.getEntry("testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar")
+ .openStream();
FileUtils.copyStream(inputStream, true, step, true);
assertTrue("Failure: " + step.getStatus().getMessage(), step.getStatus().isOK());
@@ -60,12 +57,15 @@ public class Pack200OptimizerTest extends TestCase {
// Get the test data. The Sun 1.6.0_01 JRE produces a different packed file
// then the IBM V5 JRE, so both versions of the test data are maintained.
// TODO: investigate this? Is the difference spurious? Are there differences
- // in the pack200 results for other JREs? Do we need a more general
- // solution to the problem?
+ // in the pack200 results for other JREs? Do we need a more general
+ // solution to the problem?
String javaVersion = System.getProperty("java.version");
boolean is1_6 = javaVersion.compareTo("1.6") > 0;
- inputStream = bundle.getEntry(is1_6 ? "testData/optimizers/1_6/org.eclipse.equinox.app_1.0.100.v20071015.jar.pack.gz" : "testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar.pack.gz").openStream();
+ inputStream = bundle
+ .getEntry(is1_6 ? "testData/optimizers/1_6/org.eclipse.equinox.app_1.0.100.v20071015.jar.pack.gz"
+ : "testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar.pack.gz")
+ .openStream();
ByteArrayOutputStream expected = new ByteArrayOutputStream();
FileUtils.copyStream(inputStream, true, expected, true);
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/AllTests.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/AllTests.java
index 226e965c5..43b40b70a 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,19 +10,15 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.processors;
-import junit.framework.*;
+import junit.framework.TestCase;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
/**
* Performs all automated director tests.
*/
+@RunWith(Suite.class)
+@Suite.SuiteClasses({JarDeltaProcessorTest.class})
public class AllTests extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTestSuite(JBPatchStepTest.class);
- suite.addTestSuite(JBPatchZipStepTest.class);
- suite.addTestSuite(JarDeltaProcessorTest.class);
- return suite;
- }
-
+ //test suite
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/ArtifactRepositoryMock.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/ArtifactRepositoryMock.java
index a83bed300..01977312b 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/ArtifactRepositoryMock.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/ArtifactRepositoryMock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,13 +26,15 @@ public class ArtifactRepositoryMock implements InvocationHandler {
private String artifactResource;
public static IArtifactRepository getMock(String artifactResource) {
- return (IArtifactRepository) Proxy.newProxyInstance(IArtifactRepository.class.getClassLoader(), new Class[] {IArtifactRepository.class}, new ArtifactRepositoryMock(artifactResource));
+ return (IArtifactRepository) Proxy.newProxyInstance(IArtifactRepository.class.getClassLoader(),
+ new Class[] { IArtifactRepository.class }, new ArtifactRepositoryMock(artifactResource));
}
private ArtifactRepositoryMock(String artifactResource) {
this.artifactResource = artifactResource;
}
+ @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (!method.getName().equals("getArtifact"))
throw new RuntimeException("Unexpected usage!");
@@ -41,9 +43,8 @@ public class ArtifactRepositoryMock implements InvocationHandler {
}
private IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
- InputStream inputStream;
- try {
- inputStream = TestActivator.getContext().getBundle().getEntry(artifactResource).openStream();
+ try (InputStream inputStream = TestActivator.getContext().getBundle().getEntry(artifactResource)
+ .openStream();) {
FileUtils.copyStream(inputStream, true, destination, true);
return Status.OK_STATUS;
} catch (IOException e) {
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchStepTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchStepTest.java
deleted file mode 100644
index 6f046c45d..000000000
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchStepTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 compeople AG and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.p2.tests.artifact.processors;
-
-import java.io.*;
-import java.util.Arrays;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.internal.p2.artifact.processors.jbdiff.JBPatchStep;
-import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
-import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
-import org.eclipse.equinox.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
-import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
-import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
-import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
-import org.eclipse.equinox.p2.tests.artifact.optimizers.OptimizerTest;
-import org.eclipse.equinox.p2.tests.optimizers.TestData;
-
-/**
- * Test the <code>JBPatchStep</code>
- *
- */
-public class JBPatchStepTest extends OptimizerTest {
-
- public void testPatchEclipseExe32to33() throws IOException {
- IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/eclipse-3.2.exe");
- ProcessingStep patcher = new MockableJBPatchStep(repoMock);
- IProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0", true);
- IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.1"));
- ArtifactDescriptor context = new ArtifactDescriptor(key);
- patcher.initialize(getAgent(), descriptor, context);
-
- ByteArrayOutputStream destination = new ByteArrayOutputStream();
- patcher.link(destination, new NullProgressMonitor());
-
- InputStream inputStream = TestData.get("optimizers", "eclipse-3.2-3.3.jbdiff");
- FileUtils.copyStream(inputStream, true, patcher, true);
-
- inputStream = TestData.get("optimizers", "eclipse-3.3.exe");
- ByteArrayOutputStream expected = new ByteArrayOutputStream();
- FileUtils.copyStream(inputStream, true, expected, true);
- assertTrue(Arrays.equals(expected.toByteArray(), destination.toByteArray()));
- }
-
- /**
- * Need to inject a repository!
- */
- private static class MockableJBPatchStep extends JBPatchStep {
- public MockableJBPatchStep(IArtifactRepository repository) {
- super.repository = repository;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchZipStepTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchZipStepTest.java
deleted file mode 100644
index 7a11ed8a3..000000000
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JBPatchZipStepTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 compeople AG and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * compeople AG (Stefan Liebig) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.p2.tests.artifact.processors;
-
-import java.io.*;
-import java.util.Arrays;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.internal.p2.artifact.processors.jbdiff.JBPatchZipStep;
-import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
-import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
-import org.eclipse.equinox.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.p2.metadata.Version;
-import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
-import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
-import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
-import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
-import org.eclipse.equinox.p2.tests.artifact.optimizers.OptimizerTest;
-import org.eclipse.equinox.p2.tests.optimizers.TestData;
-
-/**
- * Test the <code>JBPatchZipStep</code> processing step.
- */
-public class JBPatchZipStepTest extends OptimizerTest {
-
- // /**
- // * This is a disabled "unit test" that was used to generate the data needed for real test.
- // * @throws IOException
- // */
- // public void testGenerateTestData() throws IOException {
- //
- // File sar32 = TestData.getTempFile("sar", "org.eclipse.jdt_3.2.0.v20060605-1400.sar");
- // File sar33 = TestData.getTempFile("sar", "org.eclipse.jdt_3.3.0.v20070607-1300.sar");
- //
- // File diff = File.createTempFile("org.eclipse.jdt_3.2.0-3.3.0", ".jbdiff");
- // JBDiff.bsdiff(sar32, sar33, diff);
- // }
-
- /**
- * Test patching the <b>normalized</b> jars. This is indicated by the extension ".njar".
- *
- * @throws IOException
- */
- public void testPatchOrgEclipseJdt32to33() throws IOException {
-
- IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/org.eclipse.jdt_3.2.0.v20060605-1400.njar");
- ProcessingStep patcher = new MockableJBPatchZipStep(repoMock);
- IProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0", true);
- IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.1"));
- ArtifactDescriptor context = new ArtifactDescriptor(key);
- patcher.initialize(getAgent(), descriptor, context);
-
- ByteArrayOutputStream destination = new ByteArrayOutputStream();
- patcher.link(destination, new NullProgressMonitor());
-
- InputStream inputStream = TestData.get("optimizers", "org.eclipse.jdt_3.2.0-3.3.0.jbdiff");
- FileUtils.copyStream(inputStream, true, patcher, true);
-
- inputStream = TestData.get("optimizers", "org.eclipse.jdt_3.3.0.v20070607-1300.njar");
- ByteArrayOutputStream expected = new ByteArrayOutputStream();
- FileUtils.copyStream(inputStream, true, expected, true);
-
- assertTrue("Different resulting njar.", Arrays.equals(expected.toByteArray(), destination.toByteArray()));
- }
-
- /**
- * Need to inject a repository!
- */
- private static class MockableJBPatchZipStep extends JBPatchZipStep {
- public MockableJBPatchZipStep(IArtifactRepository repository) {
- super.repository = repository;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JarDeltaProcessorTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JarDeltaProcessorTest.java
index 997a530dc..f3b679516 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JarDeltaProcessorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/processors/JarDeltaProcessorTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,17 +26,11 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
import org.eclipse.equinox.p2.tests.artifact.optimizers.OptimizerTest;
import org.eclipse.equinox.p2.tests.optimizers.TestData;
+import org.junit.Test;
public class JarDeltaProcessorTest extends OptimizerTest {
- public JarDeltaProcessorTest(String name) {
- super(name);
- }
-
- public JarDeltaProcessorTest() {
- super("");
- }
-
+ @Test
public void testProcessing() throws IOException {
IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/testdata_1.0.0.1.jar");
ProcessingStep step = new MockableJarDeltaProcessorStep(repoMock);
@@ -44,22 +38,22 @@ public class JarDeltaProcessorTest extends OptimizerTest {
IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.0.0.2"));
ArtifactDescriptor descriptor = new ArtifactDescriptor(key);
step.initialize(getAgent(), stepDescriptor, descriptor);
- ByteArrayOutputStream destination = new ByteArrayOutputStream();
- step.link(destination, new NullProgressMonitor());
+ try (ByteArrayOutputStream destination = new ByteArrayOutputStream()) {
+ step.link(destination, new NullProgressMonitor());
- InputStream inputStream = TestData.get("optimizers", "testdata_1.0.0.1-2.jar");
- FileUtils.copyStream(inputStream, true, step, true);
- destination.close();
+ InputStream inputStream = TestData.get("optimizers", "testdata_1.0.0.1-2.jar");
+ FileUtils.copyStream(inputStream, true, step, true);
+ destination.close();
- inputStream = TestData.get("optimizers", "testdata_1.0.0.2.jar");
- ByteArrayOutputStream expected = new ByteArrayOutputStream();
- FileUtils.copyStream(inputStream, true, expected, true);
+ inputStream = TestData.get("optimizers", "testdata_1.0.0.2.jar");
+ ByteArrayOutputStream expected = new ByteArrayOutputStream();
+ FileUtils.copyStream(inputStream, true, expected, true);
- ZipInputStream expectedJar = new ZipInputStream(new ByteArrayInputStream(expected.toByteArray()));
- ZipInputStream testJar = new ZipInputStream(new ByteArrayInputStream(destination.toByteArray()));
- TestData.assertEquals(expectedJar, testJar);
- expectedJar.close();
- testJar.close();
+ try (ZipInputStream expectedJar = new ZipInputStream(new ByteArrayInputStream(expected.toByteArray()));
+ ZipInputStream testJar = new ZipInputStream(new ByteArrayInputStream(destination.toByteArray()))) {
+ TestData.assertEquals(expectedJar, testJar);
+ }
+ }
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/AutomatedTests.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/AutomatedTests.java
index 54771de98..1c6c770cc 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/AutomatedTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/AutomatedTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,19 +10,15 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.optimizers;
-import junit.framework.*;
+import junit.framework.TestCase;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
/**
* @since 1.0
*/
+@RunWith(Suite.class)
+@Suite.SuiteClasses({org.eclipse.equinox.p2.tests.artifact.optimizers.AllTests.class, org.eclipse.equinox.p2.tests.artifact.processors.AllTests.class, org.eclipse.equinox.p2.tests.sar.AllTests.class})
public class AutomatedTests extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AutomatedTests.class.getName());
- suite.addTest(org.eclipse.equinox.p2.tests.artifact.optimizers.AllTests.suite());
- suite.addTest(org.eclipse.equinox.p2.tests.artifact.processors.AllTests.suite());
- suite.addTest(org.eclipse.equinox.p2.tests.sar.AllTests.suite());
- return suite;
- }
-
+ // test suite
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestActivator.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestActivator.java
index cd6876056..a8a7ab4bd 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestActivator.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestActivator.java
@@ -21,16 +21,12 @@ public class TestActivator implements BundleActivator {
public static final String PI = "org.eclipse.equinox.p2.tests.optimizers"; //$NON-NLS-1$
private static BundleContext bundleContext;
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
+ @Override
public void start(BundleContext context) throws Exception {
bundleContext = context;
}
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
+ @Override
public void stop(BundleContext context) throws Exception {
bundleContext = null;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestData.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestData.java
index 56d145819..0fd55ef38 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestData.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -124,12 +124,12 @@ public class TestData {
* @throws IOException
*/
public static void assertEquals(ZipInputStream input1, ZipInputStream input2) throws IOException {
- Map jar1 = getEntries(input1);
- Map jar2 = getEntries(input2);
- for (Iterator i = jar1.keySet().iterator(); i.hasNext();) {
- String name = (String) i.next();
- Object[] file1 = (Object[]) jar1.get(name);
- Object[] file2 = (Object[]) jar2.remove(name);
+ Map<String, Object[]> jar1 = getEntries(input1);
+ Map<String, Object[]> jar2 = getEntries(input2);
+ for (Iterator<String> i = jar1.keySet().iterator(); i.hasNext();) {
+ String name = i.next();
+ Object[] file1 = jar1.get(name);
+ Object[] file2 = jar2.remove(name);
Assert.assertNotNull(file2);
ZipEntry entry1 = (ZipEntry) file1[0];
@@ -151,8 +151,8 @@ public class TestData {
Assert.assertTrue(jar2.size() == 0);
}
- private static Map getEntries(ZipInputStream input) throws IOException {
- Map result = new HashMap();
+ private static Map<String, Object[]> getEntries(ZipInputStream input) throws IOException {
+ Map<String, Object[]> result = new HashMap<>();
while (true) {
ZipEntry entry = input.getNextEntry();
if (entry == null)
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/AllTests.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/AllTests.java
index 172fd682f..2a74fbdee 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,19 +10,15 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.sar;
-import junit.framework.*;
+import junit.framework.TestCase;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
/**
* Performs all sar tests.
*/
+@RunWith(Suite.class)
+@Suite.SuiteClasses({DirectByteArrayOutputStreamTest.class, SarTest.class, SarEntryTest.class})
public class AllTests extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTests.class.getName());
- suite.addTestSuite(DirectByteArrayOutputStreamTest.class);
- suite.addTestSuite(SarTest.class);
- suite.addTestSuite(SarEntryTest.class);
- return suite;
- }
-
+ // test suite
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/DirectByteArrayOutputStreamTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/DirectByteArrayOutputStreamTest.java
index 576a8ec4d..caa1a8272 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/DirectByteArrayOutputStreamTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/DirectByteArrayOutputStreamTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,16 +10,18 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.sar;
+import static org.junit.Assert.*;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Arrays;
-import junit.framework.TestCase;
import org.eclipse.equinox.internal.p2.sar.DirectByteArrayOutputStream;
+import org.junit.Test;
/**
* Test the <code>DirectByteArrayOutputStream</code>
*/
-public class DirectByteArrayOutputStreamTest extends TestCase {
+public class DirectByteArrayOutputStreamTest {
private static final String JUST11BYTES = "just11bytes";
private static final int ELEVEN = JUST11BYTES.getBytes().length;
@@ -29,19 +31,21 @@ public class DirectByteArrayOutputStreamTest extends TestCase {
*
* @throws IOException
*/
+ @Test
public void testDBAOSConstraints() throws IOException {
- DirectByteArrayOutputStream out = new DirectByteArrayOutputStream(1024);
- out.write(JUST11BYTES.getBytes());
- assertEquals(ELEVEN, out.getBufferLength());
- assertEquals(ELEVEN, out.toByteArray().length);
- assertNotSame(out.toByteArray(), out.getBuffer());
- assertEquals(1024, out.getBuffer().length);
- assertEquals(JUST11BYTES, new String(out.getBuffer(), 0, out.getBufferLength()));
- ByteArrayInputStream in = out.getInputStream();
- assertEquals(ELEVEN, in.available());
- byte[] elevenBytes = new byte[ELEVEN];
- in.read(elevenBytes);
- assertTrue(Arrays.equals(JUST11BYTES.getBytes(), elevenBytes));
- assertEquals(-1, in.read());
+ try (DirectByteArrayOutputStream out = new DirectByteArrayOutputStream(1024)) {
+ out.write(JUST11BYTES.getBytes());
+ assertEquals(ELEVEN, out.getBufferLength());
+ assertEquals(ELEVEN, out.toByteArray().length);
+ assertNotSame(out.toByteArray(), out.getBuffer());
+ assertEquals(1024, out.getBuffer().length);
+ assertEquals(JUST11BYTES, new String(out.getBuffer(), 0, out.getBufferLength()));
+ ByteArrayInputStream in = out.getInputStream();
+ assertEquals(ELEVEN, in.available());
+ byte[] elevenBytes = new byte[ELEVEN];
+ in.read(elevenBytes);
+ assertTrue(Arrays.equals(JUST11BYTES.getBytes(), elevenBytes));
+ assertEquals(-1, in.read());
+ }
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/SarEntryTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/SarEntryTest.java
index 6ea0c2f8a..3b4c852d8 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/SarEntryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/SarEntryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,11 +10,14 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.sar;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
import org.eclipse.equinox.internal.p2.sar.SarEntry;
+import org.junit.Test;
-public class SarEntryTest extends TestCase {
+public class SarEntryTest {
+ @Test
public void testJavaToDosTimeAndBack() {
final long minute = 1000l * 60l;
long now = (System.currentTimeMillis() / minute) * minute;
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/SarTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/SarTest.java
index 8b8dcc383..a2cf28f92 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/SarTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/sar/SarTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2018 compeople AG and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,55 +10,41 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.sar;
+import static org.junit.Assert.assertTrue;
+
import java.io.*;
import java.util.Arrays;
-import junit.framework.TestCase;
import org.eclipse.equinox.internal.p2.sar.SarUtil;
import org.eclipse.equinox.p2.tests.optimizers.TestData;
+import org.junit.Test;
/**
* Test the sar stuff.
*/
-public class SarTest extends TestCase {
-
- // public void testGenerateTestDataNJarAndSarFromJar32() throws IOException {
- // InputStream jar32 = TestData.get("sar", "org.eclipse.jdt_3.2.0.v20060605-1400.jar");
- // generateNJarAndSar("org.eclipse.jdt_3.2.0.v20060605-1400", jar32);
- // }
- //
- // public void testGenerateTestDataNJarAndSarFromJar33() throws IOException {
- // InputStream jar32 = TestData.get("sar", "org.eclipse.jdt_3.3.0.v20070607-1300.jar");
- // generateNJarAndSar("org.eclipse.jdt_3.3.0.v20070607-1300", jar32);
- // }
- //
- // private void generateNJarAndSar(String name, InputStream jar) throws IOException {
- // File njar = File.createTempFile(name, ".njar");
- // OutputStream njarOut = new BufferedOutputStream(new FileOutputStream(njar));
- //
- // SarUtil.normalize(jar, njarOut);
- //
- // File sar = File.createTempFile(name, ".sar");
- // SarUtil.zipToSar(njar, sar);
- // }
+public class SarTest {
+ @Test
public void testJarToSarForJdt320() throws IOException {
InputStream jdt320Jar = TestData.get("optimizers", "org.eclipse.jdt_3.2.0.v20060605-1400.njar");
InputStream jdt320Sar = TestData.get("sar", "org.eclipse.jdt_3.2.0.v20060605-1400.sar");
doJarToSar(jdt320Jar, jdt320Sar);
}
+ @Test
public void testSarToJarForJdt320() throws IOException {
InputStream jdt320Sar = TestData.get("sar", "org.eclipse.jdt_3.2.0.v20060605-1400.sar");
InputStream jdt320Jar = TestData.get("optimizers", "org.eclipse.jdt_3.2.0.v20060605-1400.njar");
doSarToJar(jdt320Sar, jdt320Jar);
}
+ @Test
public void testJarToSarForJdt330() throws IOException {
InputStream jdt330Jar = TestData.get("optimizers", "org.eclipse.jdt_3.3.0.v20070607-1300.njar");
InputStream jdt330Sar = TestData.get("sar", "org.eclipse.jdt_3.3.0.v20070607-1300.sar");
doJarToSar(jdt330Jar, jdt330Sar);
}
+ @Test
public void testSarToJarForJdt330() throws IOException {
InputStream jdt330Sar = TestData.get("sar", "org.eclipse.jdt_3.3.0.v20070607-1300.sar");
InputStream jdt330Jar = TestData.get("optimizers", "org.eclipse.jdt_3.3.0.v20070607-1300.njar");
@@ -91,9 +77,7 @@ public class SarTest extends TestCase {
TestData.assertEquals(jarIn, expectedJar);
}
- /**
- * @throws IOException
- */
+ @Test
public void testZipToSarAndBack() throws IOException {
File originalZipFile = TestData.getTempFile("sar", "test.zip");
File sarFile = TestData.createTempFile("test.sar");
@@ -110,9 +94,7 @@ public class SarTest extends TestCase {
TestData.assertEquals(originalZipFile, recreatedZipFile);
}
- /**
- * @throws IOException
- */
+ @Test
public void testNormalizeOnFiles() throws IOException {
File alienZip = TestData.getTempFile("sar", "alien.zip");
@@ -130,19 +112,16 @@ public class SarTest extends TestCase {
/**
* @throws IOException
*/
+ @Test
public void testNormalizeOnStreames() throws IOException {
- InputStream alienZip = TestData.get("sar", "alien.zip");
- ByteArrayOutputStream normalizedAlienZip = new ByteArrayOutputStream();
- ByteArrayOutputStream renormalizedAlienZip = new ByteArrayOutputStream();
- try {
+ try (InputStream alienZip = TestData.get("sar", "alien.zip")) {
+ ByteArrayOutputStream normalizedAlienZip = new ByteArrayOutputStream();
+ ByteArrayOutputStream renormalizedAlienZip = new ByteArrayOutputStream();
SarUtil.normalize(alienZip, normalizedAlienZip);
SarUtil.normalize(new ByteArrayInputStream(normalizedAlienZip.toByteArray()), renormalizedAlienZip);
assertTrue(Arrays.equals(normalizedAlienZip.toByteArray(), renormalizedAlienZip.toByteArray()));
- } finally {
- if (alienZip != null)
- alienZip.close();
}
}

Back to the top