Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.project28
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs340
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF41
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/Test Director CDT.launch40
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/Test Director SDK.launch43
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall CDT.launch40
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall SDK.launch21
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/about.html28
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/build.properties18
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/plugin.xml34
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AbstractProvisioningTest.java181
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AutomatedTests.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestActivator.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestArtifactRepository.java157
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestMetadataRepository.java95
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/AllTests.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/JarURLRepositoryTest.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Adder.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ByteShifter.java73
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Counter.java86
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/MD5Verifier.java90
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Multiplier.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Pack200Unpacker.java107
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ProcessingStepHandlerTest.java207
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AllTests.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AutomatedDirectorTest.java256
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/Bug203637.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OperationGenerationTest.java196
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest2.java89
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/PickerTest.java104
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/RollbackTest.java55
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/SingletonTest.java81
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UninstallTest.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithEntryPoint.java77
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithoutEntryPoint.java77
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/AllTests.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/DownloadManagerTest.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/AllTests.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/EngineTest.java235
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseSetTest.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseTest.java94
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/ProfileTest.java45
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/DirectorTest.java145
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/End2EndTest.java248
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/AllTests.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentMethodTest.java178
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentTest.java147
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/MultipleIUAndFragmentTest.java92
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/OldTest.java107
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/RecommendationTest.java178
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/ResolutionHelperTest.java302
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/AllTests.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/JarURLRepositoryTest.java45
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/enginerepo.jarbin0 -> 47329 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/jarprocessor.jar.pack.gzbin0 -> 13587 bytes
59 files changed, 5090 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/.classpath b/bundles/org.eclipse.equinox.p2.tests/.classpath
new file mode 100644
index 000000000..7cdeb7319
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.tests/.project b/bundles/org.eclipse.equinox.p2.tests/.project
new file mode 100644
index 000000000..6b99e9a8c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.prov.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..cca252c35
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,340 @@
+#Sat Sep 15 21:26:35 EDT 2007
+eclipse.preferences.version=1
+instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+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.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
+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.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+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.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+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
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+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_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+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_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.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
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+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_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.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.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_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.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.format_guardian_clause_on_one_line=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
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+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.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=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_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
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+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_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
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+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_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
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+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_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_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
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+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_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_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
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+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_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
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+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_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_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=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
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+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_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
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+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_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
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+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_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
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+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.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.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.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..6619592bb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Sun Sep 23 11:58:50 EDT 2007
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=3
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+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_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.format_source_code=true
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=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
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..63331939d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Thu Aug 23 14:59:00 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=true
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..3ffad4219
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,41 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.equinox.prov.test;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Import-Package: com.thoughtworks.xstream,
+ junit.framework;version="3.8.2",
+ org.eclipse.core.runtime;common=split,
+ org.eclipse.equinox.internal.p2.jarprocessor,
+ org.eclipse.equinox.internal.prov.artifact.repository,
+ org.eclipse.equinox.internal.prov.director,
+ org.eclipse.equinox.internal.prov.metadata,
+ org.eclipse.equinox.p2.jarprocessor,
+ org.eclipse.equinox.prov.artifact.repository,
+ org.eclipse.equinox.prov.artifact.repository.processing,
+ org.eclipse.equinox.prov.core.helpers,
+ org.eclipse.equinox.prov.core.location,
+ org.eclipse.equinox.prov.core.repository,
+ org.eclipse.equinox.prov.director,
+ org.eclipse.equinox.prov.engine,
+ org.eclipse.equinox.prov.installregistry,
+ org.eclipse.equinox.prov.metadata,
+ org.eclipse.equinox.prov.metadata.repository,
+ org.eclipse.equinox.prov.query,
+ org.eclipse.equinox.prov.resolution,
+ org.eclipse.osgi.service.environment;version="1.0.0",
+ org.eclipse.osgi.service.resolver;version="1.1.0",
+ org.eclipse.osgi.util;version="1.1.0",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.packageadmin;version="1.2.0"
+Bundle-Activator: org.eclipse.equinox.prov.tests.TestActivator
+Bundle-ClassPath: .
+Bundle-RequiredExecutionEnviron: J2SE-1.4
+Require-Bundle: org.eclipse.equinox.prov.metadata.generator,
+ org.eclipse.equinox.frameworkadmin,
+ org.eclipse.equinox.common,
+ org.eclipse.equinox.prov.download
+Eclipse-LazyStart: true
+Eclipse-RegisterBuddy: org.eclipse.equinox.prov.artifact.repository
+Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
+ J2SE-1.4
diff --git a/bundles/org.eclipse.equinox.p2.tests/Test Director CDT.launch b/bundles/org.eclipse.equinox.p2.tests/Test Director CDT.launch
new file mode 100644
index 000000000..1581c875f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/Test Director CDT.launch
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.equinox.prov.test/src/org/eclipse/equinox/prov/test/DirectorTest.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.equinox.prov.tests.director.DirectorTest"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.prov.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=c:/temp/equinox.prov/agent/&#13;&#10;-Declipse.prov.metadataRepository=file:c:/temp/equinox.prov/servers/CDTmetadataRepository/ &#13;&#10;-Declipse.prov.artifactRepository=file:c:/temp/equinox.prov/servers/artifactRepository/&#13;&#10;-Declipse.prov.installFolder=c:/temp/equinox.prov/eclipseInstall/ &#13;&#10;-Declipse.prov.configurationFlavor=tooling&#13;&#10;-Declipse.prov.autoInstall=cdt"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+<stringAttribute key="vminstall" value="jdk"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.tests/Test Director SDK.launch b/bundles/org.eclipse.equinox.p2.tests/Test Director SDK.launch
new file mode 100644
index 000000000..cdd1a0001
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/Test Director SDK.launch
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="false"/>
+<stringAttribute key="deselected_workspace_plugins" value="org.eclipse.update.configurator"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.equinox.prov.test/src/org/eclipse/equinox/prov/tests/director/DirectorTest.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.equinox.prov.tests.director.DirectorTest"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -noExit -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.prov.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=d:/tmp/equinox.prov/agent/ &#13;&#10;-Declipse.prov.metadataRepository=file:d:/tmp/equinox.prov/servers/metadataRepository/ &#13;&#10;-Declipse.prov.artifactRepository=file:d:/tmp/equinox.prov/servers/artifactRepository/&#13;&#10;-Declipse.prov.installFolder=d:/tmp/equinox.prov/eclipseInstall/ &#13;&#10;-Declipse.prov.configurationFlavor=tooling&#13;&#10;-Declipse.prov.autoInstall=sdk"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<stringAttribute key="selected_target_plugins" value="com.ibm.icu,com.ibm.icu.source,com.jcraft.jsch,javax.servlet,javax.servlet.jsp,javax.servlet.jsp.source,javax.servlet.source,org.apache.ant,org.apache.ant.source,org.apache.commons.el,org.apache.commons.el.source,org.apache.commons.logging,org.apache.commons.logging.source,org.apache.jasper,org.apache.jasper.source,org.apache.lucene,org.apache.lucene.analysis,org.apache.lucene.analysis.source,org.apache.lucene.source,org.eclipse.ant.core,org.eclipse.ant.ui,org.eclipse.compare,org.eclipse.core.boot,org.eclipse.core.commands,org.eclipse.core.contenttype,org.eclipse.core.databinding,org.eclipse.core.databinding.beans,org.eclipse.core.expressions,org.eclipse.core.filebuffers,org.eclipse.core.filesystem,org.eclipse.core.filesystem.win32.x86,org.eclipse.core.jobs,org.eclipse.core.net,org.eclipse.core.resources,org.eclipse.core.resources.compatibility,org.eclipse.core.resources.win32,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.core.variables,org.eclipse.cvs,org.eclipse.cvs.source,org.eclipse.debug.core,org.eclipse.debug.ui,org.eclipse.equinox.app,org.eclipse.equinox.common,org.eclipse.equinox.http.jetty,org.eclipse.equinox.http.registry,org.eclipse.equinox.http.servlet,org.eclipse.equinox.jsp.jasper,org.eclipse.equinox.jsp.jasper.registry,org.eclipse.equinox.launcher,org.eclipse.equinox.launcher.win32.win32.x86,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.help,org.eclipse.help.appserver,org.eclipse.help.base,org.eclipse.help.ui,org.eclipse.help.webapp,org.eclipse.jdt,org.eclipse.jdt.apt.core,org.eclipse.jdt.apt.pluggable.core,org.eclipse.jdt.apt.ui,org.eclipse.jdt.compiler.apt,org.eclipse.jdt.compiler.tool,org.eclipse.jdt.core,org.eclipse.jdt.core.manipulation,org.eclipse.jdt.debug,org.eclipse.jdt.debug.ui,org.eclipse.jdt.doc.isv,org.eclipse.jdt.doc.user,org.eclipse.jdt.junit,org.eclipse.jdt.junit.runtime,org.eclipse.jdt.junit4.runtime,org.eclipse.jdt.launching,org.eclipse.jdt.source,org.eclipse.jdt.ui,org.eclipse.jface,org.eclipse.jface.databinding,org.eclipse.jface.text,org.eclipse.jsch.core,org.eclipse.jsch.ui,org.eclipse.ltk.core.refactoring,org.eclipse.ltk.ui.refactoring,org.eclipse.osgi,org.eclipse.osgi.services,org.eclipse.osgi.util,org.eclipse.pde,org.eclipse.pde.build,org.eclipse.pde.core,org.eclipse.pde.doc.user,org.eclipse.pde.junit.runtime,org.eclipse.pde.runtime,org.eclipse.pde.source,org.eclipse.pde.ui,org.eclipse.pde.ui.templates,org.eclipse.platform,org.eclipse.platform.doc.isv,org.eclipse.platform.doc.user,org.eclipse.platform.source,org.eclipse.platform.source.win32.win32.x86,org.eclipse.rcp,org.eclipse.rcp.source,org.eclipse.rcp.source.win32.win32.x86,org.eclipse.sdk,org.eclipse.search,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.team.core,org.eclipse.team.cvs.core,org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh2,org.eclipse.team.cvs.ui,org.eclipse.team.ui,org.eclipse.text,org.eclipse.tomcat,org.eclipse.ui,org.eclipse.ui.browser,org.eclipse.ui.cheatsheets,org.eclipse.ui.console,org.eclipse.ui.editors,org.eclipse.ui.externaltools,org.eclipse.ui.forms,org.eclipse.ui.ide,org.eclipse.ui.ide.application,org.eclipse.ui.intro,org.eclipse.ui.intro.universal,org.eclipse.ui.navigator,org.eclipse.ui.navigator.resources,org.eclipse.ui.net,org.eclipse.ui.presentations.r21,org.eclipse.ui.views,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.win32,org.eclipse.ui.workbench,org.eclipse.ui.workbench.compatibility,org.eclipse.ui.workbench.texteditor,org.eclipse.update.configurator,org.eclipse.update.core,org.eclipse.update.core.win32,org.eclipse.update.scheduler,org.eclipse.update.ui,org.junit,org.junit.source,org.junit4,org.mortbay.jetty,org.mortbay.jetty.source"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.ecf,org.eclipse.equinox.prov.touchpoint.eclipse,org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.prov.touchpoint.natives,org.eclipse.equinox.prov.test,org.apache.xml.resolver,org.apache.xerces,org.eclipse.ecf.identity,org.eclipse.equinox.frameworkadmin,org.eclipse.equinox.prov.metadata.generator,org.eclipse.equinox.prov.artifact.repository,org.eclipse.equinox.p2.jarprocessor,org.mozilla.rhino,org.eclipse.equinox.prov.metadata.repository,com.thoughtworks.xstream,org.eclipse.equinox.prov.director,org.eclipse.equinox.prov.engine,org.eclipse.equinox.prov.console,org.eclipse.ecf.filetransfer,org.eclipse.equinox.prov.metadata,org.eclipse.equinox.prov.core,org.eclipse.equinox.prov.examplarysetup,org.eclipse.equinox.simpleconfigurator.manipulator,org.eclipse.equinox.prov.download,org.eclipse.ecf.provider.filetransfer,org.eclipse.equinox.prov.selfhosting,org.eclipse.equinox.simpleconfigurator"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+<stringAttribute key="vminstall" value="ibm1.5sr1"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall CDT.launch b/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall CDT.launch
new file mode 100644
index 000000000..87e9cbd99
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall CDT.launch
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.equinox.prov.test/src/org/eclipse/equinox/prov/tests/director/DirectorTest.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.equinox.prov.tests.director.DirectorTest"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.equinox.prov.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.prov.data.area=c:/temp/equinox.prov/agent/&#13;&#10;-Declipse.prov.metadataRepository=file:c:/temp/equinox.prov/servers/CDTmetadataRepository/ &#13;&#10;-Declipse.prov.artifactRepository=file:c:/temp/equinox.prov/servers/artifactRepository/&#13;&#10;-Declipse.prov.installFolder=c:/temp/equinox.prov/eclipseInstall/ &#13;&#10;-Declipse.prov.configurationFlavor=tooling&#13;&#10;-Declipse.prov.autoInstall=cdt&#13;&#10;-Declipse.prov.doUninstall=true"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+<stringAttribute key="vminstall" value="jdk"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall SDK.launch b/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall SDK.launch
new file mode 100644
index 000000000..ab7674355
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/Test Director Uninstall SDK.launch
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Test Director Uninstall SDK"/>
+<booleanAttribute key="default_auto_start" value="false"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-console -consolelog"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m&#13;&#10;-Xmx768m&#13;&#10;-Declipse.prov.data.area=c:/temp/equinox.prov/agent/&#13;&#10;-Declipse.prov.metadataRepository=file:c:/temp/equinox.prov/servers/metadataRepository/ &#13;&#10;-Declipse.prov.artifactRepository=file:c:/temp/equinox.prov/servers/artifactRepository/&#13;&#10;-Declipse.prov.installFolder=c:/temp/equinox.prov/eclipseInstall/ &#13;&#10;-Declipse.prov.configurationFlavor=tooling&#13;&#10;-Declipse.prov.autoInstall=sdk&#13;&#10;-Declipse.prov.doUninstall=true"/>
+<stringAttribute key="target_bundles" value="org.eclipse.core.jobs@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@default:default,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default,org.junit@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="vminstall" value="j2re1.4.2_13"/>
+<stringAttribute key="workspace_bundles" value="com.thoughtworks.xstream@default:default,org.eclipse.ecf@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:true,org.eclipse.equinox.prov.artifact.repository@default:default,org.eclipse.equinox.prov.core@default:default,org.eclipse.equinox.prov.director@default:default,org.eclipse.equinox.prov.download@default:default,org.eclipse.equinox.prov.engine@default:default,org.eclipse.equinox.prov.examplarysetup@default:default,org.eclipse.equinox.prov.metadata@default:default,org.eclipse.equinox.prov.metadata.repository@default:default,org.eclipse.equinox.prov.test@default:true,org.eclipse.equinox.prov.touchpoint.eclipse@default:default,org.eclipse.equinox.prov.touchpoint.natives@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@1:true,org.mozilla.rhino@default:default"/>
+</launchConfiguration>
diff --git a/bundles/org.eclipse.equinox.p2.tests/about.html b/bundles/org.eclipse.equinox.p2.tests/about.html
new file mode 100644
index 000000000..460233046
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.tests/build.properties b/bundles/org.eclipse.equinox.p2.tests/build.properties
new file mode 100644
index 000000000..6278d7e84
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/build.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.xml,\
+ testData/
+customCallBack=foo.xml
diff --git a/bundles/org.eclipse.equinox.p2.tests/plugin.xml b/bundles/org.eclipse.equinox.p2.tests/plugin.xml
new file mode 100644
index 000000000..16e069030
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/plugin.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.prov.processing.ByteShifter">
+ <step class="org.eclipse.equinox.prov.tests.artifact.repository.processing.ByteShifter"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.prov.processing.MD5Verifier">
+ <step class="org.eclipse.equinox.prov.tests.artifact.repository.processing.MD5Verifier"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.prov.processing.Adder">
+ <step class="org.eclipse.equinox.prov.tests.artifact.repository.processing.Adder"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.prov.processing.Multiplier">
+ <step class="org.eclipse.equinox.prov.tests.artifact.repository.processing.Multiplier"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.equinox.prov.artifact.repository.processingSteps"
+ id="org.eclipse.equinox.prov.processing.Pack200Unpacker">
+ <step class="org.eclipse.equinox.prov.tests.artifact.repository.processing.Pack200Unpacker"/>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AbstractProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AbstractProvisioningTest.java
new file mode 100644
index 000000000..7b5386984
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AbstractProvisioningTest.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests;
+
+import java.util.*;
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+/**
+ * Base class for provisioning tests with convenience methods used by multiple tests.
+ */
+public class AbstractProvisioningTest extends TestCase {
+ protected static VersionRange ANY_VERSION = new VersionRange(Version.emptyVersion, true, new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE), true);
+
+ /**
+ * Tracks the metadata repositories created by this test instance. The repositories
+ * will be removed automatically at the end of the test.
+ */
+ private List metadataRepos = new ArrayList();
+
+ public AbstractProvisioningTest() {
+ super("");
+ }
+
+ public AbstractProvisioningTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Asserts that the given profile contains *only* the given IUs.
+ */
+ protected void assertProfileContains(String message, Profile profile, IInstallableUnit[] expectedUnits) {
+ HashSet expected = new HashSet(Arrays.asList(expectedUnits));
+ for (Iterator it = profile.getInstallableUnits(); it.hasNext();) {
+ IInstallableUnit actual = (IInstallableUnit) it.next();
+ if (!expected.remove(actual))
+ fail(message + " profile " + profile.getProfileId() + " contained an unexpected unit: " + actual);
+ }
+ if (!expected.isEmpty())
+ fail(message + " profile " + profile.getProfileId() + " did not contain expected units: " + expected);
+ }
+
+ /**
+ * Asserts that the given profile contains all the given IUs.
+ */
+ protected void assertProfileContainsAll(String message, Profile profile, IInstallableUnit[] expectedUnits) {
+ HashSet expected = new HashSet(Arrays.asList(expectedUnits));
+ for (Iterator it = profile.getInstallableUnits(); it.hasNext();) {
+ IInstallableUnit actual = (IInstallableUnit) it.next();
+ expected.remove(actual);
+ }
+ if (!expected.isEmpty())
+ fail(message + " profile " + profile.getProfileId() + " did not contain expected units: " + expected);
+ }
+
+ /**
+ * Creates and returns a correctly formatted LDAP filter with the given key and value.
+ */
+ protected String createFilter(String filterKey, String filterValue) {
+ return "(" + filterKey + '=' + filterValue + ')';
+ }
+
+ /**
+ * Creates and returns a required capability with the provided attributes.
+ */
+ protected RequiredCapability[] createRequiredCapabilities(String namespace, String name, String filter) {
+ return createRequiredCapabilities(namespace, name, ANY_VERSION, filter);
+ }
+
+ /**
+ * Creates and returns a required capability with the provided attributes.
+ */
+ protected RequiredCapability[] createRequiredCapabilities(String namespace, String name, VersionRange range, String filter) {
+ return new RequiredCapability[] {new RequiredCapability(namespace, name, range, filter, false, false)};
+ }
+
+ /**
+ * Adds a test metadata repository to the system that provides the given units.
+ * The repository will automatically be removed in the tearDown method.
+ */
+ protected void createTestMetdataRepository(IInstallableUnit[] units) {
+ IMetadataRepository repo = new TestMetadataRepository(units);
+ IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) ServiceHelper.getService(TestActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ assertNotNull(repoMan);
+ repoMan.addRepository(repo);
+ metadataRepos.add(repo);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ //remove all metadata repositories created by this test
+ if (!metadataRepos.isEmpty()) {
+ IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) ServiceHelper.getService(TestActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ for (Iterator it = metadataRepos.iterator(); it.hasNext();) {
+ IMetadataRepository repo = (IMetadataRepository) it.next();
+ repoMan.removeRepository(repo);
+ }
+ metadataRepos.clear();
+ }
+ }
+
+ public IDirector createDirector() {
+ return (IDirector) ServiceHelper.getService(TestActivator.getContext(), IDirector.class.getName());
+ }
+
+ public void printProfile(Profile toPrint) {
+ boolean containsIU = false;
+ for (Iterator iterator = toPrint.getInstallableUnits(); iterator.hasNext();) {
+ System.out.println(iterator.next());
+ containsIU = true;
+ }
+ if (!containsIU)
+ System.out.println("No iu");
+ }
+
+ public void assertEmptyProfile(Profile p) {
+ assertNotNull("The profile should not be null", p);
+ boolean containsIU = false;
+ for (Iterator iterator = p.getInstallableUnits(); iterator.hasNext();) {
+ containsIU = true;
+ }
+ if (containsIU)
+ fail("The profile should be empty,profileId=" + p);
+ }
+
+ protected void assertNotOK(IStatus result) {
+ if (result.getSeverity() != IStatus.OK)
+ return;
+ fail("The status should not have been OK");
+ }
+
+ protected void assertOK(IStatus result) {
+ if (result.getSeverity() == IStatus.OK)
+ return;
+
+ if (result instanceof MultiStatus) {
+ MultiStatus ms = (MultiStatus) result;
+ IStatus children[] = ms.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ System.err.println(children[i]);
+ }
+ }
+
+ Throwable t = result.getException();
+ if (t != null)
+ t.printStackTrace();
+
+ fail(result.toString());
+ }
+
+ protected void assertNotIUs(IInstallableUnit[] ius, Iterator installableUnits) {
+ Set notexpected = new HashSet();
+ notexpected.addAll(Arrays.asList(ius));
+
+ while (installableUnits.hasNext()) {
+ IInstallableUnit next = (IInstallableUnit) installableUnits.next();
+ if (notexpected.contains(next)) {
+ fail("not expected [" + next + "]");
+ }
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AutomatedTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AutomatedTests.java
new file mode 100644
index 000000000..bf2dc9d51
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/AutomatedTests.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests;
+
+import junit.framework.*;
+
+/**
+ * This is the master test suite for all automated provisioning tests. It runs every test
+ * that is suitable for running in an automated fashion as part of a build. Some
+ * tests may be excluded if they require special setup (such as generating metadata).
+ */
+public class AutomatedTests extends TestCase {
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AutomatedTests.class.getName());
+ suite.addTest(org.eclipse.equinox.prov.tests.director.AllTests.suite());
+ suite.addTest(org.eclipse.equinox.prov.tests.download.AllTests.suite());
+ suite.addTest(org.eclipse.equinox.prov.tests.engine.AllTests.suite());
+ suite.addTest(org.eclipse.equinox.prov.tests.metadata.AllTests.suite());
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestActivator.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestActivator.java
new file mode 100644
index 000000000..9cef88a04
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestActivator.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests;
+
+import org.osgi.framework.*;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public class TestActivator implements BundleActivator {
+ public static final String PI_PROV_TESTS = "org.eclipse.equinox.prov.test";
+ public static BundleContext context;
+ private static PackageAdmin packageAdmin = null;
+ private static ServiceReference packageAdminRef = null;
+
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext context) throws Exception {
+ TestActivator.context = context;
+ packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
+ packageAdmin = (PackageAdmin) context.getService(packageAdminRef);
+
+ //This is a hack because the junit plugin launch config do not allow to start bundles
+ getBundle("org.eclipse.equinox.prov.examplarysetup").start();
+ getBundle("org.eclipse.equinox.frameworkadmin.equinox").start();
+ getBundle("org.eclipse.equinox.simpleconfigurator.manipulator").start();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ TestActivator.context = null;
+ }
+
+ public static Bundle getBundle(String symbolicName) {
+ if (packageAdmin == null)
+ return null;
+ Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
+ if (bundles == null)
+ return null;
+ //Return the first bundle that is not installed or uninstalled
+ for (int i = 0; i < bundles.length; i++) {
+ if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
+ return bundles[i];
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestArtifactRepository.java
new file mode 100644
index 000000000..ada291281
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestArtifactRepository.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests;
+
+import java.io.*;
+import java.net.*;
+import java.util.HashMap;
+import java.util.Map;
+import junit.framework.Assert;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.prov.artifact.repository.ArtifactRequest;
+import org.eclipse.equinox.prov.artifact.repository.*;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepHandler;
+import org.eclipse.equinox.prov.core.helpers.*;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.core.repository.RepositoryCreationException;
+import org.eclipse.equinox.prov.metadata.IArtifactKey;
+
+/**
+ * A simple artifact repository implementation used for testing purposes.
+ * All artifacts are kept in memory.
+ */
+public class TestArtifactRepository extends Assert implements IArtifactRepository {
+ private static final String SCHEME = "testartifactrepo";
+ /**
+ * Map of IArtifactKey -> String (location)
+ */
+ Map keysToLocations = new HashMap();
+ /**
+ * Map of String (location) -> byte[] (contents)
+ */
+ Map locationsToContents = new HashMap();
+
+ Transport testhandler = new Transport() {
+ public IStatus download(String toDownload, OutputStream target, IProgressMonitor pm) {
+ byte[] contents = (byte[]) locationsToContents.get(toDownload);
+ if (contents == null)
+ fail("Attempt to download missing artifact in TestArtifactRepository: " + toDownload);
+ try {
+ target.write(contents);
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("Unexpected exception in TestArtifactRepository" + e.getMessage());
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ private URL url;
+
+ public void addArtifact(IArtifactKey key, byte[] contents) {
+ String location = key.toString();
+ keysToLocations.put(key, location);
+ locationsToContents.put(location, contents);
+ }
+
+ public URI getArtifact(IArtifactKey key) {
+ String location = (String) keysToLocations.get(key);
+ if (location == null)
+ return null;
+ try {
+ return new URI(SCHEME, location, null);
+ } catch (URISyntaxException e) {
+ fail("Invalid URI in TestArtifactRepository: " + e.getMessage());
+ return null;
+ }
+ }
+
+ public IArtifactKey[] getArtifactKeys() {
+ return (IArtifactKey[]) keysToLocations.keySet().toArray(new IArtifactKey[0]);
+ }
+
+ private IStatus getArtifact(ArtifactRequest request, IProgressMonitor monitor) {
+ request.setSourceRepository(this);
+ request.perform(monitor);
+ return request.getResult();
+ }
+
+ public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
+ SubMonitor subMonitor = SubMonitor.convert(monitor, requests.length);
+ try {
+ MultiStatus overallStatus = new MultiStatus();
+ for (int i = 0; i < requests.length; i++) {
+ overallStatus.add(getArtifact((ArtifactRequest) requests[i], subMonitor.newChild(1)));
+ }
+ return (monitor.isCanceled() ? Status.CANCEL_STATUS : overallStatus);
+ } finally {
+ subMonitor.done();
+ }
+ }
+
+ public String getType() {
+ return SCHEME;
+ }
+
+ public URL getLocation() {
+ return url;
+ }
+
+ public void initialize(URL repoURL, InputStream descriptorFile) throws RepositoryCreationException {
+ this.url = repoURL;
+ }
+
+ public String getDescription() {
+ return "A Test Artifact Repository"; //$NON-NLS-1$
+ }
+
+ public String getName() {
+ return "ATestArtifactRepository"; //$NON-NLS-1$
+ }
+
+ public String getProvider() {
+ return "org.eclipse"; //$NON-NLS-1$
+ }
+
+ public String getVersion() {
+ return "1"; //$NON-NLS-1$
+ }
+
+ public UnmodifiableProperties getProperties() {
+ return new UnmodifiableProperties(new OrderedProperties());
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == TestArtifactRepository.class || adapter == IArtifactRepository.class || adapter == IRepositoryInfo.class) {
+ return this;
+ }
+ return null;
+ }
+
+ public boolean contains(IArtifactDescriptor descriptor) {
+ return keysToLocations.get(descriptor.getArtifactKey()) != null;
+ }
+
+ public boolean contains(IArtifactKey key) {
+ return keysToLocations.get(key) != null;
+ }
+
+ public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
+ ProcessingStepHandler handler = new ProcessingStepHandler();
+ destination = handler.createAndLink(descriptor.getProcessingSteps(), null, destination, monitor);
+ testhandler.download((String) keysToLocations.get(descriptor.getArtifactKey()), destination, monitor);
+ return Status.OK_STATUS;
+ }
+
+ public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
+ if (!contains(key))
+ return null;
+ return new IArtifactDescriptor[] {new ArtifactDescriptor(key)};
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestMetadataRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestMetadataRepository.java
new file mode 100644
index 000000000..99cf56c03
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/TestMetadataRepository.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.*;
+import junit.framework.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.core.helpers.OrderedProperties;
+import org.eclipse.equinox.prov.core.helpers.UnmodifiableProperties;
+import org.eclipse.equinox.prov.core.repository.IRepositoryInfo;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.RequiredCapability;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.query.CompoundIterator;
+import org.eclipse.osgi.service.resolver.VersionRange;
+
+/**
+ * A simple metadata repository used for testing purposes. All metadata
+ * is kept in memory.
+ */
+public class TestMetadataRepository extends Assert implements IMetadataRepository {
+
+ private static final String SCHEME = "testmetadatarepo"; //$NON-NLS-1$
+ private final List units = new ArrayList();
+ private URL url;
+
+ public TestMetadataRepository(IInstallableUnit[] ius) {
+ units.addAll(Arrays.asList(ius));
+ try {
+ url = File.createTempFile("TestMetadataRepository", Long.toString(System.currentTimeMillis())).toURL();
+ } catch (MalformedURLException e) {
+ fail(e.getMessage());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ public IInstallableUnit[] getInstallableUnits(IProgressMonitor monitor) {
+ IInstallableUnit[] result = query(null, null, null, false, monitor);
+ return result;
+ }
+
+ public Iterator getIterator(String id, VersionRange range, RequiredCapability[] requirements, boolean and) {
+ return new CompoundIterator(new Iterator[] {units.iterator()}, id, range, requirements, and);
+ }
+
+ public URL getLocation() {
+ return url;
+ }
+
+ public IInstallableUnit[] query(String id, VersionRange range, RequiredCapability[] requirements, boolean and, IProgressMonitor monitor) {
+ return CompoundIterator.asArray(new CompoundIterator(new Iterator[] {units.iterator()}, id, range, requirements, and), null);
+ }
+
+ public String getDescription() {
+ return "A Test Metadata Repository"; //$NON-NLS-1$;
+ }
+
+ public String getName() {
+ return "ATestMetadataRepository"; //$NON-NLS-1$;
+ }
+
+ public String getProvider() {
+ return "org.eclipse"; //$NON-NLS-1$
+ }
+
+ public String getType() {
+ return SCHEME;
+ }
+
+ public String getVersion() {
+ return "1"; //$NON-NLS-1$
+ }
+
+ public UnmodifiableProperties getProperties() {
+ return new UnmodifiableProperties(new OrderedProperties());
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == TestMetadataRepository.class || adapter == IMetadataRepository.class || adapter == IRepositoryInfo.class) {
+ return this;
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/AllTests.java
new file mode 100644
index 000000000..496438193
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/AllTests.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository;
+
+import junit.framework.*;
+
+/**
+ * Performs all automated director tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(JarURLRepositoryTest.class);
+ return suite;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/JarURLRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/JarURLRepositoryTest.java
new file mode 100644
index 000000000..8b8d60772
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/JarURLRepositoryTest.java
@@ -0,0 +1,47 @@
+package org.eclipse.equinox.prov.tests.artifact.repository;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import junit.framework.TestCase;
+import org.eclipse.equinox.internal.prov.metadata.ArtifactKey;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepository;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactRepositoryManager;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+public class JarURLRepositoryTest extends TestCase {
+
+ private ServiceReference managerRef;
+ private IArtifactRepositoryManager manager;
+
+ public JarURLRepositoryTest(String name) {
+ super(name);
+ }
+
+ public JarURLRepositoryTest() {
+ super("");
+ }
+
+ protected void setUp() throws Exception {
+ managerRef = TestActivator.getContext().getServiceReference(IArtifactRepositoryManager.class.getName());
+ manager = (IArtifactRepositoryManager) TestActivator.getContext().getService(managerRef);
+ }
+
+ protected void tearDown() throws Exception {
+ manager = null;
+ TestActivator.getContext().ungetService(managerRef);
+ }
+
+ public void testJarURLRepository() {
+ URL engineJar = TestActivator.getContext().getBundle().getEntry("/testData/enginerepo.jar");
+ URL jarRepoURL = null;
+ try {
+ jarRepoURL = new URL("jar:" + engineJar.toString() + "!/");
+ } catch (MalformedURLException e) {
+ fail(e.getMessage());
+ }
+ IArtifactRepository repo = manager.loadRepository(jarRepoURL, null);
+ assertTrue(repo.contains(new ArtifactKey("eclipse", "plugin", "org.eclipse.equinox.prov.engine", new Version("0.1.0.200709241631"))));
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Adder.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Adder.java
new file mode 100644
index 000000000..8d23231b7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Adder.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+* Copyright (c) 2007 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
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+
+public class Adder extends ProcessingStep {
+
+ protected int operand;
+
+ public Adder() {
+ // needed
+ }
+
+ public Adder(int operand) {
+ super();
+ this.operand = operand;
+ }
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ try {
+ operand = Integer.valueOf(descriptor.getData()).intValue();
+ } catch (NumberFormatException e) {
+ int code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ status = new Status(code, Activator.ID, "Adder operand specification invalid", e);
+ return;
+ }
+ }
+
+ public void write(int b) throws IOException {
+ destination.write(b + operand);
+ }
+
+ public void close() throws IOException {
+ super.close();
+ status = Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ByteShifter.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ByteShifter.java
new file mode 100644
index 000000000..6ed97709d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ByteShifter.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+* Copyright (c) 2007 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
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+
+public class ByteShifter extends ProcessingStep {
+
+ protected int operand;
+
+ public ByteShifter() {
+ super();
+ }
+
+ public ByteShifter(int shiftLeft) {
+ super();
+ this.operand = shiftLeft;
+ basicInitialize(null);
+ }
+
+ private void basicInitialize(ProcessingStepDescriptor descriptor) {
+ // if the status is already set to something that not ok, we've already found a problem.
+ if (status != null && status.getCode() != IStatus.OK)
+ return;
+
+ int code;
+ // if there is a descriptor, decide if the "bad case" is an error or info. If no
+ // descriptor then default to error.
+ if (descriptor != null)
+ code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ else
+ code = IStatus.ERROR;
+
+ // finally, check the actual setup and set the status.
+ if (operand <= 0)
+ status = new Status(code, Activator.ID, "ByteShifter operand invalid: " + operand);
+ }
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ try {
+ operand = Integer.valueOf(descriptor.getData()).intValue();
+ } catch (NumberFormatException e) {
+ int code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ status = new Status(code, Activator.ID, "ByteShifter operand specification invalid", e);
+ return;
+ }
+ basicInitialize(descriptor);
+ }
+
+ public void write(int b) throws IOException {
+ destination.write(b == -1 ? b : b << operand);
+ }
+
+ public IStatus getStatus() {
+ return Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Counter.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Counter.java
new file mode 100644
index 000000000..f21e0265e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Counter.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+* Copyright (c) 2007 IBM Corporation and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* IBM Corporation - initial API and implementation
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+
+public class Counter extends ProcessingStep {
+
+ protected long size = -1;
+ long total = 0;
+
+ public Counter() {
+ // needed
+ }
+
+ public Counter(long size) {
+ super();
+ this.size = size;
+ basicInitialize(null);
+ }
+
+ private void basicInitialize(ProcessingStepDescriptor descriptor) {
+ // if the status is already set to something that not ok, we've already found a problem.
+ if (status != null && status.getCode() != IStatus.OK)
+ return;
+
+ int code;
+ // if there is a descriptor, decide if the "bad case" is an error or info. If no
+ // descriptor then default to erorr.
+ if (descriptor != null)
+ code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ else
+ code = IStatus.ERROR;
+
+ // finally, check the actual setup and set the status.
+ if (size != -1)
+ status = new Status(code, Activator.ID, "Counter size not set");
+ }
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ String data = descriptor.getData();
+ if (data == null)
+ return;
+ try {
+ if (data.equals("download"))
+ size = Long.parseLong(context.getProperty(IArtifactDescriptor.DOWNLOAD_SIZE));
+ else if (data.equals("artifact"))
+ size = Long.parseLong(context.getProperty(IArtifactDescriptor.ARTIFACT_SIZE));
+ else
+ size = Long.parseLong(data);
+ } catch (NumberFormatException e) {
+ int code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ status = new Status(code, Activator.ID, "Counter size specification invalid", e);
+ return;
+ }
+ basicInitialize(descriptor);
+ }
+
+ public void write(int b) throws IOException {
+ total++;
+ destination.write(b);
+ }
+
+ public void close() throws IOException {
+ super.close();
+ if (total != size)
+ status = new Status(IStatus.WARNING, "plugin id", "Size mismatch. Was " + total + " should have been " + size);
+ else
+ status = Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/MD5Verifier.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/MD5Verifier.java
new file mode 100644
index 000000000..5609874a2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/MD5Verifier.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+* Copyright (c) 2007 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
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+
+public class MD5Verifier extends ProcessingStep {
+
+ protected String md5Test;
+ private MessageDigest md5;
+
+ public MD5Verifier() {
+ super();
+ }
+
+ public MD5Verifier(String md5Test) {
+ super();
+ this.md5Test = md5Test;
+ basicInitialize(null);
+ }
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ String data = descriptor.getData();
+ if (data.equals("download"))
+ md5Test = context.getProperty(IArtifactDescriptor.DOWNLOAD_MD5);
+ else if (data.equals("artifact"))
+ md5Test = context.getProperty(IArtifactDescriptor.ARTIFACT_MD5);
+ else
+ md5Test = data;
+ basicInitialize(descriptor);
+ }
+
+ private void basicInitialize(ProcessingStepDescriptor descriptor) {
+ int code;
+ if (descriptor == null)
+ code = IStatus.ERROR;
+ else
+ code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ if (md5Test == null || md5Test.length() != 32)
+ status = new Status(code, Activator.ID, "MD5 value not available or incorrect size");
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ status = new Status(code, Activator.ID, "Could not create MD5 algorithm", e);
+ }
+ }
+
+ public void write(int b) throws IOException {
+ if (b != -1)
+ md5.update((byte) b);
+ destination.write(b);
+ }
+
+ public void close() throws IOException {
+ super.close();
+
+ byte[] digest = md5.digest();
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < digest.length; i++) {
+ if ((digest[i] & 0xFF) < 0x10)
+ buf.append('0');
+ buf.append(Integer.toHexString(digest[i] & 0xFF));
+ }
+
+ // if the hashes don't line up set the status to error.
+ if (!buf.toString().equals(md5Test)) {
+ String message = "Error processing stream. MD5 hash is not as expected.";
+ status = new Status(IStatus.ERROR, "plugin id", message);
+ } else
+ status = Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Multiplier.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Multiplier.java
new file mode 100644
index 000000000..611fd8b7a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Multiplier.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+* Copyright (c) 2007 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
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+
+public class Multiplier extends ProcessingStep {
+
+ protected int operand;
+
+ public Multiplier() {
+ // needed
+ }
+
+ public Multiplier(int operand) {
+ super();
+ this.operand = operand;
+ }
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ try {
+ operand = Integer.valueOf(descriptor.getData()).intValue();
+ } catch (NumberFormatException e) {
+ int code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO;
+ status = new Status(code, Activator.ID, "Multiplier operand specification invalid", e);
+ return;
+ }
+ }
+
+ public void write(int b) throws IOException {
+ destination.write(b == -1 ? b : b * operand);
+ }
+
+ public void close() throws IOException {
+ super.close();
+ status = Status.OK_STATUS;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Pack200Unpacker.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Pack200Unpacker.java
new file mode 100644
index 000000000..ac0e57689
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/Pack200Unpacker.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+* Copyright (c) 2007 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
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.jarprocessor.UnpackStep;
+import org.eclipse.equinox.internal.p2.jarprocessor.Utils;
+import org.eclipse.equinox.internal.prov.artifact.repository.Activator;
+import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor;
+import org.eclipse.equinox.p2.jarprocessor.JarProcessorExecutor.Options;
+import org.eclipse.equinox.prov.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.prov.artifact.repository.processing.ProcessingStepDescriptor;
+import org.eclipse.equinox.prov.core.helpers.FileUtils;
+
+/**
+ * The Pack200Unpacker expects an input containing ".jar.pack.gz" data.
+ */
+public class Pack200Unpacker extends ProcessingStep {
+ private final static String PACKED_EXT = Utils.JAR_SUFFIX + Utils.PACKED_SUFFIX;
+
+ private File packed;
+ private OutputStream tempStream;
+
+ public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ super.initialize(descriptor, context);
+ if (!UnpackStep.canUnpack())
+ status = new Status(IStatus.ERROR, Activator.ID, "Unpack facility not configured");
+ }
+
+ public void write(int b) throws IOException {
+ OutputStream stream = getOutputStream();
+ stream.write(b);
+ }
+
+ private OutputStream getOutputStream() throws IOException {
+ if (tempStream != null)
+ return tempStream;
+ // store input stream in temporary file
+ packed = File.createTempFile("pack200", PACKED_EXT);
+ tempStream = new BufferedOutputStream(new FileOutputStream(packed));
+ return tempStream;
+ }
+
+ private void performUnpack() throws IOException {
+ BufferedInputStream unpackedStream = null;
+ File unpacked = null;
+ File workDir = null;
+ try {
+ if (tempStream == null)
+ // hmmm, no one wrote to this stream so there is nothing to pass on
+ return;
+ // Ok, so there is content, close the tempStream
+ tempStream.close();
+ // now create a temporary directory for the JarProcessor to work in
+ // TODO How to create a unique, temporary directory atomically?
+ workDir = File.createTempFile("work", "");
+ if (!workDir.delete())
+ throw new IOException("Could not delete file for creating temporary working dir.");
+ if (!workDir.mkdirs())
+ throw new IOException("Could not create temporary working dir.");
+
+ // unpack
+ Options options = new Options();
+ options.unpack = true;
+ options.processAll = true;
+ options.input = packed;
+ options.outputDir = workDir.getPath();
+ new JarProcessorExecutor().runJarProcessor(options);
+
+ // now write the unpacked content to our destination
+ String packedFileName = packed.getName();
+ unpacked = new File(workDir, packedFileName.substring(0, packedFileName.length() - Utils.PACKED_SUFFIX.length()));
+ unpackedStream = new BufferedInputStream(new FileInputStream(unpacked));
+ FileUtils.copyStream(unpackedStream, true, destination, false);
+ unpackedStream = null;
+ } finally {
+ if (packed != null)
+ packed.delete();
+ if (unpackedStream != null)
+ unpackedStream.close();
+ if (unpacked != null)
+ unpacked.delete();
+ if (workDir != null)
+ workDir.delete();
+ }
+ }
+
+ public void close() throws IOException {
+ // When we go to close we must have seen all the content we are going to see
+ // So before closing, run unpack and write the unpacked result to the destination
+ performUnpack();
+ super.close();
+ status = Status.OK_STATUS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ProcessingStepHandlerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ProcessingStepHandlerTest.java
new file mode 100644
index 000000000..d7006c219
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/artifact/repository/processing/ProcessingStepHandlerTest.java
@@ -0,0 +1,207 @@
+/*******************************************************************************
+* Copyright (c) 2007 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
+* IBM - continuing development
+*******************************************************************************/
+package org.eclipse.equinox.prov.tests.artifact.repository.processing;
+
+import java.io.*;
+import java.util.Arrays;
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.artifact.repository.processing.*;
+import org.eclipse.equinox.prov.core.helpers.FileUtils;
+import org.eclipse.equinox.prov.tests.TestActivator;
+
+public class ProcessingStepHandlerTest extends TestCase {
+
+ // private static final int BUFFER_SIZE = 8 * 1024;
+
+ ProcessingStepHandler handler = new ProcessingStepHandler();
+ IProgressMonitor monitor = new NullProgressMonitor();
+
+ public void testExecuteNoPSs() throws IOException {
+ ProcessingStepDescriptor[] descriptors = new ProcessingStepDescriptor[0];
+ OutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.createAndLink(descriptors, null, result, monitor);
+ testStream.write("Test".getBytes());
+ testStream.close();
+ assertEquals("Test", result.toString());
+ }
+
+ public void testExecuteOneByteShifterPS() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new ByteShifter(1)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {2}, result.toByteArray()));
+ }
+
+ public void testExecuteTwoByteShifterPSs() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new ByteShifter(1), new ByteShifter(2)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {8}, result.toByteArray()));
+ }
+
+ public void testExecuteOneMD5VerifierPSOk() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("0cbc6611f5540bd0809a388dc95a615b")};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write("Test".getBytes());
+ testStream.close();
+ assertEquals("Test", result.toString());
+ }
+
+ public void testExecuteOneMD5VerifierPSFails() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("9cbc6611f5540bd0809a388dc95a615b")};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write("Test".getBytes());
+ try {
+ testStream.close();
+ assertEquals("Test", result.toString());
+ assertTrue((handler.validateSteps(testStream).getSeverity() == IStatus.ERROR));
+ } catch (IOException e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testExecuteOneByteShifterAndOneMD5VerifierPSOk() throws IOException {
+ // Order of PSs is important!!
+ ProcessingStep[] steps = new ProcessingStep[] {new ByteShifter(1), new MD5Verifier("ceeee507e8db83294600218b4e198897")};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {2, 4, 6, 8, 10}, result.toByteArray()));
+ }
+
+ public void testExecuteOneByteShifterAndOneMD5VerifierPSFailWrongOrder() throws IOException {
+ // Order of PSs is important - here it wrong!!
+ ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("af476bbaf152a4c39ca4e5c498a88aa0"), new ByteShifter(1)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ try {
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {2, 4, 6, 8, 10}, result.toByteArray()));
+ assertTrue((handler.validateSteps(testStream).getSeverity() == IStatus.ERROR));
+ } catch (IOException e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testAssureOrderingOfPSs1() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new Adder(1), new Multiplier(2)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {4, 6, 8, 10, 12}, result.toByteArray()));
+ }
+
+ public void testAssureOrderingOfPSs2() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new Multiplier(2), new Adder(1)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {3, 5, 7, 9, 11}, result.toByteArray()));
+ }
+
+ public void testExecuteOnePack200UnpackerPS() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new Pack200Unpacker()};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(100000);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ InputStream inputStream = TestActivator.getContext().getBundle().getEntry("testData/jarprocessor.jar.pack.gz").openStream();
+ FileUtils.copyStream(inputStream, true, testStream, true);
+ assertEquals(35062, result.size());
+ }
+
+ public void testCreateByteShifterPS() {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.ByteShifter", "1", true);
+ ProcessingStep step = handler.create(descriptor, null);
+ assertNotNull(step);
+ assertEquals(ByteShifter.class, step.getClass());
+ }
+
+ public void testCreateMD5VerifierPS() {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.MD5Verifier", "1", true);
+ ProcessingStep step = handler.create(descriptor, null);
+ assertNotNull(step);
+ assertEquals(MD5Verifier.class, step.getClass());
+ }
+
+ public void testCreateAdderPS() {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Adder", "1", true);
+ ProcessingStep step = handler.create(descriptor, null);
+ assertNotNull(step);
+ assertEquals(Adder.class, step.getClass());
+ }
+
+ public void testCreateMultiplierPS() {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Multiplier", "2", true);
+ ProcessingStep step = handler.create(descriptor, null);
+ assertNotNull(step);
+ assertEquals(Multiplier.class, step.getClass());
+ }
+
+ public void testCreatePack200UnpackerPS() {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Pack200Unpacker", null, true);
+ ProcessingStep step = handler.create(descriptor, null);
+ assertNotNull(step);
+ assertEquals(Pack200Unpacker.class, step.getClass());
+ }
+
+ public void testCreatePSsAndAssureOrderingOfPSs1() throws IOException {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Adder", "1", true);
+ ProcessingStep adder = handler.create(descriptor, null);
+
+ descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Multiplier", "2", true);
+ ProcessingStep multiplier = handler.create(descriptor, null);
+
+ ProcessingStep[] steps = new ProcessingStep[] {adder, multiplier};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {4, 6, 8, 10, 12}, result.toByteArray()));
+ }
+
+ public void testCreatePSsAndAssureOrderingOfPSs2() throws IOException {
+ ProcessingStepDescriptor descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Adder", "1", true);
+ ProcessingStep adder = handler.create(descriptor, null);
+
+ descriptor = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Multiplier", "2", true);
+ ProcessingStep multiplier = handler.create(descriptor, null);
+
+ ProcessingStep[] steps = new ProcessingStep[] {multiplier, adder};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {3, 5, 7, 9, 11}, result.toByteArray()));
+ }
+
+ public void testLinkPSs() throws IOException {
+ ProcessingStepDescriptor descriptor1 = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Adder", "1", true);
+ ProcessingStepDescriptor descriptor2 = new ProcessingStepDescriptor("org.eclipse.equinox.prov.processing.Multiplier", "2", true);
+ ProcessingStepDescriptor[] descriptors = new ProcessingStepDescriptor[] {descriptor1, descriptor2};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.createAndLink(descriptors, null, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {4, 6, 8, 10, 12}, result.toByteArray()));
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AllTests.java
new file mode 100644
index 000000000..1d1645b90
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AllTests.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import junit.framework.*;
+
+/**
+ * Performs all automated director tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(AutomatedDirectorTest.class);
+ suite.addTestSuite(Bug203637.class);
+ suite.addTestSuite(OperationGenerationTest.class);
+ suite.addTestSuite(OracleTest.class);
+ suite.addTestSuite(OracleTest2.class);
+ suite.addTestSuite(PickerTest.class);
+ suite.addTestSuite(RollbackTest.class);
+ suite.addTestSuite(SingletonTest.class);
+ suite.addTestSuite(UninstallTest.class);
+ suite.addTestSuite(UpdateTestWithoutEntryPoint.class);
+ suite.addTestSuite(UpdateTestWithEntryPoint.class);
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AutomatedDirectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AutomatedDirectorTest.java
new file mode 100644
index 000000000..29be504c9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/AutomatedDirectorTest.java
@@ -0,0 +1,256 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.core.helpers.LogHelper;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.osgi.framework.Version;
+
+/**
+ * Various automated tests of the {@link IDirector} API.
+ */
+public class AutomatedDirectorTest extends AbstractProvisioningTest {
+ private static Version version = new Version(1, 0, 0);
+
+ public static Test suite() {
+ return new TestSuite(AutomatedDirectorTest.class);
+ }
+
+ public AutomatedDirectorTest() {
+ super("");
+ }
+
+ public AutomatedDirectorTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Tests installing an IU that has a filtered dependency on another IU. When
+ * the filter is satisfied, the dependency is active and the required IU should
+ * be installed. When the filter is not satisfied, the dependency is inactive
+ * and the second IU should not be installed.
+ */
+ public void testInstallFilteredCapability() {
+ //The IU that is required
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ String filter = createFilter("FilterKey", "true");
+ RequiredCapability capability = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, requiredIU.getId(), ANY_VERSION, filter, false, false);
+ toInstallIU.setRequiredCapabilities(new RequiredCapability[] {capability});
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {requiredIU, toInstallIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+ IDirector director = createDirector();
+
+ //Install into a profile in which the filter is satisfied
+ Profile satisfied = new Profile("Satisfied." + getName());
+ satisfied.setValue(Profile.PROP_ENVIRONMENTS, "FilterKey=true");
+ IStatus result = director.install(toInstallArray, satisfied, null, null);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", satisfied, allUnits);
+
+ //Install into a profile in which the filter is not satisfied
+
+ //Install into a profile in which the filter key is undefined
+
+ }
+
+ /**
+ * Tests installing an IU that has an optional prerequisite that is available.
+ */
+ public void testInstallOptionalAvailable() {
+ String capabilityId = "test." + getName();
+ //The IU that exports the capability
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+ requiredIU.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", capabilityId, version)});
+
+ //The IU that optionally requires the capability
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ RequiredCapability required = new RequiredCapability("test.capability", capabilityId, ANY_VERSION, null, true, false);
+ toInstallIU.setRequiredCapabilities(new RequiredCapability[] {required});
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {toInstallIU, requiredIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+ IDirector director = createDirector();
+ IStatus result = director.install(toInstallArray, profile, null, null);
+ if (!result.isOK())
+ LogHelper.log(result);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", profile, allUnits);
+ }
+
+ /**
+ * Tests installing an IU that has an optional prerequisite that is not available.
+ */
+ public void testInstallOptionalUnavailable() {
+ String capabilityId = "test." + getName();
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ //no IU will be available that exports this capability
+ RequiredCapability required = new RequiredCapability("test.capability", capabilityId, ANY_VERSION, null, true, false);
+ toInstallIU.setRequiredCapabilities(new RequiredCapability[] {required});
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+ IDirector director = createDirector();
+ IStatus result = director.install(allUnits, profile, null, null);
+ if (!result.isOK())
+ LogHelper.log(result);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", profile, allUnits);
+ }
+
+ /**
+ * Tests installing an IU that has a required capability, and the IU providing
+ * the capability has a platform filter that is not satisfied.
+ */
+ public void testInstallPlatformFilter() {
+ //The IU that exports the capability
+ String capabilityId = "test." + getName();
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+ requiredIU.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", capabilityId, version)});
+ requiredIU.setFilter(createFilter("osgi.os", "blort"));
+
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ toInstallIU.setRequiredCapabilities(createRequiredCapabilities("test.capability", capabilityId, ANY_VERSION, null));
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {requiredIU, toInstallIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+ IDirector director = createDirector();
+ IStatus result = director.install(toInstallArray, profile, null, null);
+ assertTrue("1.0", !result.isOK());
+
+ //try again with the filter satisfied
+ profile.setValue(Profile.PROP_ENVIRONMENTS, "osgi.os=blort");
+ result = director.install(toInstallArray, profile, null, null);
+ assertTrue("2.0", result.isOK());
+ }
+
+ /**
+ * Simple test of installing an IU that has a required capability, and ensuring
+ * that the IU providing the capability is installed.
+ */
+ public void testSimpleInstallRequired() {
+ String capabilityId = "test." + getName();
+ //The IU that exports the capability
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+ requiredIU.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", capabilityId, version)});
+
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ toInstallIU.setRequiredCapabilities(createRequiredCapabilities("test.capability", capabilityId, ANY_VERSION, null));
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {requiredIU, toInstallIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+
+ IDirector director = createDirector();
+ IStatus result = director.install(toInstallArray, profile, null, null);
+ if (!result.isOK())
+ LogHelper.log(result);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", profile, allUnits);
+ }
+
+ /**
+ * Simple test of installing an IU that has a required capability, but without
+ * specifying a version range (any version will do).
+ */
+ public void testInstallRequiredNoVersion() {
+ //The IU that is needed
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ RequiredCapability capability = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, requiredIU.getId(), null, null, false, false);
+ toInstallIU.setRequiredCapabilities(new RequiredCapability[] {capability});
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {requiredIU, toInstallIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+
+ IDirector director = createDirector();
+ IStatus result = director.install(toInstallArray, profile, null, null);
+ if (!result.isOK())
+ LogHelper.log(result);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", profile, allUnits);
+ }
+
+ /**
+ * Simple test of installing an IU that has a required IU, and ensuring
+ * that the required IU is installed. In other words, the IU to install has a required
+ * capability on the IU namespace.
+ */
+ public void testSimpleInstallRequiredIU() {
+ //The IU that exports the capability
+ InstallableUnit requiredIU = new InstallableUnit();
+ requiredIU.setId("required." + getName());
+ requiredIU.setVersion(version);
+
+ InstallableUnit toInstallIU = new InstallableUnit();
+ toInstallIU.setId("toInstall." + getName());
+ toInstallIU.setVersion(version);
+ RequiredCapability capability = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, requiredIU.getId(), ANY_VERSION, null, false, false);
+ toInstallIU.setRequiredCapabilities(new RequiredCapability[] {capability});
+
+ IInstallableUnit[] allUnits = new IInstallableUnit[] {requiredIU, toInstallIU};
+ IInstallableUnit[] toInstallArray = new IInstallableUnit[] {toInstallIU};
+ createTestMetdataRepository(allUnits);
+
+ Profile profile = new Profile("TestProfile." + getName());
+
+ IDirector director = createDirector();
+ IStatus result = director.install(toInstallArray, profile, null, null);
+ if (!result.isOK())
+ LogHelper.log(result);
+ assertTrue("1.0", result.isOK());
+ assertProfileContains("1.1", profile, allUnits);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/Bug203637.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/Bug203637.java
new file mode 100644
index 000000000..eea4af549
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/Bug203637.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.osgi.framework.Version;
+
+public class Bug203637 extends AbstractProvisioningTest {
+ public void test() {
+ IDirector d = createDirector();
+ Profile profile = new Profile("TestProfile." + getName());
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("A");
+ a1.setVersion(new Version(1, 0, 0));
+ a1.setSingleton(true);
+
+ assertOK(d.replace(new IInstallableUnit[0], new IInstallableUnit[] {a1}, profile, null));
+
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OperationGenerationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OperationGenerationTest.java
new file mode 100644
index 000000000..560c60688
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OperationGenerationTest.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.TestCase;
+import org.eclipse.equinox.internal.prov.director.OperationGenerator;
+import org.eclipse.equinox.prov.metadata.IInstallableUnitConstants;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.osgi.framework.Version;
+
+public class OperationGenerationTest extends TestCase {
+ public void testInstallUninstall() {
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("a");
+ a1.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit a2 = new InstallableUnit();
+ a2.setId("a");
+ a2.setVersion(new Version(2, 0, 0));
+
+ InstallableUnit a3 = new InstallableUnit();
+ a3.setId("a");
+ a3.setVersion(new Version(3, 0, 0));
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a1);
+ from.add(a2);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(a1);
+ to.add(a3);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+ public void test1() {
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("a");
+ a1.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit a2 = new InstallableUnit();
+ a2.setId("a");
+ a2.setVersion(new Version(2, 0, 0));
+
+ InstallableUnit a3 = new InstallableUnit();
+ a3.setId("a");
+ a3.setVersion(new Version(3, 0, 0));
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a1);
+ from.add(a3);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(a1);
+ to.add(a3);
+ to.add(a2);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+ public void test2() {
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("a");
+ a1.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit a2 = new InstallableUnit();
+ a2.setId("a");
+ a2.setVersion(new Version(2, 0, 0));
+
+ InstallableUnit a3 = new InstallableUnit();
+ a3.setId("a");
+ a3.setVersion(new Version(3, 0, 0));
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a1);
+ from.add(a2);
+ from.add(a3);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(a1);
+ to.add(a3);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+ public void testUpdate3() {
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("a");
+ a1.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit a2 = new InstallableUnit();
+ a2.setId("a");
+ a2.setVersion(new Version(2, 0, 0));
+
+ InstallableUnit b = new InstallableUnit();
+ b.setId("b");
+ b.setVersion(new Version(1, 0, 0));
+ b.setProperty(IInstallableUnitConstants.UPDATE_FROM, "a");
+ b.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 2.0.0)");
+
+ InstallableUnit c = new InstallableUnit();
+ c.setId("c");
+ c.setVersion(new Version(1, 0, 0));
+ c.setProperty(IInstallableUnitConstants.UPDATE_FROM, "a");
+ c.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[2.0.0, 2.3.0)");
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a1);
+ from.add(a2);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(b);
+ to.add(c);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+ public void testUpdate2() {
+ InstallableUnit a1 = new InstallableUnit();
+ a1.setId("a");
+ a1.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit a2 = new InstallableUnit();
+ a2.setId("a");
+ a2.setVersion(new Version(2, 0, 0));
+
+ InstallableUnit b = new InstallableUnit();
+ b.setId("b");
+ b.setVersion(new Version(1, 0, 0));
+ b.setProperty(IInstallableUnitConstants.UPDATE_FROM, "a");
+ b.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 3.0.0)");
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a1);
+ from.add(a2);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(b);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+ public void testUpdate1() {
+ InstallableUnit a = new InstallableUnit();
+ a.setId("a");
+ a.setVersion(new Version(1, 0, 0));
+
+ InstallableUnit b = new InstallableUnit();
+ b.setId("b");
+ b.setVersion(new Version(1, 0, 0));
+ b.setProperty(IInstallableUnitConstants.UPDATE_FROM, "a");
+ b.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 2.0.0)");
+
+ Collection from;
+ from = new ArrayList();
+ from.add(a);
+
+ Collection to;
+ to = new ArrayList();
+ to.add(b);
+
+ from = new ResolutionHelper(null, null).attachCUs(from);
+ to = new ResolutionHelper(null, null).attachCUs(to);
+ new OperationGenerator().generateOperation(from, to);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest.java
new file mode 100644
index 000000000..74e8e7ad9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class OracleTest extends AbstractProvisioningTest {
+ InstallableUnit a1;
+ InstallableUnit a2;
+ InstallableUnit b1;
+ InstallableUnit c1;
+ InstallableUnit d1;
+ InstallableUnit d2;
+
+ IDirector director;
+ Profile profile;
+
+ protected void setUp() throws Exception {
+ a1 = new InstallableUnit();
+ a1.setId("A");
+ a1.setVersion(new Version(1, 0, 0));
+ a1.setSingleton(true);
+ a1.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "C", new VersionRange("[1.0.0, 2.0.0)"), null));
+
+ c1 = new InstallableUnit();
+ c1.setId("C");
+ c1.setVersion(new Version(1, 0, 0));
+ c1.setSingleton(true);
+ c1.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "D", new VersionRange("[1.0.0, 3.0.0)"), null));
+
+ d1 = new InstallableUnit();
+ d1.setId("D");
+ d1.setVersion(new Version(1, 0, 0));
+ d1.setSingleton(true);
+
+ b1 = new InstallableUnit();
+ b1.setId("B");
+ b1.setVersion(new Version(1, 0, 0));
+ b1.setSingleton(true);
+ b1.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "D", new VersionRange("[2.0.0, 3.0.0)"), null));
+
+ d2 = new InstallableUnit();
+ d2.setId("D");
+ d2.setVersion(new Version(2, 0, 0));
+ d2.setSingleton(true);
+
+ createTestMetdataRepository(new IInstallableUnit[] {a1, c1, d1, b1});
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+
+ }
+
+ public void testInstallA1() {
+ assertEquals(director.install(new IInstallableUnit[] {a1}, profile, null, null).getSeverity(), IStatus.OK);
+
+ createTestMetdataRepository(new IInstallableUnit[] {d2});
+ // assertEquals(new Oracle().canInstall(new IInstallableUnit[] {b1}, profile, null), true);
+ assertEquals(director.install(new IInstallableUnit[] {b1}, profile, null, null).getSeverity(), IStatus.OK);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest2.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest2.java
new file mode 100644
index 000000000..896e5ebd6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/OracleTest2.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import java.util.Collection;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.director.Oracle;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class OracleTest2 extends AbstractProvisioningTest {
+ private InstallableUnit a1;
+ private InstallableUnit a2;
+ private InstallableUnit b1;
+ private InstallableUnit c1;
+ private InstallableUnit c2;
+
+ IDirector director;
+ Profile profile;
+
+ protected void setUp() throws Exception {
+ a1 = new InstallableUnit();
+ a1.setId("A");
+ a1.setVersion(new Version(1, 0, 0));
+ a1.setSingleton(true);
+ a1.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "C", new VersionRange("[1.0.0, 2.0.0)"), null));
+
+ c1 = new InstallableUnit();
+ c1.setId("C");
+ c1.setVersion(new Version(1, 0, 0));
+ c1.setSingleton(true);
+
+ a2 = new InstallableUnit();
+ a2.setId("A");
+ a2.setVersion(new Version(2, 0, 0));
+ a2.setSingleton(true);
+ a2.setProperty(IInstallableUnitConstants.UPDATE_FROM, "A");
+ a2.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 2.3.0)");
+ a2.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "C", new VersionRange("[2.0.0, 3.0.0)"), null));
+
+ b1 = new InstallableUnit();
+ b1.setId("B");
+ b1.setVersion(new Version(1, 0, 0));
+ b1.setSingleton(true);
+ b1.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "C", new VersionRange("[2.0.0, 3.0.0)"), null));
+
+ c2 = new InstallableUnit();
+ c2.setId("C");
+ c2.setVersion(new Version(2, 0, 0));
+ c2.setSingleton(true);
+ c2.setProperty(IInstallableUnitConstants.UPDATE_FROM, "C");
+ c2.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 2.3.0)");
+
+ createTestMetdataRepository(new IInstallableUnit[] {a1, c1});
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+
+ }
+
+ public void testInstallA1() {
+ assertEquals(director.install(new IInstallableUnit[] {a1}, profile, null, null).getSeverity(), IStatus.OK);
+
+ createTestMetdataRepository(new IInstallableUnit[] {a2, c2, b1});
+ Collection brokenEntryPoint = (Collection) new Oracle().canInstall(new IInstallableUnit[] {b1}, profile, null);
+ // assertNotNull(brokenEntryPoint.getProperty("entryPoint"));
+
+ new Oracle().hasUpdate(a1);
+ System.out.println(new Oracle().canInstall(new IInstallableUnit[] {b1}, (IInstallableUnit[]) brokenEntryPoint.toArray(new IInstallableUnit[brokenEntryPoint.size()]), profile, null));
+ }
+
+ public void testInstallA1bis() {
+ profile = new Profile("testInstallA1bis." + getName());
+ director = createDirector();
+ createTestMetdataRepository(new IInstallableUnit[] {a1, a2, c1, c2, b1});
+
+ assertEquals(director.install(new IInstallableUnit[] {a1}, profile, null, null).getSeverity(), IStatus.OK);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/PickerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/PickerTest.java
new file mode 100644
index 000000000..22452040c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/PickerTest.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import junit.framework.TestCase;
+import org.eclipse.equinox.internal.prov.director.Picker;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+/**
+ * Testing of the {@link Picker} class.
+ */
+public class PickerTest extends TestCase {
+ InstallableUnit unitVersion5;
+ private Picker picker;
+
+ public PickerTest() {
+ super(""); //$NON-NLS-1$
+ }
+
+ public PickerTest(String name) {
+ super(name);
+ }
+
+ private RequiredCapability[] createRequiredCapabilities(String namespace, String name, VersionRange range, String filter) {
+ return new RequiredCapability[] {new RequiredCapability(namespace, name, range, filter, false, false)};
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Version version = new Version(5, 0, 0);
+
+ //create some sample IUs to be available for the picker
+ unitVersion5 = new InstallableUnit();
+ unitVersion5.setId("required");
+ unitVersion5.setVersion(version);
+ unitVersion5.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ InstallableUnit[] units = new InstallableUnit[] {unitVersion5};
+ picker = new Picker(units, null);
+
+ }
+
+ /**
+ * Tests picking an IU that requires a capability, and the available
+ * provided capability is above the required capability's version range.
+ */
+ public void testRequiredBelowVersionRange() {
+
+ //an IU whose required capability falls outside available range
+ RequiredCapability[] required = createRequiredCapabilities("test.capability", "test", new VersionRange("[2.0,5.0)"), null);
+
+ IInstallableUnit[][] result = picker.findInstallableUnit(null, null, required, false);
+ assertEquals("1.0", 0, result[0].length + result[1].length);
+ }
+
+ /**
+ * Tests picking an IU that requires a capability, and the available
+ * provided capability is above the required capability's version range.
+ */
+ public void testRequiredWithinVersionRange() {
+
+ //in middle of range
+ RequiredCapability[] required = createRequiredCapabilities("test.capability", "test", new VersionRange("[2.0,6.0)"), null);
+ IInstallableUnit[][] result = picker.findInstallableUnit(null, null, required, false);
+ assertEquals("1.0", 1, result.length);
+ assertEquals("1.1", unitVersion5, result[0]);
+
+ //on lower bound
+ required = createRequiredCapabilities("test.capability", "test", new VersionRange("[5.0,6.0)"), null);
+ result = picker.findInstallableUnit(null, null, required, false);
+ assertEquals("1.0", 1, result[0].length + result[1].length);
+ assertEquals("1.1", unitVersion5, result[1][0]);
+
+ //on upper bound
+ required = createRequiredCapabilities("test.capability", "test", new VersionRange("[1.0,5.0]"), null);
+ result = picker.findInstallableUnit(null, null, required, false);
+ assertEquals("1.0", 1, result[0].length + result[1].length);
+ assertEquals("1.1", unitVersion5, result[1][0]);
+ }
+
+ /**
+ * Tests picking an IU that requires a capability, and the available
+ * provided capability is above the required capability's version range.
+ */
+ public void testRequiredAboveVersionRange() {
+
+ //an IU whose required capability falls outside available range
+ RequiredCapability[] required = createRequiredCapabilities("test.capability", "test", new VersionRange("[5.1,6.0)"), null);
+
+ IInstallableUnit[][] result = picker.findInstallableUnit(null, null, required, false);
+ assertEquals("1.0", 0, result[0].length + result[1].length);
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/RollbackTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/RollbackTest.java
new file mode 100644
index 000000000..cb0400878
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/RollbackTest.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import java.net.URL;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.prov.director.DirectorActivator;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.osgi.framework.Version;
+
+public class RollbackTest extends AbstractProvisioningTest {
+
+ private InstallableUnit a1;
+ private Profile profile;
+ private IDirector director;
+
+ protected void setUp() throws Exception {
+ a1 = new InstallableUnit();
+ a1.setId("A");
+ a1.setVersion(new Version(1, 0, 0));
+ a1.setSingleton(true);
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+ }
+
+ public void test() {
+ System.out.println(director.install(new IInstallableUnit[] {a1}, profile, null, new NullProgressMonitor()));
+ printProfile(profile);
+ IMetadataRepositoryManager repoMan = (IMetadataRepositoryManager) ServiceHelper.getService(TestActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ IMetadataRepository repo = null;
+ URL location = ((AgentLocation) ServiceHelper.getService(DirectorActivator.context, AgentLocation.class.getName())).getTouchpointDataArea("director");
+ repo = repoMan.getRepository(location);
+ IInstallableUnit[] ius = repo.getInstallableUnits(null);
+ for (int i = 0; i < ius.length; i++)
+ System.out.println(ius[i]);
+ director.become(ius[0], profile, new NullProgressMonitor());
+ printProfile(profile);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/SingletonTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/SingletonTest.java
new file mode 100644
index 000000000..016ce7882
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/SingletonTest.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.osgi.framework.Version;
+
+public class SingletonTest extends AbstractProvisioningTest {
+ InstallableUnit f1;
+ InstallableUnit f1_1;
+
+ InstallableUnit f2;
+ InstallableUnit f2_1;
+
+ InstallableUnit junit38;
+ InstallableUnit junit40;
+
+ IDirector director;
+ Profile profile;
+
+ protected void setUp() throws Exception {
+ f1 = new InstallableUnit();
+ f1.setId("f1");
+ f1.setVersion(new Version(1, 0, 0));
+ f1.setSingleton(true);
+
+ f1_1 = new InstallableUnit();
+ f1_1.setId("f1");
+ f1_1.setVersion(new Version(1, 1, 0));
+ f1_1.setSingleton(true);
+
+ f2 = new InstallableUnit();
+ f2.setId("f2");
+ f2.setVersion(new Version(1, 0, 0));
+ f2.setSingleton(true);
+
+ f2_1 = new InstallableUnit();
+ f2_1.setId("f2");
+ f2_1.setVersion(new Version(1, 0, 1));
+
+ junit38 = new InstallableUnit();
+ junit38.setId("junit");
+ junit38.setVersion(new Version(3, 8, 1));
+
+ junit40 = new InstallableUnit();
+ junit40.setId("junit");
+ junit40.setVersion(new Version(4, 0, 1));
+
+ createTestMetdataRepository(new IInstallableUnit[] {f1, f1_1, junit38, junit40, f2, f2_1});
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+ }
+
+ public void testMultipleVersionNonSingleton() {
+ //The installation of junit38 and junit 40 together should succeed
+ assertEquals(director.install(new IInstallableUnit[] {junit38, junit40}, profile, null, new NullProgressMonitor()).getSeverity(), IStatus.OK);
+ }
+
+ public void testMultipleVersionSingleton() {
+ //The installation of junit38 and junit 40 together should succeed
+ assertEquals(director.install(new IInstallableUnit[] {f1, f1_1}, profile, null, new NullProgressMonitor()).getSeverity(), IStatus.ERROR);
+ }
+
+ public void testMultipleVersionSingleton2() {
+ //The installation of junit38 and junit 40 together should succeed
+ assertEquals(director.install(new IInstallableUnit[] {f2, f2_1}, profile, null, new NullProgressMonitor()).getSeverity(), IStatus.ERROR);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UninstallTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UninstallTest.java
new file mode 100644
index 000000000..43a70fc70
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UninstallTest.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.osgi.framework.Version;
+
+public class UninstallTest extends AbstractProvisioningTest {
+ private InstallableUnit a1;
+ private Profile profile;
+ private IDirector director;
+
+ protected void setUp() throws Exception {
+ a1 = new InstallableUnit();
+ a1.setId("A");
+ a1.setVersion(new Version(1, 0, 0));
+ a1.setSingleton(true);
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+ }
+
+ public void testUninstall() {
+ System.out.println(director.install(new IInstallableUnit[] {a1}, profile, null, null));
+ director.uninstall(new IInstallableUnit[] {a1}, profile, null);
+ assertEmptyProfile(profile);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithEntryPoint.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithEntryPoint.java
new file mode 100644
index 000000000..b5a535bc8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithEntryPoint.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.director.Oracle;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.osgi.framework.Version;
+
+public class UpdateTestWithEntryPoint extends AbstractProvisioningTest {
+ InstallableUnit f1;
+ InstallableUnit f1_1;
+
+ IDirector director;
+ Profile profile;
+
+ protected void setUp() throws Exception {
+ f1 = new InstallableUnit();
+ f1.setId("f1");
+ f1.setVersion(new Version(1, 0, 0));
+ f1.setSingleton(true);
+
+ f1_1 = new InstallableUnit();
+ f1_1.setId("f1");
+ f1_1.setVersion(new Version(1, 1, 0));
+ f1_1.setSingleton(true);
+ f1_1.setProperty(IInstallableUnitConstants.UPDATE_FROM, "f1");
+ f1_1.setProperty(IInstallableUnitConstants.UPDATE_RANGE, "[1.0.0, 2.0.0)");
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+ createTestMetdataRepository(new IInstallableUnit[] {f1_1, f1});
+ }
+
+ public void testInstall() {
+ String entryPointName = "e1";
+ assertEquals(director.install(new IInstallableUnit[] {f1}, profile, entryPointName, new NullProgressMonitor()).getSeverity(), IStatus.OK);
+ for (Iterator iterator = profile.getInstallableUnits(); iterator.hasNext();) {
+ System.out.println(iterator.next());
+
+ }
+
+ //TODO This should return an error because we are trying to update something that would cause the entry point to be unsatisfied
+ //director.update(new IInstallableUnit[] {f1_1}, profile, new NullProgressMonitor());
+
+ IInstallableUnit toReplace = get(entryPointName, profile);
+ Collection updates = new Oracle().hasUpdate(toReplace);
+
+ director.replace(new IInstallableUnit[] {toReplace}, (IInstallableUnit[]) updates.toArray(new IInstallableUnit[updates.size()]), profile, new NullProgressMonitor());
+
+ //TODO Add a test to verify that we are not going down in the version
+ //TODO Add a test to verify that we respect the ranges
+
+ }
+
+ private IInstallableUnit get(String id, Profile p) {
+ Iterator it = profile.getInstallableUnits();
+ while (it.hasNext()) {
+ IInstallableUnit o = (IInstallableUnit) it.next();
+ if (o.getId().equals(id))
+ return o;
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithoutEntryPoint.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithoutEntryPoint.java
new file mode 100644
index 000000000..a67c5daeb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/director/UpdateTestWithoutEntryPoint.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.director;
+
+import java.util.Iterator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class UpdateTestWithoutEntryPoint extends AbstractProvisioningTest {
+ InstallableUnit f1;
+ InstallableUnit f1_1;
+ InstallableUnit f1_4;
+
+ InstallableUnit fa;
+ InstallableUnit fap;
+ IDirector director;
+ Profile profile;
+
+ protected void setUp() throws Exception {
+ f1 = new InstallableUnit();
+ f1.setId("f1");
+ f1.setVersion(new Version(1, 0, 0));
+ f1.setSingleton(true);
+
+ f1_1 = new InstallableUnit();
+ f1_1.setId("f1");
+ f1_1.setVersion(new Version(1, 1, 0));
+ f1_1.setSingleton(true);
+
+ f1_4 = new InstallableUnit();
+ f1_4.setId("f1");
+ f1_4.setVersion(new Version(1, 4, 0));
+ f1_4.setSingleton(true);
+
+ fa = new InstallableUnit();
+ fa.setId("fa");
+ fa.setVersion(new Version(1, 0, 0));
+ fa.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "f1", new VersionRange("[1.0.0, 1.3.0)"), null));
+
+ fap = new InstallableUnit();
+ fap.setId("fa");
+ fap.setVersion(new Version(1, 1, 0));
+ fap.setRequiredCapabilities(createRequiredCapabilities(IInstallableUnit.IU_NAMESPACE, "f1", new VersionRange("[1.0.0, 1.4.0)"), null));
+
+ createTestMetdataRepository(new IInstallableUnit[] {f1, fa});
+
+ profile = new Profile("TestProfile." + getName());
+ director = createDirector();
+ director.install(new IInstallableUnit[] {fa}, profile, null, null);
+
+ createTestMetdataRepository(new IInstallableUnit[] {f1_1, f1_4});
+ }
+
+ public void testInstall() {
+ assertEquals(director.install(new IInstallableUnit[] {f1_1}, profile, null, new NullProgressMonitor()).getSeverity(), IStatus.OK);
+ for (Iterator iterator = profile.getInstallableUnits(); iterator.hasNext();) {
+ System.out.println(iterator.next());
+
+ }
+ assertEquals(director.install(new IInstallableUnit[] {f1_4}, profile, null, new NullProgressMonitor()).getSeverity(), IStatus.ERROR);
+
+ // director.replace(new IInstallableUnit[] {fap}, profile, new NullProgressMonitor());
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/AllTests.java
new file mode 100644
index 000000000..77c6b26c4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/AllTests.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.download;
+
+import junit.framework.*;
+
+/**
+ * Performs all automated download manager tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(DownloadManagerTest.class);
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/DownloadManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/DownloadManagerTest.java
new file mode 100644
index 000000000..f6e579e84
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/download/DownloadManagerTest.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.download;
+
+import junit.framework.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.prov.download.DownloadManager;
+
+/**
+ * Simple tests of {@link DownloadManager} API.
+ */
+public class DownloadManagerTest extends TestCase {
+ public static Test suite() {
+ return new TestSuite(DownloadManagerTest.class);
+ }
+
+ /**
+ * Tests invocation of DownloadManager when there is nothing to download.
+ */
+ public void testEmpty() {
+ DownloadManager manager = new DownloadManager();
+ IStatus result = manager.start(null);
+ assertTrue("1.0", result.isOK());
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/AllTests.java
new file mode 100644
index 000000000..ffdbf9eb7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/AllTests.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.engine;
+
+import junit.framework.*;
+
+/**
+ * Performs all engine tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(EngineTest.class);
+ suite.addTestSuite(PhaseSetTest.class);
+ suite.addTestSuite(PhaseTest.class);
+ suite.addTestSuite(ProfileTest.class);
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/EngineTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/EngineTest.java
new file mode 100644
index 000000000..4318a8064
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/EngineTest.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.engine;
+
+import java.util.*;
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.internal.prov.metadata.ArtifactKey;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+/**
+ * Simple test of the engine API.
+ *
+ * Note:
+ * Currently you MUST have previously generated metadata from a 3.3.0 install.
+ * There are ordering dependencies for the tests temporarily
+ */
+public class EngineTest extends TestCase {
+ private ServiceReference engineRef;
+ private Engine engine;
+
+ public EngineTest(String name) {
+ super(name);
+ }
+
+ public EngineTest() {
+ super("");
+ }
+
+ protected void setUp() throws Exception {
+ engineRef = TestActivator.getContext().getServiceReference(Engine.class.getName());
+ engine = (Engine) TestActivator.getContext().getService(engineRef);
+ }
+
+ protected void tearDown() throws Exception {
+ engine = null;
+ TestActivator.getContext().ungetService(engineRef);
+ }
+
+ public void testNullProfile() {
+
+ Profile profile = null;
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = new Operand[] {};
+ try {
+ engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testNullPhaseSet() {
+
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = null;
+ Operand[] operands = new Operand[] {};
+ try {
+ engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testNullOperands() {
+
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = null;
+ try {
+ engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testEmptyOperands() {
+
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = new Operand[] {};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ }
+
+ public void testEmptyPhaseSet() {
+
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = new PhaseSet(new Phase[] {}) {
+ // empty PhaseSet
+ };
+ Operand op = new Operand(new ResolvedInstallableUnit(new InstallableUnit()), null);
+ Operand[] operands = new Operand[] {op};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ }
+
+ public void testPerformSingleNullOperand() {
+
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = new Operand[] {new Operand(null, null)};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ }
+
+ public void testPerformInstallOSGiFramework() {
+
+ Profile profile = new Profile("test");
+ profile.setValue(Profile.PROP_INSTALL_FOLDER, "c:/tmp/testProvisioning/");
+ for (Iterator it = profile.getInstallableUnits(); it.hasNext();) {
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ InstallableUnit doomed = (InstallableUnit) it.next();
+ Operand[] operands = new Operand[] {new Operand(doomed.getResolved(), null)};
+ engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ }
+ PhaseSet phaseSet = new DefaultPhaseSet();
+
+ Operand[] operands = new Operand[] {new Operand(null, createOSGiIU())};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ Iterator ius = profile.getInstallableUnits();
+ assertTrue(ius.hasNext());
+ }
+
+ public void testPerformUpdateOSGiFramework() {
+
+ Profile profile = new Profile("test");
+ profile.setValue(Profile.PROP_INSTALL_FOLDER, "c:/tmp/testProvisioning/");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = new Operand[] {new Operand(createOSGiIU(), createOSGiIU())};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ Iterator ius = profile.getInstallableUnits();
+ assertTrue(ius.hasNext());
+ }
+
+ public void testPerformUninstallOSGiFramework() {
+
+ Profile profile = new Profile("test");
+ profile.setValue(Profile.PROP_INSTALL_FOLDER, "c:/tmp/testProvisioning/");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+ Operand[] operands = new Operand[] {new Operand(createOSGiIU(), null)};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ Iterator ius = profile.getInstallableUnits();
+ assertFalse(ius.hasNext());
+ }
+
+ public void testPerformRollback() {
+
+ Profile profile = new Profile("test");
+ profile.setValue(Profile.PROP_INSTALL_FOLDER, "c:/tmp/testProvisioning/");
+ PhaseSet phaseSet = new DefaultPhaseSet();
+
+ Operand[] operands = new Operand[] {new Operand(null, createOSGiIU()), new Operand(null, createBadIU())};
+ IStatus result = engine.perform(profile, phaseSet, operands, new NullProgressMonitor());
+ assertFalse(result.isOK());
+ Iterator ius = profile.getInstallableUnits();
+ assertFalse(ius.hasNext());
+ }
+
+ private IResolvedInstallableUnit createOSGiIU() {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId("org.eclipse.osgi");
+ iu.setVersion(new Version("3.3.0.v20070530"));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version("1.0.0")));
+ Map touchpointData = new HashMap();
+ String manifest = "Manifest-Version: 1.0\r\n" + "Bundle-Activator: org.eclipse.osgi.framework.internal.core.SystemBundl\r\n" + " eActivator\r\n" + "Bundle-RequiredExecutionEnvironment: J2SE-1.4,OSGi/Minimum-1.0\r\n" + "Export-Package: org.eclipse.osgi.event;version=\"1.0\",org.eclipse.osgi.\r\n" + " framework.console;version=\"1.0\",org.eclipse.osgi.framework.eventmgr;v\r\n" + " ersion=\"1.0\",org.eclipse.osgi.framework.log;version=\"1.0\",org.eclipse\r\n" + " .osgi.service.datalocation;version=\"1.0\",org.eclipse.osgi.service.deb\r\n" + " ug;version=\"1.0\",org.eclipse.osgi.service.environment;version=\"1.0\",o\r\n" + " rg.eclipse.osgi.service.localization;version=\"1.0\",org.eclipse.osgi.s\r\n" + " ervice.pluginconversion;version=\"1.0\",org.eclipse.osgi.service.resolv\r\n"
+ + " er;version=\"1.1\",org.eclipse.osgi.service.runnable;version=\"1.0\",org.\r\n" + " eclipse.osgi.service.urlconversion;version=\"1.0\",org.eclipse.osgi.sto\r\n" + " ragemanager;version=\"1.0\",org.eclipse.osgi.util;version=\"1.0\",org.osg\r\n" + " i.framework;version=\"1.3\",org.osgi.service.condpermadmin;version=\"1.0\r\n" + " \",org.osgi.service.packageadmin;version=\"1.2\",org.osgi.service.permis\r\n" + " sionadmin;version=\"1.2\",org.osgi.service.startlevel;version=\"1.0\",org\r\n" + " .osgi.service.url;version=\"1.0\",org.osgi.util.tracker;version=\"1.3.2\"\r\n" + " ,org.eclipse.core.runtime.adaptor;x-friends:=\"org.eclipse.core.runtim\r\n" + " e\",org.eclipse.core.runtime.internal.adaptor;x-internal:=true,org.ecl\r\n"
+ + " ipse.core.runtime.internal.stats;x-friends:=\"org.eclipse.core.runtime\r\n" + " \",org.eclipse.osgi.baseadaptor;x-internal:=true,org.eclipse.osgi.base\r\n" + " adaptor.bundlefile;x-internal:=true,org.eclipse.osgi.baseadaptor.hook\r\n" + " s;x-internal:=true,org.eclipse.osgi.baseadaptor.loader;x-internal:=tr\r\n" + " ue,org.eclipse.osgi.framework.adaptor;x-internal:=true,org.eclipse.os\r\n" + " gi.framework.debug;x-internal:=true,org.eclipse.osgi.framework.intern\r\n" + " al.core;x-internal:=true,org.eclipse.osgi.framework.internal.protocol\r\n" + " ;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.bundle\r\n" + " entry;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.b\r\n"
+ + " undleresource;x-internal:=true,org.eclipse.osgi.framework.internal.pr\r\n" + " otocol.reference;x-internal:=true,org.eclipse.osgi.framework.internal\r\n" + " .reliablefile;x-internal:=true,org.eclipse.osgi.framework.launcher;x-\r\n" + " internal:=true,org.eclipse.osgi.framework.util;x-internal:=true,org.e\r\n" + " clipse.osgi.internal.baseadaptor;x-internal:=true,org.eclipse.osgi.in\r\n" + " ternal.module;x-internal:=true,org.eclipse.osgi.internal.profile;x-in\r\n" + " ternal:=true,org.eclipse.osgi.internal.resolver;x-internal:=true,org.\r\n" + " eclipse.osgi.internal.verifier;x-internal:=true,org.eclipse.osgi.inte\r\n" + " rnal.provisional.verifier;x-friends:=\"org.eclipse.update.core,org.ecl\r\n" + " ipse.ui.workbench\"\r\n" + "Bundle-Version: 3.3.0.v20060925\r\n"
+ + "Eclipse-SystemBundle: true\r\n" + "Bundle-Copyright: %copyright\r\n" + "Bundle-Name: %systemBundle\r\n" + "Bundle-Description: %systemBundle\r\n" + "Bundle-DocUrl: http://www.eclipse.org\r\n" + "Bundle-ManifestVersion: 2\r\n" + "Export-Service: org.osgi.service.packageadmin.PackageAdmin,org.osgi.se\r\n" + " rvice.permissionadmin.PermissionAdmin,org.osgi.service.startlevel.Sta\r\n" + " rtLevel,org.eclipse.osgi.service.debug.DebugOptions\r\n" + "Bundle-Vendor: %eclipse.org\r\n" + "Main-Class: org.eclipse.core.runtime.adaptor.EclipseStarter\r\n" + "Bundle-SymbolicName: org.eclipse.osgi; singleton:=true\r\n" + "Bundle-Localization: systembundle\r\n" + "Eclipse-ExtensibleAPI: true\r\n" + "\r\n" + "";
+ touchpointData.put("manifest", manifest);
+ touchpointData.put("configurationData", "manipulator.getConfigData().addBundle(bundleToInstall);bundleToInstall.setMarkedAsStarted(true);");
+ touchpointData.put("unconfigurationData", "bundleToRemove.setMarkedAsStarted(false);manipulator.getConfigData().removeBundle(bundleToRemove);");
+
+ IResolvedInstallableUnit[] cus = new IResolvedInstallableUnit[1];
+ InstallableUnitFragment tmp = new InstallableUnitFragment();
+ tmp.setImmutableTouchpointData(new TouchpointData(touchpointData));
+ cus[0] = tmp.getResolved();
+
+ IArtifactKey key = new ArtifactKey("eclipse", "plugin", "org.eclipse.osgi", new Version("3.3.0.v20070530"));
+ iu.setArtifacts(new IArtifactKey[] {key});
+
+ ResolvedInstallableUnit result = (ResolvedInstallableUnit) iu.getResolved();
+ result.setFragments(cus);
+
+ return result;
+ }
+
+ private IResolvedInstallableUnit createBadIU() {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId("org.eclipse.osgi.bad");
+ iu.setVersion(new Version("3.3.0.v20070530"));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version("1.0.0")));
+ Map touchpointData = new HashMap();
+ String manifest = "Manifest-Version: 1.0\r\n" + "Bundle-Activator: org.eclipse.osgi.framework.internal.core.SystemBundl\r\n" + " eActivator\r\n" + "Bundle-RequiredExecutionEnvironment: J2SE-1.4,OSGi/Minimum-1.0\r\n" + "Export-Package: org.eclipse.osgi.event;version=\"1.0\",org.eclipse.osgi.\r\n" + " framework.console;version=\"1.0\",org.eclipse.osgi.framework.eventmgr;v\r\n" + " ersion=\"1.0\",org.eclipse.osgi.framework.log;version=\"1.0\",org.eclipse\r\n" + " .osgi.service.datalocation;version=\"1.0\",org.eclipse.osgi.service.deb\r\n" + " ug;version=\"1.0\",org.eclipse.osgi.service.environment;version=\"1.0\",o\r\n" + " rg.eclipse.osgi.service.localization;version=\"1.0\",org.eclipse.osgi.s\r\n" + " ervice.pluginconversion;version=\"1.0\",org.eclipse.osgi.service.resolv\r\n"
+ + " er;version=\"1.1\",org.eclipse.osgi.service.runnable;version=\"1.0\",org.\r\n" + " eclipse.osgi.service.urlconversion;version=\"1.0\",org.eclipse.osgi.sto\r\n" + " ragemanager;version=\"1.0\",org.eclipse.osgi.util;version=\"1.0\",org.osg\r\n" + " i.framework;version=\"1.3\",org.osgi.service.condpermadmin;version=\"1.0\r\n" + " \",org.osgi.service.packageadmin;version=\"1.2\",org.osgi.service.permis\r\n" + " sionadmin;version=\"1.2\",org.osgi.service.startlevel;version=\"1.0\",org\r\n" + " .osgi.service.url;version=\"1.0\",org.osgi.util.tracker;version=\"1.3.2\"\r\n" + " ,org.eclipse.core.runtime.adaptor;x-friends:=\"org.eclipse.core.runtim\r\n" + " e\",org.eclipse.core.runtime.internal.adaptor;x-internal:=true,org.ecl\r\n"
+ + " ipse.core.runtime.internal.stats;x-friends:=\"org.eclipse.core.runtime\r\n" + " \",org.eclipse.osgi.baseadaptor;x-internal:=true,org.eclipse.osgi.base\r\n" + " adaptor.bundlefile;x-internal:=true,org.eclipse.osgi.baseadaptor.hook\r\n" + " s;x-internal:=true,org.eclipse.osgi.baseadaptor.loader;x-internal:=tr\r\n" + " ue,org.eclipse.osgi.framework.adaptor;x-internal:=true,org.eclipse.os\r\n" + " gi.framework.debug;x-internal:=true,org.eclipse.osgi.framework.intern\r\n" + " al.core;x-internal:=true,org.eclipse.osgi.framework.internal.protocol\r\n" + " ;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.bundle\r\n" + " entry;x-internal:=true,org.eclipse.osgi.framework.internal.protocol.b\r\n"
+ + " undleresource;x-internal:=true,org.eclipse.osgi.framework.internal.pr\r\n" + " otocol.reference;x-internal:=true,org.eclipse.osgi.framework.internal\r\n" + " .reliablefile;x-internal:=true,org.eclipse.osgi.framework.launcher;x-\r\n" + " internal:=true,org.eclipse.osgi.framework.util;x-internal:=true,org.e\r\n" + " clipse.osgi.internal.baseadaptor;x-internal:=true,org.eclipse.osgi.in\r\n" + " ternal.module;x-internal:=true,org.eclipse.osgi.internal.profile;x-in\r\n" + " ternal:=true,org.eclipse.osgi.internal.resolver;x-internal:=true,org.\r\n" + " eclipse.osgi.internal.verifier;x-internal:=true,org.eclipse.osgi.inte\r\n" + " rnal.provisional.verifier;x-friends:=\"org.eclipse.update.core,org.ecl\r\n" + " ipse.ui.workbench\"\r\n" + "Bundle-Version: 3.3.0.v20060925\r\n"
+ + "Eclipse-SystemBundle: true\r\n" + "Bundle-Copyright: %copyright\r\n" + "Bundle-Name: %systemBundle\r\n" + "Bundle-Description: %systemBundle\r\n" + "Bundle-DocUrl: http://www.eclipse.org\r\n" + "Bundle-ManifestVersion: 2\r\n" + "Export-Service: org.osgi.service.packageadmin.PackageAdmin,org.osgi.se\r\n" + " rvice.permissionadmin.PermissionAdmin,org.osgi.service.startlevel.Sta\r\n" + " rtLevel,org.eclipse.osgi.service.debug.DebugOptions\r\n" + "Bundle-Vendor: %eclipse.org\r\n" + "Main-Class: org.eclipse.core.runtime.adaptor.EclipseStarter\r\n" + "Bundle-SymbolicName: org.eclipse.osgi; singleton:=true\r\n" + "Bundle-Localization: systembundle\r\n" + "Eclipse-ExtensibleAPI: true\r\n" + "\r\n" + "";
+ touchpointData.put("manifest", manifest);
+ touchpointData.put("configurationData", "BAD");
+
+ IResolvedInstallableUnit[] cus = new IResolvedInstallableUnit[1];
+ InstallableUnitFragment tmp = new InstallableUnitFragment();
+ tmp.setImmutableTouchpointData(new TouchpointData(touchpointData));
+ cus[0] = tmp.getResolved();
+
+ IArtifactKey key = new ArtifactKey("eclipse", "plugin", "org.eclipse.osgi", new Version("3.3.0.v20070530"));
+ iu.setArtifacts(new IArtifactKey[] {key});
+
+ ResolvedInstallableUnit result = (ResolvedInstallableUnit) iu.getResolved();
+ result.setFragments(cus);
+
+ return result;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseSetTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseSetTest.java
new file mode 100644
index 000000000..c9ee4556b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseSetTest.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.engine;
+
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.engine.*;
+import org.eclipse.equinox.prov.metadata.InstallableUnit;
+import org.eclipse.equinox.prov.metadata.ResolvedInstallableUnit;
+
+/**
+ * Simple test of the engine API.
+ */
+public class PhaseSetTest extends TestCase {
+ public PhaseSetTest(String name) {
+ super(name);
+ }
+
+ public PhaseSetTest() {
+ super("");
+ }
+
+ public void testNullPhases() {
+ try {
+ new PhaseSet(null) {
+ // empty PhaseSet
+ };
+ } catch (IllegalArgumentException exepcted) {
+ return;
+ }
+ fail();
+ }
+
+ public void testEmptyPhases() {
+ Profile profile = new Profile("test");
+ PhaseSet phaseSet = new PhaseSet(new Phase[] {}) {
+ // empty PhaseSet
+ };
+ Operand op = new Operand(new ResolvedInstallableUnit(new InstallableUnit()), null);
+ Operand[] operands = new Operand[] {op};
+
+ IStatus result = phaseSet.perform(new EngineSession(), profile, operands, new NullProgressMonitor());
+ assertTrue(result.isOK());
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseTest.java
new file mode 100644
index 000000000..3c76faf39
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/PhaseTest.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.engine;
+
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.prov.core.helpers.MultiStatus;
+import org.eclipse.equinox.prov.engine.*;
+
+/**
+ * Simple test of the engine API.
+ */
+public class PhaseTest extends TestCase {
+ public PhaseTest(String name) {
+ super(name);
+ }
+
+ public PhaseTest() {
+ super("");
+ }
+
+ public void testNullPhaseId() {
+ try {
+ new TestPhase(null, 1, "xyz");
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testEmptyPhaseId() {
+ try {
+ new TestPhase("", 1, "xyz");
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testNegativeWeight() {
+ try {
+ new TestPhase("xyz", -1, "xyz");
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testZeroWeight() {
+ try {
+ new TestPhase("xyz", 0, "xyz");
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testNullPhaseName() {
+ try {
+ new TestPhase("xyz", 1, null);
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public void testEmptyPhaseName() {
+ try {
+ new TestPhase("xyz", 1, "");
+ } catch (IllegalArgumentException expected) {
+ return;
+ }
+ fail();
+ }
+
+ public static class TestPhase extends Phase {
+
+ protected TestPhase(String phaseId, int weight, String phaseName) {
+ super(phaseId, weight, phaseName);
+ }
+
+ protected void perform(MultiStatus status, EngineSession session, Profile profile, Operand[] deltas, IProgressMonitor monitor) {
+ //empty
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/ProfileTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/ProfileTest.java
new file mode 100644
index 000000000..77be6d95c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/engine/ProfileTest.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.engine;
+
+import junit.framework.TestCase;
+import org.eclipse.equinox.prov.engine.Profile;
+
+/**
+ * Simple test of the engine API.
+ */
+public class ProfileTest extends TestCase {
+ public ProfileTest(String name) {
+ super(name);
+ }
+
+ public ProfileTest() {
+ super("");
+ }
+
+ public void testNullProfile() {
+ try {
+ new Profile(null);
+ } catch (IllegalArgumentException exepcted) {
+ return;
+ }
+ fail();
+ }
+
+ public void testEmptyProfile() {
+ try {
+ new Profile("");
+ } catch (IllegalArgumentException exepcted) {
+ return;
+ }
+ fail();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/DirectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/DirectorTest.java
new file mode 100644
index 000000000..c6441182e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/DirectorTest.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.full;
+
+import java.util.Collection;
+import java.util.Iterator;
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.prov.core.helpers.*;
+import org.eclipse.equinox.prov.core.location.AgentLocation;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.IResolvedInstallableUnit;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.eclipse.osgi.service.environment.EnvironmentInfo;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * This test installs or uninstalls the IU defined by the property "eclipse.prov.autoInstall".
+ * Metadata for the IUs to install must be generated separately before running this test.
+ */
+public class DirectorTest extends TestCase {
+
+ public void testInstallIU() {
+ ServiceReference sr = TestActivator.context.getServiceReference(IDirector.class.getName());
+ if (sr == null) {
+ throw new RuntimeException("Director service not available");
+ }
+ IDirector director = (IDirector) TestActivator.context.getService(sr);
+ if (director == null) {
+ throw new RuntimeException("Director could not be loaded");
+ }
+
+ ServiceReference sr2 = TestActivator.context.getServiceReference(IMetadataRepositoryManager.class.getName());
+ IMetadataRepositoryManager mgr = (IMetadataRepositoryManager) TestActivator.context.getService(sr2);
+ if (mgr == null) {
+ throw new RuntimeException("Repository manager could not be loaded");
+ }
+
+ IMetadataRepository[] repos = mgr.getKnownRepositories();
+ TwoTierMap allIUs = new TwoTierMap();
+ for (int i = 0; i < repos.length; i++) {
+ IInstallableUnit[] ius = repos[i].getInstallableUnits(null);
+ for (int j = 0; j < ius.length; j++) {
+ allIUs.put(ius[j].getId(), ius[j].getVersion(), ius[j]);
+ }
+ }
+
+ String installFolder = System.getProperty(Profile.PROP_INSTALL_FOLDER);
+ ServiceReference profileRegSr = TestActivator.context.getServiceReference(IProfileRegistry.class.getName());
+ IProfileRegistry profileRegistry = (IProfileRegistry) TestActivator.context.getService(profileRegSr);
+ if (profileRegistry == null) {
+ throw new RuntimeException("Profile registry service not available");
+ }
+
+ String profileId = installFolder;
+ String newFlavor = System.getProperty("eclipse.prov.configurationFlavor");
+ boolean doUninstall = (Boolean.TRUE.equals(Boolean.valueOf(System.getProperty("eclipse.prov.doUninstall"))));
+
+ Profile p = profileRegistry.getProfile(profileId);
+ if (p == null) {
+ if (doUninstall) {
+ throw new RuntimeException("Uninstalling from a nonexistent profile");
+ }
+ p = new Profile(installFolder); //Typically a profile would receive a name.
+ p.setValue(Profile.PROP_INSTALL_FOLDER, installFolder);
+ p.setValue(Profile.PROP_FLAVOR, newFlavor);
+ // TODO: should we add the profile to the registry here? instead of after test?
+ } else {
+ String currentFlavor = p.getValue(Profile.PROP_FLAVOR);
+ if (currentFlavor != null && !currentFlavor.endsWith(newFlavor)) {
+ throw new RuntimeException("Install flavor not consistent with profile flavor");
+ } else if (currentFlavor == null) {
+ p.setValue(Profile.PROP_FLAVOR, newFlavor);
+ }
+ }
+
+ EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class.getName());
+ if (info != null)
+ p.setValue(Profile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch());
+
+ IInstallableUnit[] allRoots = new IInstallableUnit[1];
+ Collection allJobs = allIUs.getAll(System.getProperty("eclipse.prov.autoInstall"));
+ IStatus operationStatus = null;
+ if (allJobs.size() != 0) {
+ allRoots[0] = (IInstallableUnit) allJobs.iterator().next();
+ if (!doUninstall) {
+ operationStatus = director.install(allRoots, p, null, new NullProgressMonitor());
+ } else {
+ operationStatus = director.uninstall(allRoots, p, new NullProgressMonitor());
+ }
+ } else {
+ operationStatus = new Status(IStatus.INFO, "org.eclipse.equinox.prov.director.test", "The installable unit '" + System.getProperty("eclipse.prov.autoInstall") + "' has not been found");
+ }
+
+ if (operationStatus.isOK()) {
+ System.out.println((!doUninstall ? "installation" : "uninstallation") + " complete");
+ if (profileRegistry.getProfile(p.getProfileId()) == null) {
+ profileRegistry.addProfile(p);
+ } else {
+ // TODO: should delete the profile if it is 'empty'
+ // if (p.isEmpty()) {
+ // profileRegistry.removeProfile(p);
+ // }
+ }
+ } else {
+ System.out.println((!doUninstall ? "installation" : "uninstallation") + " failed. " + operationStatus);
+ LogHelper.log(operationStatus);
+ }
+ if (!operationStatus.isOK())
+ fail("The installation has failed");
+
+ IInstallableUnit[] result = p.query(allRoots[0].getId(), null, null, false, null);
+ assertEquals(result.length, (!doUninstall ? 1 : 0));
+ result = p.query("toolingdefault", null, null, false, null);
+
+ ensureFragmentAssociationIsNotPersisted(mgr);
+ }
+
+ private void ensureFragmentAssociationIsNotPersisted(IMetadataRepositoryManager mgr) {
+ //Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=177661
+ AgentLocation location = (AgentLocation) ServiceHelper.getService(TestActivator.getContext(), AgentLocation.class.getName());
+ mgr.removeRepository(mgr.getRepository(location.getMetadataRepositoryURL()));
+ IMetadataRepository repo = null;
+ repo = mgr.loadRepository(location.getMetadataRepositoryURL(), null);
+ Iterator it = repo.getIterator("org.eclipse.equinox.simpleconfigurator", null, null, false);
+ if (!it.hasNext())
+ return;
+ IInstallableUnit sc = (IInstallableUnit) it.next();
+ if (sc instanceof IResolvedInstallableUnit)
+ fail("The repository should not store resolved installable units");
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/End2EndTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/End2EndTest.java
new file mode 100644
index 000000000..d3e23507d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/full/End2EndTest.java
@@ -0,0 +1,248 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.full;
+
+import java.util.*;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.equinox.prov.core.helpers.ServiceHelper;
+import org.eclipse.equinox.prov.director.IDirector;
+import org.eclipse.equinox.prov.director.Oracle;
+import org.eclipse.equinox.prov.engine.IProfileRegistry;
+import org.eclipse.equinox.prov.engine.Profile;
+import org.eclipse.equinox.prov.metadata.IInstallableUnit;
+import org.eclipse.equinox.prov.metadata.IInstallableUnitConstants;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.eclipse.osgi.service.environment.EnvironmentInfo;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+public class End2EndTest extends AbstractProvisioningTest {
+
+ private IMetadataRepository[] repos;
+ private IDirector director;
+
+ protected void setUp() throws Exception {
+ ServiceReference sr = TestActivator.context.getServiceReference(IDirector.class.getName());
+ if (sr == null) {
+ throw new RuntimeException("Director service not available");
+ }
+ director = createDirector();
+ ServiceReference sr2 = TestActivator.context.getServiceReference(IMetadataRepositoryManager.class.getName());
+ IMetadataRepositoryManager mgr = (IMetadataRepositoryManager) TestActivator.context.getService(sr2);
+ if (mgr == null) {
+ throw new RuntimeException("Repository manager could not be loaded");
+ }
+ repos = mgr.getKnownRepositories();
+ }
+
+ private Profile createProfile(String profileId) {
+ String installFolder = System.getProperty(Profile.PROP_INSTALL_FOLDER);
+ ServiceReference profileRegSr = TestActivator.context.getServiceReference(IProfileRegistry.class.getName());
+ IProfileRegistry profileRegistry = (IProfileRegistry) TestActivator.context.getService(profileRegSr);
+ if (profileRegistry == null) {
+ throw new RuntimeException("Profile registry service not available");
+ }
+
+ String newFlavor = System.getProperty("eclipse.prov.configurationFlavor");
+ boolean doUninstall = (Boolean.TRUE.equals(Boolean.valueOf(System.getProperty("eclipse.prov.doUninstall"))));
+
+ Profile profile1 = profileRegistry.getProfile(profileId);
+ if (profile1 == null) {
+ if (doUninstall) {
+ throw new RuntimeException("Uninstalling from a nonexistent profile");
+ }
+ profile1 = new Profile(profileId); //Typically a profile would receive a name.
+ profile1.setValue(Profile.PROP_INSTALL_FOLDER, installFolder + '/' + profileId);
+ profile1.setValue(Profile.PROP_FLAVOR, newFlavor);
+ // TODO: should we add the profile to the registry here? instead of after test?
+ } else {
+ String currentFlavor = profile1.getValue(Profile.PROP_FLAVOR);
+ if (currentFlavor != null && !currentFlavor.endsWith(newFlavor)) {
+ throw new RuntimeException("Install flavor not consistent with profile flavor");
+ } else if (currentFlavor == null) {
+ profile1.setValue(Profile.PROP_FLAVOR, newFlavor);
+ }
+ }
+
+ EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(TestActivator.getContext(), EnvironmentInfo.class.getName());
+ if (info != null)
+ profile1.setValue(Profile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch());
+
+ return profile1;
+ }
+
+ private Collection extractIUs(Profile p) {
+ Collection result = new HashSet();
+ Iterator it = p.getInstallableUnits();
+ while (it.hasNext()) {
+ result.add(it.next());
+ }
+ return result;
+ }
+
+ public void testInstallSDKWithEntryPoint() {
+ Profile profile1 = createProfile("profile1");
+ //First we install the sdk
+ IStatus s = director.install(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile1, "entryPoint1", new NullProgressMonitor());
+ assertOK(s);
+ Collection iusInstalled = extractIUs(profile1);
+ IInstallableUnit firstSnapshot = getIU("profile1"); //This should represent the empty profile
+ assertNotNull(firstSnapshot);
+ assertNotNull(firstSnapshot.getProperty("profileIU"));
+ IInstallableUnit firstEntryPoint = null;
+ try {
+ firstEntryPoint = getIU(IInstallableUnitConstants.ENTRYPOINT_IU_KEY, "true")[0];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ fail("We expect to find an entry point");
+ }
+
+ //The uninstallation should not work since there is an entyr point
+ s = director.uninstall(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile1, new NullProgressMonitor());
+ assertNotOK(s);
+
+ //The uninstallation of the entry point should lead to an empty profile
+ s = director.uninstall(new IInstallableUnit[] {firstEntryPoint}, profile1, new NullProgressMonitor());
+ assertOK(s);
+
+ assertEmptyProfile(profile1);
+ IInstallableUnit[] snapshots = getIUs("profile1");
+ assertEquals(2, snapshots.length);
+ assertEquals(false, profile1.getIterator("sdk", VersionRange.emptyRange, null, false).hasNext());
+
+ // Now test the rollback to a previous state, in this case we reinstall the SDK
+ s = director.become(snapshots[0].equals(firstSnapshot) ? snapshots[1] : snapshots[0], profile1, new NullProgressMonitor());
+ if (!s.isOK())
+ fail("The become operation failed");
+
+ assertNotNull(getIU("sdk"));
+ assertEquals(firstEntryPoint, getIU(firstEntryPoint.getId()));
+ Collection afterRollback = extractIUs(profile1);
+
+ //Verify that the rollback brought back everything we had
+ Collection iusInstalledCopy = new HashSet(iusInstalled);
+ iusInstalled.removeAll(afterRollback);
+ afterRollback.removeAll(iusInstalledCopy);
+ assertEquals(0, iusInstalled.size());
+ assertEquals(0, afterRollback.size());
+
+ //Now update for the SDK itself
+ Collection snapshotsBeforeUpdate = Arrays.asList(getIUs("profile1"));
+ assertEquals(1, new Oracle().hasUpdate(getIU("sdk", new Version("3.3.0"))).size());
+ s = director.replace(new IInstallableUnit[] {firstEntryPoint}, new IInstallableUnit[] {(IInstallableUnit) new Oracle().hasUpdate(getIU("sdk", new Version("3.3.0"))).iterator().next()}, profile1, new NullProgressMonitor());
+ assertOK(s);
+ assertProfileContainsAll("", profile1, new IInstallableUnit[] {getIU("sdk", new Version("3.4.0"))});
+ Collection snapsshotsAfterUpdate = new ArrayList(Arrays.asList(getIUs("profile1")));
+ snapsshotsAfterUpdate.removeAll(snapshotsBeforeUpdate);
+ IInstallableUnit former = (IInstallableUnit) snapsshotsAfterUpdate.iterator().next();
+
+ //Now come back to a 3.3 install
+ s = director.become(former, profile1, new NullProgressMonitor());
+ assertOK(s);
+
+ //Test replace the sdk 3.3 entry point with 3.4
+ assertEquals(1, new Oracle().hasUpdate(firstEntryPoint).size());
+ s = director.replace(new IInstallableUnit[] {firstEntryPoint}, new IInstallableUnit[] {(IInstallableUnit) new Oracle().hasUpdate(firstEntryPoint).iterator().next()}, profile1, new NullProgressMonitor());
+ assertOK(s);
+ assertProfileContainsAll("", profile1, new IInstallableUnit[] {getIU("sdk", new Version("3.4.0"))});
+ assertNotIUs(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile1.getInstallableUnits());
+
+ //Remove everything from the profile by becoming an empty profile
+ s = director.become(firstSnapshot, profile1, new NullProgressMonitor());
+ assertOK(s);
+ // assertEmptyProfile(profile1);
+ }
+
+ public void testInstallSDK() {
+ Profile profile2 = createProfile("profile2");
+ //First we install the sdk
+ IStatus s = director.install(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile2, null, new NullProgressMonitor());
+ if (!s.isOK())
+ fail("Installation failed");
+ IInstallableUnit firstSnapshot = getIU("profile2"); //This should represent the empty profile
+ assertNotNull(firstSnapshot);
+ assertNotNull(firstSnapshot.getProperty("profileIU"));
+
+ //Uninstall the SDK
+ s = director.uninstall(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile2, new NullProgressMonitor());
+ if (!s.isOK())
+ fail("The uninstallation has failed and it was not expected");
+
+ assertEquals(false, profile2.getInstallableUnits().hasNext()); //the profile should be empty since we uninstalled everything
+ IInstallableUnit[] snapshots = getIUs("profile2");
+ assertTrue("snap" + snapshots.length, snapshots.length >= 2);//TODO Normally here it should be 2!!!
+ assertEquals(false, profile2.getIterator("sdk", VersionRange.emptyRange, null, false).hasNext());
+
+ // Now test the rollback to a previous state, in this case we reinstall the SDK
+ s = director.become(snapshots[0].equals(firstSnapshot) ? snapshots[1] : snapshots[0], profile2, new NullProgressMonitor());
+ if (!s.isOK())
+ fail("The become operation failed");
+
+ assertNotNull(getIU("sdk"));
+
+ //Test replace
+ s = director.replace(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, new IInstallableUnit[] {getIU("sdk", new Version("3.4.0"))}, profile2, new NullProgressMonitor());
+ assertOK(s);
+ assertProfileContainsAll("", profile2, new IInstallableUnit[] {getIU("sdk", new Version("3.4.0"))});
+ assertNotIUs(new IInstallableUnit[] {getIU("sdk", new Version("3.3.0"))}, profile2.getInstallableUnits());
+
+ //Remove everything from the profile by becoming an empty profile
+ s = director.become(firstSnapshot, profile2, new NullProgressMonitor());
+ assertOK(s);
+ // assertEmptyProfile(profile2);
+ }
+
+ public IInstallableUnit[] getIU(String property, String value) {
+ Collection result = new ArrayList();
+ for (int i = 0; i < repos.length; i++) {
+ IInstallableUnit[] ius = repos[i].getInstallableUnits(null);
+ for (int j = 0; j < ius.length; j++) {
+ String v = ius[j].getProperty(property);
+ if (v != null && v.equals(value))
+ result.add(ius[j]);
+ }
+ }
+ return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]);
+ }
+
+ public IInstallableUnit[] getIUs(String id) {
+ Collection result = new ArrayList();
+ for (int i = 0; i < repos.length; i++) {
+ Iterator it = repos[i].getIterator(id, VersionRange.emptyRange, null, false);
+ while (it.hasNext()) {
+ result.add(it.next());
+ }
+ }
+ return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]);
+ }
+
+ public IInstallableUnit getIU(String id) {
+ for (int i = 0; i < repos.length; i++) {
+ Iterator it = repos[i].getIterator(id, VersionRange.emptyRange, null, false);
+ while (it.hasNext()) {
+ return (IInstallableUnit) it.next();
+ }
+ }
+ return null;
+ }
+
+ public IInstallableUnit getIU(String id, Version v) {
+ for (int i = 0; i < repos.length; i++) {
+ Iterator it = repos[i].getIterator(id, new VersionRange("[" + v.toString() + "," + v.toString() + "]"), null, false);
+ while (it.hasNext()) {
+ return (IInstallableUnit) it.next();
+ }
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/AllTests.java
new file mode 100644
index 000000000..4a6c0b4b1
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/AllTests.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import junit.framework.*;
+
+/**
+ * Performs all metadata tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(FragmentMethodTest.class);
+ suite.addTestSuite(FragmentTest.class);
+ suite.addTestSuite(MultipleIUAndFragmentTest.class);
+ suite.addTestSuite(RecommendationTest.class);
+ suite.addTestSuite(ResolutionHelperTest.class);
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentMethodTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentMethodTest.java
new file mode 100644
index 000000000..4e8613c1a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentMethodTest.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import java.util.*;
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class FragmentMethodTest extends TestCase {
+ private static final String PROP_FRAG = "propFrag";
+ private static final String PROP_IU = "propIU";
+ private static final String TEST_REQUIRED = "testRequired";
+ IInstallableUnit iu1;
+ IInstallableUnit iu3;
+ RequiredCapability[] iu1Deps;
+ RequiredCapability[] iu3Deps;
+ ProvidedCapability[] iu1Caps;
+ ProvidedCapability[] iu3Caps;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ iu1 = createIU("iu.test1");
+ iu3 = createIUFragment("iu.fragment");
+ iu1Caps = iu1.getProvidedCapabilities();
+ iu3Caps = iu3.getProvidedCapabilities();
+ iu1Deps = iu1.getRequiredCapabilities();
+ iu3Deps = iu3.getRequiredCapabilities();
+ HashSet hash = new HashSet();
+ hash.add(iu1);
+ hash.add(iu3);
+ Collection result = new ResolutionHelper(new Hashtable(), null).attachCUs(hash);
+ for (Iterator iterator = result.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit iu = (IResolvedInstallableUnit) iterator.next();
+ if (iu.getId().equals(iu1.getId()))
+ iu1 = iu;
+ if (iu.getId().equals(iu3.getId()))
+ iu3 = iu;
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ iu1 = null;
+ iu3 = null;
+ iu1Deps = null;
+ iu3Deps = null;
+ iu1Caps = null;
+ iu3Caps = null;
+ super.tearDown();
+ }
+
+ public void testCapabilities() {
+ ProvidedCapability[] iuCapabilities = iu1Caps;
+ ProvidedCapability[] initialFragmentCapabilities = iu3Caps;
+
+ ProvidedCapability[] mergedCapabilities = iu1.getProvidedCapabilities();
+ for (int i = 0; i < iuCapabilities.length; i++) {
+ FragmentTest.assertContainsWithEquals(mergedCapabilities, iuCapabilities[i]);
+ }
+
+ //The fragment capability is not listed in the capabilities
+ assertDoesNotContain(mergedCapabilities, InstallableUnitFragment.FRAGMENT_CAPABILITY);
+
+ //The fragment does not contain iu namespace
+ for (int i = 0; i < initialFragmentCapabilities.length; i++) {
+ if (initialFragmentCapabilities[i].getNamespace().equals(IInstallableUnit.IU_NAMESPACE)) {
+ assertDoesNotContain(mergedCapabilities, initialFragmentCapabilities[i]);
+ break;
+ }
+ }
+
+ assertEquals("The fragment capabilities should not change", initialFragmentCapabilities, iu3.getProvidedCapabilities(), false);
+ }
+
+ protected void assertEquals(String message, Object[] expected, Object[] actual) {
+ if (expected == null && actual == null)
+ return;
+ if (expected == null || actual == null)
+ fail(message);
+ if (expected.length != actual.length)
+ fail(message);
+ for (int i = 0; i < expected.length; i++)
+ assertEquals(message, expected[i], actual[i]);
+ }
+
+ protected void assertEquals(String message, Object[] expected, Object[] actual, boolean orderImportant) {
+ // if the order in the array must match exactly, then call the other method
+ if (orderImportant) {
+ assertEquals(message, expected, actual);
+ return;
+ }
+ // otherwise use this method and check that the arrays are equal in any order
+ if (expected == null && actual == null)
+ return;
+ if (expected == actual)
+ return;
+ if (expected == null || actual == null)
+ assertTrue(message + ".1", false);
+ if (expected.length != actual.length)
+ assertTrue(message + ".2", false);
+ boolean[] found = new boolean[expected.length];
+ for (int i = 0; i < expected.length; i++) {
+ for (int j = 0; j < expected.length; j++) {
+ if (!found[j] && expected[i].equals(actual[j]))
+ found[j] = true;
+ }
+ }
+ for (int i = 0; i < found.length; i++)
+ if (!found[i])
+ assertTrue(message + ".3." + i, false);
+ }
+
+ public static void assertDoesNotContain(Object[] objects, Object searched) {
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i].equals(searched))
+ throw new AssertionFailedError("The array should not contain the searched element");
+ }
+ }
+
+ public void testDependencies() {
+ RequiredCapability[] iuDependencies = iu1Deps;
+ RequiredCapability[] initialFragmentDependencies = iu3Deps;
+
+ RequiredCapability[] mergedDependencies = iu1.getRequiredCapabilities();
+ for (int i = 0; i < iuDependencies.length; i++) {
+ FragmentTest.assertContains(mergedDependencies, iuDependencies[i]);
+ }
+ for (int i = 0; i < initialFragmentDependencies.length; i++) {
+ FragmentTest.assertContains(mergedDependencies, initialFragmentDependencies[i]);
+ }
+ assertEquals("The fragment dependencies should not change", initialFragmentDependencies, iu3.getRequiredCapabilities(), false);
+ }
+
+ public void testProperties() {
+ assertNotNull("The property is missing", iu3.getProperty(PROP_FRAG));
+ assertNotNull("The property is missing", iu1.getProperty(PROP_IU));
+ assertNull("The property should not be available", iu1.getProperty("doesnotexist"));
+ }
+
+ public IInstallableUnit createIUFragment(String name) {
+ InstallableUnitFragment iu = new InstallableUnitFragment();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+ iu.setProperty(PROP_FRAG, "value");
+
+ RequiredCapability[] reqs = new RequiredCapability[] {new RequiredCapability("eclipse.touchpoint", "bundle", VersionRange.emptyRange, null, false, true), new RequiredCapability(TEST_REQUIRED, TEST_REQUIRED, VersionRange.emptyRange, null, true, false)};
+ iu.setRequiredCapabilities(reqs);
+
+ ProvidedCapability[] cap = new ProvidedCapability[] {new ProvidedCapability("testCapabilityInFragment", "testCapabilityInFragment", new Version(1, 0, 0))};
+ iu.setCapabilities(cap);
+
+ return iu;
+ }
+
+ public IInstallableUnit createIU(String name) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+ iu.setProperty(PROP_IU, "valueIU");
+
+ ProvidedCapability[] cap = new ProvidedCapability[] {new ProvidedCapability("eclipse.touchpoint", "bundle", new Version(1, 0, 0)), new ProvidedCapability("testCapability", "testCapability", new Version(1, 0, 0))};
+ iu.setCapabilities(cap);
+ return iu;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentTest.java
new file mode 100644
index 000000000..81696d911
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/FragmentTest.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import java.util.*;
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class FragmentTest extends TestCase {
+ public void testAssociation() {
+ IInstallableUnit iu1 = createIU("ui.test1");
+ IInstallableUnit iu2 = createIUFragment("iuFragment.test1");
+ ResolutionHelper rh = new ResolutionHelper(new Hashtable(), null);
+ HashSet set = new HashSet();
+ set.add(iu1);
+ set.add(iu2);
+ Collection result = rh.attachCUs(set);
+ for (Iterator iterator = result.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit iu = (IResolvedInstallableUnit) iterator.next();
+ if (iu.getId().equals("iu1.test1")) {
+ assertEquals(iu.getFragments().length, 1);
+ assertEquals(iu.getFragments()[0].getId(), "iuFragment.test1");
+ }
+ }
+ }
+
+ public void testAssociation2() {
+ IInstallableUnit iu1 = createIU("ui.test1");
+ IInstallableUnit iu3 = createIU("ui.test3");
+ IInstallableUnit iu2 = createIUFragment("iuFragment.test1");
+ ResolutionHelper rh = new ResolutionHelper(new Hashtable(), null);
+ HashSet set = new HashSet();
+ set.add(iu1);
+ set.add(iu2);
+ set.add(iu3);
+ Collection result = rh.attachCUs(set);
+ for (Iterator iterator = result.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit iu = (IResolvedInstallableUnit) iterator.next();
+ if (iu.getId().equals("iu1.test1")) {
+ assertEquals(iu.getFragments().length, 1);
+ assertEquals(iu.getFragments()[0].getId(), "iuFragment.test1");
+ }
+ if (iu.getId().equals("iu1.test3")) {
+ assertEquals(iu.getFragments().length, 1);
+ assertEquals(iu.getFragments()[0].getId(), "iuFragment.test1");
+ }
+ }
+ }
+
+ public void testTouchpointData() {
+ assertEquals(createIUWithTouchpointData().getTouchpointData().length, 1);
+ assertEquals(createIUFragmentWithTouchpointData().getTouchpointData().length, 1);
+ IInstallableUnit iu1 = createIUWithTouchpointData();
+ IInstallableUnit iu2 = createIUFragmentWithTouchpointData();
+ ResolutionHelper rh = new ResolutionHelper(new Hashtable(), null);
+ HashSet set = new HashSet();
+ set.add(iu1);
+ set.add(iu2);
+ Collection result = rh.attachCUs(set);
+ for (Iterator iterator = result.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit iu = (IResolvedInstallableUnit) iterator.next();
+ if (iu.getId().equals(iu1.getId()))
+ assertEquals(iu.getTouchpointData().length, 2);
+
+ }
+ }
+
+ public void testFragmentCapability() {
+ IInstallableUnit iu = createIUFragment("iuFragment.test1");
+ ProvidedCapability[] all = iu.getProvidedCapabilities();
+ assertContains(all, InstallableUnitFragment.FRAGMENT_CAPABILITY);
+ }
+
+ public void testDefaultIUCapability() {
+ IInstallableUnit iu = createIU("ui.test1");
+ ProvidedCapability[] cap = iu.getProvidedCapabilities();
+ for (int i = 0; i < cap.length; i++) {
+ if (cap[i].getNamespace().equals(IInstallableUnit.IU_NAMESPACE)) {
+
+ assertEquals(cap[i].getNamespace(), IInstallableUnit.IU_NAMESPACE);
+ assertEquals(cap[i].getName(), iu.getId());
+ return;
+ }
+ }
+ throw new AssertionFailedError("No capability for the iu id");
+ }
+
+ public static void assertContains(Object[] objects, Object searched) {
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i] == searched)
+ return;
+ }
+ throw new AssertionFailedError("The array does not contain the searched element");
+ }
+
+ public static void assertContainsWithEquals(Object[] objects, Object searched) {
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i].equals(searched))
+ return;
+ }
+ throw new AssertionFailedError("The array does not contain the searched element");
+ }
+
+ public static InstallableUnit createIUFragment(String name) {
+ InstallableUnitFragment iu = new InstallableUnitFragment();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+ iu.setRequiredCapabilities(new RequiredCapability[] {new RequiredCapability("eclipse.touchpoint", "bundle", VersionRange.emptyRange, null, false, true)});
+ return iu;
+ }
+
+ public static InstallableUnit createIU(String name) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+
+ ProvidedCapability[] cap = new ProvidedCapability[] {new ProvidedCapability("eclipse.touchpoint", "bundle", new Version(1, 0, 0))};
+ iu.setCapabilities(cap);
+ return iu;
+ }
+
+ private IInstallableUnit createIUWithTouchpointData() {
+ InstallableUnit unit = createIU("ui.test1");
+ unit.setImmutableTouchpointData(new TouchpointData(new HashMap()));
+ return unit;
+ }
+
+ private IInstallableUnit createIUFragmentWithTouchpointData() {
+ InstallableUnit unit = createIUFragment("iuFragment.test1");
+ unit.setImmutableTouchpointData(new TouchpointData(new HashMap()));
+ return unit;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/MultipleIUAndFragmentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/MultipleIUAndFragmentTest.java
new file mode 100644
index 000000000..760758942
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/MultipleIUAndFragmentTest.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import java.util.*;
+import junit.framework.TestCase;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class MultipleIUAndFragmentTest extends TestCase {
+ IInstallableUnit iu1;
+ IInstallableUnit iu2;
+ IInstallableUnit iu3;
+ Collection result;
+
+ protected void setUp() throws Exception {
+ iu1 = createIU("one");
+ iu2 = createIUWithDependencyOn("two", "one");
+ iu3 = createIUFragment("fragment");
+ HashSet set = new HashSet();
+ set.add(iu1);
+ set.add(iu2);
+ set.add(iu3);
+ result = new ResolutionHelper(new Hashtable(), null).attachCUs(set);
+ }
+
+ protected void tearDown() throws Exception {
+ iu1 = null;
+ iu2 = null;
+ iu3 = null;
+ }
+
+ public void testAttachement() {
+ for (Iterator iterator = result.iterator(); iterator.hasNext();) {
+ IResolvedInstallableUnit iu = (IResolvedInstallableUnit) iterator.next();
+ if (iu.getId().equals(iu1.getId())) {
+ assertEquals(iu.getFragments().length, 1);
+ assertEquals(iu.getFragments()[0].getId(), iu3.getId());
+ }
+ if (iu.getId().equals(iu2.getId())) {
+ assertEquals(iu.getFragments().length, 1);
+ assertEquals(iu.getFragments()[0].getId(), iu3.getId());
+ }
+ if (iu.getId().equals(iu3.getId())) {
+ assertEquals(iu.getFragments().length, 0);
+ }
+ }
+
+ }
+
+ private IInstallableUnit createIUFragment(String name) {
+ InstallableUnitFragment iu = new InstallableUnitFragment();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+
+ RequiredCapability[] reqs = new RequiredCapability[] {new RequiredCapability("eclipse.touchpoint", "bundle", VersionRange.emptyRange, null, false, true)};
+ iu.setRequiredCapabilities(reqs);
+ return iu;
+ }
+
+ private static IInstallableUnit createIU(String name) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+
+ ProvidedCapability[] cap = new ProvidedCapability[] {new ProvidedCapability("eclipse.touchpoint", "bundle", new Version(1, 0, 0))};
+ iu.setCapabilities(cap);
+ return iu;
+ }
+
+ private static IInstallableUnit createIUWithDependencyOn(String name, String dependencyOn) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(name);
+ iu.setVersion(new Version(1, 0, 0));
+ iu.setTouchpointType(new TouchpointType("eclipse", new Version(1, 0, 0)));
+ iu.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("eclipse.touchpoint", "bundle", new Version(1, 0, 0))});
+ iu.setRequiredCapabilities(new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, dependencyOn, VersionRange.emptyRange, null, false, true)});
+ return iu;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/OldTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/OldTest.java
new file mode 100644
index 000000000..db71c19ae
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/OldTest.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import com.thoughtworks.xstream.XStream;
+import java.io.*;
+import java.util.ArrayList;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.Transformer;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.eclipse.osgi.service.resolver.*;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+public class OldTest {
+ public void testDependencyOnCapability() {
+ InstallableUnit osgi = new InstallableUnit();
+ osgi.setId("org.eclipse.osgi");
+ osgi.setVersion(new Version(3, 2, 0, null));
+
+ osgi.setRequiredCapabilities(new RequiredCapability[] {new RequiredCapability("java.runtime", "JRE", null, null, false, false)});
+
+ InstallableUnit jre = new InstallableUnit();
+ jre.setId("com.ibm.jre");
+ jre.setVersion(new Version(1, 4, 2, "sr2"));
+ jre.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("java.runtime", "JRE", new Version(1, 4, 2, "sr2"))});
+
+ ServiceReference sr = TestActivator.context.getServiceReference(PlatformAdmin.class.getName());
+
+ StateObjectFactory factory = ((PlatformAdmin) TestActivator.context.getService(sr)).getFactory();
+ Transformer t = new Transformer(factory);
+ t.visitInstallableUnit(osgi);
+ BundleDescription osgiBd = t.getResult();
+
+ t = new Transformer(factory);
+ t.visitInstallableUnit(jre);
+ BundleDescription jreBd = t.getResult();
+
+ State state = factory.createState(true);
+ state.addBundle(osgiBd);
+ state.addBundle(jreBd);
+ state.resolve();
+
+ System.out.println(osgiBd + ": " + osgiBd.isResolved());
+ System.out.println(jreBd + ": " + jreBd.isResolved());
+ }
+
+ public void testNamedDependency() {
+ InstallableUnit jface = new InstallableUnit();
+ jface.setId("org.eclipse.jface");
+ jface.setVersion(new Version(3, 2, 0, null));
+
+ jface.setRequiredCapabilities(new RequiredCapability[] {RequiredCapability.createRequiredCapabilityForName("org.eclipse.swt", null, false)});
+
+ InstallableUnit swt = new InstallableUnit();
+ swt.setId("org.eclipse.swt");
+ swt.setVersion(new Version(3, 2, 0, null));
+
+ ServiceReference sr = TestActivator.context.getServiceReference(PlatformAdmin.class.getName());
+
+ StateObjectFactory factory = ((PlatformAdmin) TestActivator.context.getService(sr)).getFactory();
+ Transformer t = new Transformer(factory);
+ t.visitInstallableUnit(jface);
+ BundleDescription jfaceBd = t.getResult();
+
+ t = new Transformer(factory);
+ t.visitInstallableUnit(swt);
+ BundleDescription swtBd = t.getResult();
+
+ State state = factory.createState(true);
+ state.addBundle(jfaceBd);
+ state.addBundle(swtBd);
+ state.resolve();
+
+ System.out.println(jfaceBd + ": " + jfaceBd.isResolved());
+ System.out.println(swtBd + ": " + swtBd.isResolved());
+ }
+
+ public void testBackup() {
+ InstallableUnit osgi = new InstallableUnit();
+ osgi.setId("org.eclipse.osgi");
+ osgi.setVersion(new Version(3, 2, 0, null));
+ osgi.setRequiredCapabilities(new RequiredCapability[] {new RequiredCapability("java.runtime", "JRE", null, null, false, false)});
+
+ InstallableUnit jre = new InstallableUnit();
+ jre.setId("com.ibm.jre");
+ jre.setVersion(new Version(1, 4, 2, "sr2"));
+ jre.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("java.runtime", "JRE", new Version(1, 4, 2, "sr2"))});
+
+ ArrayList all = new ArrayList();
+ all.add(osgi);
+ try {
+ new XStream().toXML(all, new FileOutputStream(new File("d:/tmp/m2.xml")));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/RecommendationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/RecommendationTest.java
new file mode 100644
index 000000000..6cd05bae8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/RecommendationTest.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Set;
+import junit.framework.TestCase;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.prov.director.Picker;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+public class RecommendationTest extends TestCase {
+ //test name dependency over
+ //test
+ //check that the picker is returning something in the range
+ public void testRecommendation() {
+ RequiredCapability applyOn, newValue;
+ applyOn = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue = new RequiredCapability("namespace", "name", new VersionRange("[1.1, 2.0)"), null, false, false);
+ Recommendation r1 = new Recommendation(applyOn, newValue);
+
+ RequiredCapability goodMatch = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ assertEquals(true, r1.matches(goodMatch));
+
+ RequiredCapability badNamespace = new RequiredCapability("badNamespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ assertEquals(false, r1.matches(badNamespace));
+
+ RequiredCapability badName = new RequiredCapability("namespace", "badName", new VersionRange("[1.0, 2.0)"), null, false, false);
+ assertEquals(false, r1.matches(badName));
+ }
+
+ public void testPicker() {
+ //The IUs we will pick from
+ InstallableUnit iu1 = createIU("iu1", new Version(1, 0, 0));
+ InstallableUnit iu2 = createIU("iu2", new Version(4, 0, 0));
+
+ //The recommendations to be used
+ RequiredCapability applyOn, newValue;
+ applyOn = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[1.1, 2.0)"), null, false, false);
+ Recommendation r1 = new Recommendation(applyOn, newValue);
+
+ RequiredCapability applyOn2, newValue2;
+ applyOn2 = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu2", new VersionRange("[4.2, 5.0)"), null, false, false);
+ newValue2 = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu2", new VersionRange("[4.0, 5.0)"), null, false, false);
+ Recommendation r2 = new Recommendation(applyOn2, newValue2);
+ Set recommendations = new HashSet();
+ recommendations.add(r1);
+ recommendations.add(r2);
+
+ Picker p = new Picker(new InstallableUnit[] {iu1, iu2}, null);
+ IInstallableUnit[][] matches = p.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", null, null, false, false)}, false);
+ assertEquals(matches[1][0], iu1);
+
+ Picker p1 = new Picker(new InstallableUnit[] {iu1, iu2}, new RecommendationDescriptor(recommendations));
+ matches = p1.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[1.0, 2.0)"), null, false, false)}, false);
+ assertEquals(matches[0].length, 0);
+ assertEquals(matches[1].length, 0);
+
+ matches = p1.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[4.2, 5.0)"), null, false, false)}, false);
+ assertEquals(matches[0].length, 0);
+ assertEquals(matches[1].length, 0);
+ }
+
+ public void testWideningRanges() {
+ //The IUs we will pick from
+ InstallableUnit iu1 = createIU("iu1", new Version(4, 0, 0));
+
+ //Here we add recommendation that widen the range of the bundle we are looking for
+ RequiredCapability applyOn2, newValue2;
+ applyOn2 = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[4.2, 5.0)"), null, false, false);
+ newValue2 = new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[4.0, 5.0)"), null, false, false);
+ Recommendation r2 = new Recommendation(applyOn2, newValue2);
+ Set recommendations = new HashSet();
+ recommendations.add(r2);
+
+ //Check without the recommendations
+ Picker p2 = new Picker(new InstallableUnit[] {iu1}, null);
+ IInstallableUnit[][] matches = p2.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[4.0, 5.0)"), null, false, false)}, false);
+ assertEquals(matches[1].length, 1);
+
+ //Check the widening works
+ Picker p1 = new Picker(new InstallableUnit[] {iu1}, new RecommendationDescriptor(recommendations));
+ matches = p1.findInstallableUnit(null, null, new RequiredCapability[] {new RequiredCapability(IInstallableUnit.IU_NAMESPACE, "iu1", new VersionRange("[4.2, 5.0)"), null, false, false)}, false);
+ assertEquals(matches[1].length, 1);
+
+ }
+
+ public void testRecommendationDescriptorMerge() {
+ RequiredCapability applyOn1, newValue1;
+ applyOn1 = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue1 = new RequiredCapability("namespace", "name", new VersionRange("[1.1, 2.0)"), null, false, false);
+ Recommendation r1 = new Recommendation(applyOn1, newValue1);
+ Set list1 = new HashSet();
+ list1.add(r1);
+ RecommendationDescriptor desc1 = new RecommendationDescriptor(list1);
+
+ RequiredCapability applyOn2, newValue2;
+ applyOn2 = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue2 = new RequiredCapability("namespace", "name", new VersionRange("[1.3, 2.0)"), null, false, false);
+ Recommendation r2 = new Recommendation(applyOn2, newValue2);
+ Set list2 = new HashSet();
+ list2.add(r2);
+ RecommendationDescriptor desc2 = new RecommendationDescriptor(list2);
+
+ //We test that the result of the merge worked.
+ assertEquals(Status.OK_STATUS, desc1.merge(desc2));
+ assertEquals(r2, desc1.findRecommendation(new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false)));
+ }
+
+ public void testRecommendationDescriptorMergeConflict() {
+ RequiredCapability applyOn1, newValue1;
+ applyOn1 = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue1 = new RequiredCapability("namespace", "name", new VersionRange("[1.1, 2.0)"), null, false, false);
+ Recommendation r1 = new Recommendation(applyOn1, newValue1);
+ Set list1 = new HashSet();
+ list1.add(r1);
+ RecommendationDescriptor desc1 = new RecommendationDescriptor(list1);
+
+ RequiredCapability applyOn2, newValue2;
+ applyOn2 = new RequiredCapability("namespace", "name", new VersionRange("[1.0, 2.0)"), null, false, false);
+ newValue2 = new RequiredCapability("namespace", "name", new VersionRange("[2.1, 3.0)"), null, false, false);
+ Recommendation r2 = new Recommendation(applyOn2, newValue2);
+ Set list2 = new HashSet();
+ list2.add(r2);
+ RecommendationDescriptor desc2 = new RecommendationDescriptor(list2);
+
+ //We test that the result of the merge worked.
+ assertEquals(Status.INFO, desc1.merge(desc2).getSeverity());
+ }
+
+ public void testRangeIntersection() {
+ Recommendation rec = new Recommendation(null, null);
+ try {
+ Method m = rec.getClass().getDeclaredMethod("intersect", new Class[] {VersionRange.class, VersionRange.class});
+ m.setAccessible(true);
+ assertEquals(new VersionRange("[1.0.0, 2.0.0)"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[0.1.0, 3.0.0]")}));
+
+ assertEquals(new VersionRange("[1.1.0, 1.9.0]"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[1.1.0, 1.9.0]")}));
+ assertEquals(new VersionRange("[1.1.0, 2.0.0)"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[1.1.0, 2.1.0]")}));
+ assertEquals(new VersionRange("[1.0.0, 1.3.0]"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[0.9.0, 1.3.0]")}));
+ assertEquals(null, m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[3.0.0, 4.0.0]")}));
+
+ assertEquals(new VersionRange("(1.0.0, 2.0.0]"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0]"), new VersionRange("(1.0.0, 2.1.0]")}));
+ assertEquals(new VersionRange("(1.0.0, 2.0.0]"), m.invoke(rec, new Object[] {new VersionRange("(1.0.0, 2.0.0]"), new VersionRange("[1.0.0, 2.1.0]")}));
+
+ assertEquals(new VersionRange("[1.0.0, 2.0.0)"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[1.0.0, 2.0.0]")}));
+ assertEquals(new VersionRange("[1.0.0, 2.0.0)"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0]"), new VersionRange("[1.0.0, 2.0.0)")}));
+
+ assertEquals(new VersionRange("[1.0.0, 2.0.0]"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0]"), new VersionRange("[1.0.0, 2.0.0]")}));
+ assertEquals(new VersionRange("(1.0.0, 2.0.0)"), m.invoke(rec, new Object[] {new VersionRange("(1.0.0, 2.0.0)"), new VersionRange("(1.0.0, 2.0.0)")}));
+
+ assertEquals(null, m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0)"), new VersionRange("[2.0.0, 3.0.0)")}));
+ assertEquals(new VersionRange("[2.0.0, 2.0.0]"), m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0]"), new VersionRange("[2.0.0, 3.0.0)")}));
+ assertEquals(null, m.invoke(rec, new Object[] {new VersionRange("[1.0.0, 2.0.0]"), new VersionRange("(2.0.0, 3.0.0)")}));
+ } catch (Exception e) {
+ fail("Usage of reflection failed");
+ }
+ }
+
+ private static InstallableUnit createIU(String name, Version version) {
+ InstallableUnit iu = new InstallableUnit();
+ iu.setId(name);
+ iu.setVersion(version);
+ return iu;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/ResolutionHelperTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/ResolutionHelperTest.java
new file mode 100644
index 000000000..21dd45b3c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/ResolutionHelperTest.java
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata;
+
+import java.util.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.equinox.prov.metadata.*;
+import org.eclipse.equinox.prov.resolution.ResolutionHelper;
+import org.eclipse.equinox.prov.resolution.UnsatisfiedCapability;
+import org.eclipse.equinox.prov.tests.AbstractProvisioningTest;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+/**
+ * Tests for {@link ResolutionHelper}.
+ */
+public class ResolutionHelperTest extends AbstractProvisioningTest {
+ private static final String FILTER_KEY = "osgi.os";
+
+ public static Test suite() {
+ return new TestSuite(ResolutionHelperTest.class);
+ }
+
+ public ResolutionHelperTest() {
+ super("");
+ }
+
+ public ResolutionHelperTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Tests resolving an IU that requires a capability, and the available
+ * provided capability is above the required capability's version range.
+ */
+ public void testDependencyAboveVersionRange() {
+ Version version = new Version(5, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose required capability falls outside available range
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("match");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "test", new VersionRange("[2.0,5.0)"), null));
+
+ ResolutionHelper rh = new ResolutionHelper(null, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 1, unsatisfied.length);
+ assertEquals("1.1", "match", unsatisfied[0].getUnsatisfiedUnit().getId());
+ RequiredCapability capability = unsatisfied[0].getRequiredCapability();
+ assertEquals("1.4", "test.capability", capability.getNamespace());
+ assertEquals("1.5", "test", capability.getName());
+ }
+
+ /**
+ * Tests resolving an IU that requires a capability, and the available
+ * provided capability is below the required capability's version range.
+ */
+ public void testDependencyBelowVersionRange() {
+ Version version = new Version(2, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose required capability falls outside available range
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("match");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "test", new VersionRange("(2.0,3.0)"), null));
+
+ ResolutionHelper rh = new ResolutionHelper(null, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 1, unsatisfied.length);
+ assertEquals("1.1", "match", unsatisfied[0].getUnsatisfiedUnit().getId());
+ RequiredCapability capability = unsatisfied[0].getRequiredCapability();
+ assertEquals("1.4", "test.capability", capability.getNamespace());
+ assertEquals("1.5", "test", capability.getName());
+ }
+
+ public void testDependencyWithPlatformFilter() {
+ Version version = new Version(1, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+ required.setFilter(createFilter(FILTER_KEY, "win32"));
+
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("toInstall");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "test", ANY_VERSION, null));
+
+ //setup context so that platform filter will satisfy dependency
+ Hashtable context = new Hashtable();
+ context.put(FILTER_KEY, "win32");
+ ResolutionHelper rh = new ResolutionHelper(context, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+ assertEquals("1.0", 0, unsatisfied.length);
+
+ //now try with a null evaluation context
+ rh = new ResolutionHelper(null, null);
+ unsatisfied = rh.install(installSet, available);
+ assertEquals("1.1", 1, unsatisfied.length);
+ assertEquals("1.2", "toInstall", unsatisfied[0].getUnsatisfiedUnit().getId());
+ RequiredCapability capability = unsatisfied[0].getRequiredCapability();
+ assertEquals("1.3", "test.capability", capability.getNamespace());
+ assertEquals("1.4", "test", capability.getName());
+
+ //now use a context where platform filter will not be satisfied
+ context.put(FILTER_KEY, "nomatch");
+ rh = new ResolutionHelper(context, null);
+ unsatisfied = rh.install(installSet, available);
+ assertEquals("2.1", 1, unsatisfied.length);
+ assertEquals("2.2", "toInstall", unsatisfied[0].getUnsatisfiedUnit().getId());
+ capability = unsatisfied[0].getRequiredCapability();
+ assertEquals("2.3", "test.capability", capability.getNamespace());
+ assertEquals("2.4", "test", capability.getName());
+
+ }
+
+ /**
+ * Tests resolving an IU that has a filter on its required capability.
+ */
+ public void testSatisfiedDependencyWithMatchingFilter() {
+ //use the same version everywhere because it's not interesting for this test
+ Version version = new Version(1, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose filter will match the environment
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("match");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "test", createFilter(FILTER_KEY, "matchValue")));
+
+ Dictionary environment = new Hashtable();
+ environment.put(FILTER_KEY, "matchValue");
+ ResolutionHelper rh = new ResolutionHelper(environment, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 0, unsatisfied.length);
+ }
+
+ /**
+ * In this test we try to resolve an IU that has a required capability that is
+ * available, but there is a filter on the required capability so it should not be considered.
+ */
+ public void testSatisfiedDependencyWithUnmatchingFilter() {
+ //use the same version everywhere because it's not interesting for this test
+ Version version = new Version(1, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose filter will not match the environment
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("noMatch");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "test", createFilter(FILTER_KEY, "noMatchValue")));
+
+ Dictionary environment = new Hashtable();
+ environment.put(FILTER_KEY, "matchValue");
+ ResolutionHelper rh = new ResolutionHelper(environment, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 0, unsatisfied.length);
+ }
+
+ public void testSimpleDependency() {
+ InstallableUnit osgi = new InstallableUnit();
+ osgi.setId("org.eclipse.osgi");
+ osgi.setVersion(new Version(3, 2, 0, null));
+ osgi.setRequiredCapabilities(new RequiredCapability[] {new RequiredCapability("java.runtime", "JRE", null, null, false, false)});
+
+ InstallableUnit jre = new InstallableUnit();
+ jre.setId("com.ibm.jre");
+ jre.setVersion(new Version(1, 4, 2, "sr2"));
+ jre.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("java.runtime", "JRE", new Version(1, 4, 2, "sr2"))});
+
+ ResolutionHelper rh = new ResolutionHelper(null, null);
+ HashSet osgiSet = new HashSet(1);
+ osgiSet.add(osgi);
+ HashSet jreSet = new HashSet(1);
+ jreSet.add(jre);
+ assertEquals("1.0", 0, rh.install(osgiSet, jreSet).length);
+ }
+
+ /**
+ * Tests resolving an IU that has a filter on its required capability, and
+ * the required capability is not available.
+ */
+ public void testUnsatisfiedDependencyWithMatchingFilter() {
+ //use the same version everywhere because it's not interesting for this test
+ Version version = new Version(1, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose filter will match the environment
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("match");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "does.not.exist", createFilter(FILTER_KEY, "matchValue")));
+
+ Dictionary environment = new Hashtable();
+ environment.put(FILTER_KEY, "matchValue");
+ ResolutionHelper rh = new ResolutionHelper(environment, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 1, unsatisfied.length);
+ assertEquals("1.1", "match", unsatisfied[0].getUnsatisfiedUnit().getId());
+ RequiredCapability capability = unsatisfied[0].getRequiredCapability();
+ assertEquals("1.4", "test.capability", capability.getNamespace());
+ assertEquals("1.5", "does.not.exist", capability.getName());
+ }
+
+ /**
+ * In this test we try to resolve an IU that has an unsatisfied dependency.
+ * However, there is a filter on the unresolved dependency that does not
+ * match the environment, so it should not prevent the IU being resolved.
+ */
+ public void testUnsatisfiedDependencyWithUnmatchingFilter() {
+ //use the same version everywhere because it's not interesting for this test
+ Version version = new Version(1, 0, 0);
+
+ //The IU that exports the capability
+ InstallableUnit required = new InstallableUnit();
+ required.setId("required");
+ required.setVersion(version);
+ required.setCapabilities(new ProvidedCapability[] {new ProvidedCapability("test.capability", "test", version)});
+
+ //an IU whose filter will not match the environment
+ InstallableUnit toInstall = new InstallableUnit();
+ toInstall.setId("noMatch");
+ toInstall.setVersion(version);
+ toInstall.setRequiredCapabilities(createRequiredCapabilities("test.capability", "does.not.exist", createFilter(FILTER_KEY, "noMatchValue")));
+
+ Dictionary environment = new Hashtable();
+ environment.put(FILTER_KEY, "matchValue");
+ ResolutionHelper rh = new ResolutionHelper(environment, null);
+ HashSet installSet = new HashSet();
+ installSet.add(toInstall);
+ HashSet available = new HashSet();
+ available.add(required);
+ UnsatisfiedCapability[] unsatisfied = rh.install(installSet, available);
+
+ assertEquals("1.0", 0, unsatisfied.length);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/AllTests.java
new file mode 100644
index 000000000..532adb148
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/AllTests.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.prov.tests.metadata.repository;
+
+import junit.framework.*;
+
+/**
+ * Performs all automated director tests.
+ */
+public class AllTests extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(JarURLRepositoryTest.class);
+ return suite;
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/JarURLRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/JarURLRepositoryTest.java
new file mode 100644
index 000000000..5277f277d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/prov/tests/metadata/repository/JarURLRepositoryTest.java
@@ -0,0 +1,45 @@
+package org.eclipse.equinox.prov.tests.metadata.repository;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import junit.framework.TestCase;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepository;
+import org.eclipse.equinox.prov.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.prov.tests.TestActivator;
+import org.osgi.framework.ServiceReference;
+
+public class JarURLRepositoryTest extends TestCase {
+
+ private ServiceReference managerRef;
+ private IMetadataRepositoryManager manager;
+
+ public JarURLRepositoryTest(String name) {
+ super(name);
+ }
+
+ public JarURLRepositoryTest() {
+ super("");
+ }
+
+ protected void setUp() throws Exception {
+ managerRef = TestActivator.getContext().getServiceReference(IMetadataRepositoryManager.class.getName());
+ manager = (IMetadataRepositoryManager) TestActivator.getContext().getService(managerRef);
+ }
+
+ protected void tearDown() throws Exception {
+ manager = null;
+ TestActivator.getContext().ungetService(managerRef);
+ }
+
+ public void testJarURLRepository() {
+ URL engineJar = TestActivator.getContext().getBundle().getEntry("/testData/enginerepo.jar");
+ URL jarRepoURL = null;
+ try {
+ jarRepoURL = new URL("jar:" + engineJar.toString() + "!/");
+ } catch (MalformedURLException e) {
+ fail(e.getMessage());
+ }
+ IMetadataRepository repo = manager.loadRepository(jarRepoURL, null);
+ assertTrue(repo.getInstallableUnits(null).length > 0);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/enginerepo.jar b/bundles/org.eclipse.equinox.p2.tests/testData/enginerepo.jar
new file mode 100644
index 000000000..5a7fc33a4
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/enginerepo.jar
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/jarprocessor.jar.pack.gz b/bundles/org.eclipse.equinox.p2.tests/testData/jarprocessor.jar.pack.gz
new file mode 100644
index 000000000..f2df489b2
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/jarprocessor.jar.pack.gz
Binary files differ

Back to the top