Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2008-12-01 04:06:43 +0000
committerSimon Kaegi2008-12-01 04:06:43 +0000
commit4ed5a6c3647bdee25ac29de62a463f5ade2620a7 (patch)
treebda7b099731affb7efffe54aa5c2fb149e7b7d0b /bundles/org.eclipse.equinox.cm.test
parent4775392c207ced90d399fdae6d0498cd50fa4b1d (diff)
downloadrt.equinox.bundles-4ed5a6c3647bdee25ac29de62a463f5ade2620a7.tar.gz
rt.equinox.bundles-4ed5a6c3647bdee25ac29de62a463f5ade2620a7.tar.xz
rt.equinox.bundles-4ed5a6c3647bdee25ac29de62a463f5ade2620a7.zip
Bug 253771 [cm] Move configadmin tests from incubator to compendium tests
Diffstat (limited to 'bundles/org.eclipse.equinox.cm.test')
-rw-r--r--bundles/org.eclipse.equinox.cm.test/.classpath7
-rw-r--r--bundles/org.eclipse.equinox.cm.test/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.cm.test/.project28
-rw-r--r--bundles/org.eclipse.equinox.cm.test/.settings/org.eclipse.jdt.core.prefs331
-rw-r--r--bundles/org.eclipse.equinox.cm.test/.settings/org.eclipse.jdt.ui.prefs57
-rw-r--r--bundles/org.eclipse.equinox.cm.test/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF12
-rw-r--r--bundles/org.eclipse.equinox.cm.test/build.properties4
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/Activator.java61
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/AllTests.java30
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationAdminTest.java247
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationDictionaryTest.java223
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationEventAdapterTest.java124
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationListenerTest.java69
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationPluginTest.java228
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceFactoryTest.java186
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java163
17 files changed, 1775 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.cm.test/.classpath b/bundles/org.eclipse.equinox.cm.test/.classpath
new file mode 100644
index 000000000..751c8f2e5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/.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"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/org.eclipse.equinox.cm.test/.cvsignore b/bundles/org.eclipse.equinox.cm.test/.cvsignore
new file mode 100644
index 000000000..ba077a403
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/bundles/org.eclipse.equinox.cm.test/.project b/bundles/org.eclipse.equinox.cm.test/.project
new file mode 100644
index 000000000..13e9a0e5d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.equinox.cm.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.cm.test/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.cm.test/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..f31f25003
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,331 @@
+#Tue Aug 21 11:27:47 CDT 2007
+eclipse.preferences.version=1
+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=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+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=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+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.unsafeTypeOperation=warning
+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.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+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.cm.test/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.cm.test/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 000000000..21bd9f3c7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,57 @@
+#Tue Aug 21 11:30:07 CDT 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
+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.correct_indentation=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.cm.test/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.equinox.cm.test/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..0828c7745
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Sun Oct 21 19:02:46 EDT 2007
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..35188f5f8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Plug-in
+Bundle-SymbolicName: org.eclipse.equinox.cm.test
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.equinox.cm.test.Activator
+Import-Package: junit.framework;version="[3.8.0,4.0.0)",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.cm;version="1.2.0",
+ org.osgi.service.event;version="1.1.0",
+ org.osgi.service.packageadmin;version="1.2.0"
+Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.equinox.cm.test/build.properties b/bundles/org.eclipse.equinox.cm.test/build.properties
new file mode 100644
index 000000000..34d2e4d2d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/Activator.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/Activator.java
new file mode 100644
index 000000000..124ceff0c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/Activator.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.cm.test;
+
+import org.osgi.framework.*;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public class Activator implements BundleActivator {
+
+ private static PackageAdmin packageAdmin;
+ private static BundleContext bundleContext;
+ private ServiceReference packageAdminRef;
+
+ public void start(BundleContext context) throws Exception {
+ packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
+ setPackageAdmin((PackageAdmin) context.getService(packageAdminRef));
+ setBundleContext(context);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ setBundleContext(null);
+ setPackageAdmin(null);
+ context.ungetService(packageAdminRef);
+ }
+
+ private static synchronized void setBundleContext(BundleContext context) {
+ bundleContext = context;
+ }
+
+ private static synchronized void setPackageAdmin(PackageAdmin service) {
+ packageAdmin = service;
+ }
+
+ static synchronized BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ static synchronized 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.cm.test/src/org/eclipse/equinox/cm/test/AllTests.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/AllTests.java
new file mode 100644
index 000000000..958b8a6db
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/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.cm.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for org.eclipse.equinox.cm.test");
+ suite.addTestSuite(ConfigurationAdminTest.class);
+ suite.addTestSuite(ManagedServiceFactoryTest.class);
+ suite.addTestSuite(ManagedServiceTest.class);
+ suite.addTestSuite(ConfigurationDictionaryTest.class);
+ suite.addTestSuite(ConfigurationPluginTest.class);
+ suite.addTestSuite(ConfigurationListenerTest.class);
+ suite.addTestSuite(ConfigurationEventAdapterTest.class);
+ return suite;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationAdminTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationAdminTest.java
new file mode 100644
index 000000000..1cdc30e8c
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationAdminTest.java
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.cm.test;
+
+import java.util.Properties;
+import junit.framework.TestCase;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+public class ConfigurationAdminTest extends TestCase {
+
+ private ConfigurationAdmin cm;
+ private ServiceReference reference;
+
+ public ConfigurationAdminTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ Activator.getBundle("org.eclipse.equinox.cm").start();
+ reference = Activator.getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
+ cm = (ConfigurationAdmin) Activator.getBundleContext().getService(reference);
+ }
+
+ protected void tearDown() throws Exception {
+ Activator.getBundleContext().ungetService(reference);
+ Activator.getBundle("org.eclipse.equinox.cm").stop();
+ }
+
+ public void testCreateConfig() throws Exception {
+ Configuration config = cm.getConfiguration("test");
+ assertEquals("test", config.getPid());
+ }
+
+ public void testCreateConfigNullPid() throws Exception {
+ try {
+ Configuration config = cm.getConfiguration(null);
+ } catch (IllegalArgumentException e) {
+ return;
+ }
+ fail();
+ }
+
+ public void testCreateConfigWithLocation() throws Exception {
+ Configuration config = cm.getConfiguration("test", null);
+ assertEquals("test", config.getPid());
+ }
+
+ public void testCreateConfigNullPidWithLocation() throws Exception {
+ try {
+ Configuration config = cm.getConfiguration(null, null);
+ } catch (IllegalArgumentException e) {
+ return;
+ }
+ fail();
+ }
+
+ public void testCreateConfigWithAndWithoutLocation() throws Exception {
+ Configuration config = cm.getConfiguration("test", "x");
+ config.update();
+ try {
+ Configuration config2 = cm.getConfiguration("test");
+ assertEquals(config, config2);
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testCreateConfigWithAndWithoutNullLocation() throws Exception {
+ Configuration config = cm.getConfiguration("test", null);
+ config.update();
+ assertNull(config.getBundleLocation());
+ try {
+ Configuration config2 = cm.getConfiguration("test");
+ assertEquals(config, config2);
+ assertEquals(config2.getBundleLocation(), Activator.getBundleContext().getBundle().getLocation());
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testCreateFactoryConfig() throws Exception {
+ Configuration config = cm.createFactoryConfiguration("test");
+ assertEquals("test", config.getFactoryPid());
+ }
+
+ public void testCreateFactoryConfigNullPid() throws Exception {
+ try {
+ Configuration config = cm.createFactoryConfiguration(null);
+ } catch (IllegalArgumentException e) {
+ return;
+ }
+ fail();
+ }
+
+ public void testCreateFactoryConfigWithLocation() throws Exception {
+ Configuration config = cm.createFactoryConfiguration("test", null);
+ assertEquals("test", config.getFactoryPid());
+ }
+
+ public void testCreateFactoryConfigNullPidWithLocation() throws Exception {
+ try {
+ Configuration config = cm.createFactoryConfiguration(null, null);
+ } catch (IllegalArgumentException e) {
+ return;
+ }
+ fail();
+ }
+
+ public void testCreateFactoryConfigWithAndWithoutLocation() throws Exception {
+ Configuration config = cm.createFactoryConfiguration("test", "x");
+ config.update();
+ try {
+ Configuration config2 = cm.getConfiguration(config.getPid());
+ assertEquals(config, config2);
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testCreateFactoryConfigWithAndWithoutNullLocation() throws Exception {
+ Configuration config = cm.createFactoryConfiguration("test", null);
+ config.update();
+ assertNull(config.getBundleLocation());
+ try {
+ Configuration config2 = cm.getConfiguration(config.getPid());
+ assertEquals(config, config2);
+ assertEquals(config2.getBundleLocation(), Activator.getBundleContext().getBundle().getLocation());
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testListConfiguration() throws Exception {
+ Configuration config = cm.getConfiguration("test", null);
+ config.update();
+ try {
+ Configuration[] configs = cm.listConfigurations("(" + Constants.SERVICE_PID + "=test)");
+ assertTrue(configs != null && configs.length > 0);
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testListConfigurationWithBoundLocation() throws Exception {
+ Configuration config = cm.getConfiguration("test", null);
+ config.update();
+ try {
+ String filterString = "(&(" + ConfigurationAdmin.SERVICE_BUNDLELOCATION + "=" + Activator.getBundleContext().getBundle().getLocation() + ")" + "(" + Constants.SERVICE_PID + "=test)" + ")";
+ Configuration[] configs = cm.listConfigurations(filterString);
+ assertNull(configs);
+ // bind configuration to this bundle's location
+ cm.getConfiguration("test");
+ configs = cm.listConfigurations(filterString);
+ assertTrue(configs != null && configs.length > 0);
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testListFactoryConfiguration() throws Exception {
+ Configuration config = cm.createFactoryConfiguration("test", null);
+ config.update();
+ try {
+ Configuration[] configs = cm.listConfigurations("(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=test)");
+ assertTrue(configs != null && configs.length > 0);
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testListFactoryConfigurationWithBoundLocation() throws Exception {
+ Configuration config = cm.createFactoryConfiguration("test", null);
+ config.update();
+ try {
+ String filterString = "(&(" + ConfigurationAdmin.SERVICE_BUNDLELOCATION + "=" + Activator.getBundleContext().getBundle().getLocation() + ")" + "(" + Constants.SERVICE_PID + "=" + config.getPid() + ")" + ")";
+ Configuration[] configs = cm.listConfigurations(filterString);
+ assertNull(configs);
+ // bind configuration to this bundle's location
+ cm.getConfiguration(config.getPid());
+ configs = cm.listConfigurations(filterString);
+ assertTrue(configs != null && configs.length > 0);
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testListConfigurationNull() throws Exception {
+ Configuration config = cm.createFactoryConfiguration("test", null);
+ config.update();
+ try {
+ Configuration[] configs = cm.listConfigurations(null);
+ assertTrue(configs != null && configs.length > 0);
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testPersistentConfig() throws Exception {
+ Configuration config = cm.getConfiguration("test");
+ assertNull(config.getProperties());
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+ assertTrue(config.getPid().equals("test"));
+ assertTrue(config.getProperties().get("testkey").equals("testvalue"));
+ tearDown();
+ setUp();
+ config = cm.getConfiguration("test");
+ assertTrue(config.getProperties().get("testkey").equals("testvalue"));
+ config.delete();
+ tearDown();
+ setUp();
+ config = cm.getConfiguration("test");
+ assertNull(config.getProperties());
+ }
+
+ public void testPersistentFactoryConfig() throws Exception {
+ Configuration config = cm.createFactoryConfiguration("test");
+ assertNull(config.getProperties());
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+ assertTrue(config.getFactoryPid().equals("test"));
+ assertTrue(config.getProperties().get("testkey").equals("testvalue"));
+ String pid = config.getPid();
+ tearDown();
+ setUp();
+ config = cm.getConfiguration(pid);
+ assertTrue(config.getProperties().get("testkey").equals("testvalue"));
+ config.delete();
+ tearDown();
+ setUp();
+ config = cm.getConfiguration(pid);
+ assertNull(config.getProperties());
+ }
+}
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationDictionaryTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationDictionaryTest.java
new file mode 100644
index 000000000..a795cef3f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationDictionaryTest.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * 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.cm.test;
+
+import java.util.*;
+import junit.framework.TestCase;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+public class ConfigurationDictionaryTest extends TestCase {
+
+ private ConfigurationAdmin cm;
+ private ServiceReference reference;
+
+ public ConfigurationDictionaryTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ Activator.getBundle("org.eclipse.equinox.cm").start();
+ reference = Activator.getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
+ cm = (ConfigurationAdmin) Activator.getBundleContext().getService(reference);
+ }
+
+ protected void tearDown() throws Exception {
+ Activator.getBundleContext().ungetService(reference);
+ Activator.getBundle("org.eclipse.equinox.cm").stop();
+ }
+
+ public void testGoodConfigProperties() throws Exception {
+ Configuration config = cm.getConfiguration("test");
+ config.update();
+ Dictionary dict = config.getProperties();
+ try {
+ dict.put("1", new String("x"));
+ dict.put("2", new Integer(1));
+ dict.put("3", new Long(1));
+ dict.put("4", new Float(1));
+ dict.put("5", new Double(1));
+ dict.put("6", new Byte((byte) 1));
+ dict.put("7", new Short((short) 1));
+ dict.put("8", new Character('a'));
+ dict.put("9", new Boolean(true));
+ dict.put("10", new String[] {"x"});
+ dict.put("11", new Integer[] {new Integer(1)});
+ dict.put("12", new Long[] {new Long(1)});
+ dict.put("13", new Float[] {new Float(1)});
+ dict.put("14", new Double[] {new Double(1)});
+ dict.put("15", new Byte[] {new Byte((byte) 1)});
+ dict.put("16", new Short[] {new Short((short) 1)});
+ dict.put("17", new Character[] {new Character('a')});
+ dict.put("18", new Boolean[] {new Boolean(true)});
+ dict.put("19", new int[] {1});
+ dict.put("20", new long[] {1});
+ dict.put("21", new float[] {1});
+ dict.put("22", new double[] {1});
+ dict.put("23", new byte[] {1});
+ dict.put("24", new short[] {1});
+ dict.put("25", new char[] {'a'});
+ dict.put("26", new boolean[] {true});
+ dict.put("27", new Vector());
+ Vector v = new Vector();
+ v.add(new String("x"));
+ v.add(new Integer(1));
+ v.add(new Long(1));
+ v.add(new Float(1));
+ v.add(new Double(1));
+ v.add(new Byte((byte) 1));
+ v.add(new Short((short) 1));
+ v.add(new Character('a'));
+ v.add(new Boolean(true));
+ dict.put("28", v);
+
+ } catch (IllegalArgumentException e) {
+ fail(e.getMessage());
+ }
+
+ config.update(dict);
+ Dictionary dict2 = config.getProperties();
+
+ Enumeration enum1 = dict.elements();
+ Enumeration enum2 = dict.elements();
+ while (enum1.hasMoreElements())
+ assertEquals(enum1.nextElement(), enum2.nextElement());
+
+ assertFalse(enum2.hasMoreElements());
+ config.delete();
+ }
+
+ public void testNullKey() throws Exception {
+ Configuration config = cm.getConfiguration("test2");
+ config.update();
+ Dictionary dict = config.getProperties();
+ try {
+ dict.put(null, "x");
+ } catch (NullPointerException e) {
+ return;
+ } finally {
+ config.delete();
+ }
+ fail();
+ }
+
+ public void testNullValue() throws Exception {
+ Configuration config = cm.getConfiguration("test2");
+ config.update();
+ Dictionary dict = config.getProperties();
+ try {
+ dict.put("x", null);
+ } catch (NullPointerException e) {
+ return;
+ } finally {
+ config.delete();
+ }
+ fail();
+ }
+
+ public void testObjectValue() throws Exception {
+ Configuration config = cm.getConfiguration("test2");
+ config.update();
+ Dictionary dict = config.getProperties();
+ try {
+ dict.put("x", new Object());
+ } catch (IllegalArgumentException e) {
+ return;
+ } finally {
+ config.delete();
+ }
+ fail();
+ }
+
+ public void testObjectArray() throws Exception {
+ Configuration config = cm.getConfiguration("test2");
+ config.update();
+ Dictionary dict = config.getProperties();
+ try {
+ dict.put("x", new Object[] {new Object()});
+ } catch (IllegalArgumentException e) {
+ return;
+ } finally {
+ config.delete();
+ }
+ fail();
+ }
+
+ public void testObjectVector() throws Exception {
+ Configuration config = cm.getConfiguration("test2");
+ config.update();
+ Dictionary dict = config.getProperties();
+ try {
+ Vector v = new Vector();
+ v.add(new Object());
+ dict.put("x", v);
+ } catch (IllegalArgumentException e) {
+ return;
+ } finally {
+ config.delete();
+ }
+ fail();
+ }
+
+ public void testGet() throws Exception {
+ Configuration config = cm.getConfiguration("test2");
+ config.update();
+ Dictionary dict = config.getProperties();
+ try {
+ assertTrue(null != dict.get(Constants.SERVICE_PID));
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testGetNull() throws Exception {
+ Configuration config = cm.getConfiguration("test2");
+ config.update();
+ Dictionary dict = config.getProperties();
+ try {
+ dict.get(null);
+ } catch (NullPointerException e) {
+ return;
+ } finally {
+ config.delete();
+ }
+ fail();
+ }
+
+ public void testRemove() throws Exception {
+ Configuration config = cm.getConfiguration("test2");
+ config.update();
+ Dictionary dict = config.getProperties();
+ try {
+ assertFalse(dict.isEmpty());
+ assertTrue(null != dict.remove(Constants.SERVICE_PID));
+ assertTrue(dict.isEmpty());
+ } finally {
+ config.delete();
+ }
+ }
+
+ public void testRemoveNull() throws Exception {
+ Configuration config = cm.getConfiguration("test2");
+ config.update();
+ Dictionary dict = config.getProperties();
+ try {
+ dict.remove(null);
+ } catch (NullPointerException e) {
+ return;
+ } finally {
+ config.delete();
+ }
+ fail();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationEventAdapterTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationEventAdapterTest.java
new file mode 100644
index 000000000..d4d6e9cf8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationEventAdapterTest.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * 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.cm.test;
+
+import java.util.*;
+import junit.framework.TestCase;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.event.*;
+
+public class ConfigurationEventAdapterTest extends TestCase {
+
+ private ConfigurationAdmin cm;
+ private ServiceReference cmReference;
+
+ boolean locked = false;
+ Object lock = new Object();
+
+ public ConfigurationEventAdapterTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ Activator.getBundle("org.eclipse.equinox.event").start();
+ Activator.getBundle("org.eclipse.equinox.cm").start();
+ cmReference = Activator.getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
+ cm = (ConfigurationAdmin) Activator.getBundleContext().getService(cmReference);
+ }
+
+ protected void tearDown() throws Exception {
+ Activator.getBundleContext().ungetService(cmReference);
+ Activator.getBundle("org.eclipse.equinox.cm").stop();
+ Activator.getBundle("org.eclipse.equinox.event").stop();
+ }
+
+ public void testConfigurationEvent() throws Exception {
+
+ Configuration config = cm.getConfiguration("test");
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+
+ EventHandler handler = new EventHandler() {
+ public void handleEvent(Event event) {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ }
+ }
+
+ };
+ String[] topics = new String[] {"org/osgi/service/cm/ConfigurationEvent/*"};
+ Dictionary handlerProps = new Hashtable();
+
+ handlerProps.put(EventConstants.EVENT_TOPIC, topics);
+ ServiceRegistration reg = Activator.getBundleContext().registerService(EventHandler.class.getName(), handler, handlerProps);
+
+ synchronized (lock) {
+ config.update(props);
+ locked = true;
+ lock.wait(5000);
+ assertFalse(locked);
+ }
+
+ synchronized (lock) {
+ config.delete();
+ locked = true;
+ lock.wait(5000);
+ assertFalse(locked);
+ }
+
+ reg.unregister();
+ }
+
+ public void testConfigurationFactoryEvent() throws Exception {
+
+ Configuration config = cm.createFactoryConfiguration("test");
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+
+ EventHandler handler = new EventHandler() {
+ public void handleEvent(Event event) {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ }
+ }
+
+ };
+ String[] topics = new String[] {"org/osgi/service/cm/ConfigurationEvent/*"};
+ Dictionary handlerProps = new Hashtable();
+
+ handlerProps.put(EventConstants.EVENT_TOPIC, topics);
+ ServiceRegistration reg = Activator.getBundleContext().registerService(EventHandler.class.getName(), handler, handlerProps);
+
+ synchronized (lock) {
+ config.update(props);
+ locked = true;
+ lock.wait(5000);
+ assertFalse(locked);
+ }
+
+ synchronized (lock) {
+ config.delete();
+ locked = true;
+ lock.wait(5000);
+ assertFalse(locked);
+ }
+
+ reg.unregister();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationListenerTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationListenerTest.java
new file mode 100644
index 000000000..d4de3a7af
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationListenerTest.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.cm.test;
+
+import java.util.Properties;
+import junit.framework.TestCase;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.*;
+
+public class ConfigurationListenerTest extends TestCase {
+
+ private ConfigurationAdmin cm;
+ private ServiceReference reference;
+ boolean locked = false;
+ Object lock = new Object();
+
+ public ConfigurationListenerTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ Activator.getBundle("org.eclipse.equinox.cm").start();
+ reference = Activator.getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
+ cm = (ConfigurationAdmin) Activator.getBundleContext().getService(reference);
+ }
+
+ protected void tearDown() throws Exception {
+ Activator.getBundleContext().ungetService(reference);
+ Activator.getBundle("org.eclipse.equinox.cm").stop();
+ }
+
+ public void testListener() throws Exception {
+
+ Configuration config = cm.getConfiguration("test");
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+
+ ConfigurationListener listener = new ConfigurationListener() {
+ public void configurationEvent(ConfigurationEvent event) {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ }
+ }
+ };
+ ServiceRegistration reg = Activator.getBundleContext().registerService(ConfigurationListener.class.getName(), listener, null);
+
+ synchronized (lock) {
+ config.update(props);
+ locked = true;
+ lock.wait(5000);
+ assertFalse(locked);
+ }
+
+ reg.unregister();
+ config.delete();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationPluginTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationPluginTest.java
new file mode 100644
index 000000000..29c72ac02
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ConfigurationPluginTest.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * 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.cm.test;
+
+import java.util.Dictionary;
+import java.util.Properties;
+import junit.framework.TestCase;
+import org.osgi.framework.*;
+import org.osgi.service.cm.*;
+
+public class ConfigurationPluginTest extends TestCase {
+
+ private ConfigurationAdmin cm;
+ private ServiceReference reference;
+ boolean locked = false;
+ Object lock = new Object();
+ boolean success;
+
+ public ConfigurationPluginTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ Activator.getBundle("org.eclipse.equinox.cm").start();
+ reference = Activator.getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
+ cm = (ConfigurationAdmin) Activator.getBundleContext().getService(reference);
+ }
+
+ protected void tearDown() throws Exception {
+ Activator.getBundleContext().ungetService(reference);
+ Activator.getBundle("org.eclipse.equinox.cm").stop();
+ }
+
+ public void testPlugin() throws Exception {
+
+ Configuration config = cm.getConfiguration("test");
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+
+ ConfigurationPlugin plugin = new ConfigurationPlugin() {
+
+ public void modifyConfiguration(ServiceReference reference, Dictionary properties) {
+ properties.put("plugin", "plugin1");
+ }
+ };
+ ServiceRegistration pluginReg = Activator.getBundleContext().registerService(ConfigurationPlugin.class.getName(), plugin, null);
+
+ ManagedService ms = new ManagedService() {
+ public void updated(Dictionary properties) throws ConfigurationException {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ success = "plugin1".equals(properties.get("plugin"));
+ }
+ }
+ };
+
+ Dictionary dict = new Properties();
+ dict.put(Constants.SERVICE_PID, "test");
+ ServiceRegistration reg = null;
+ synchronized (lock) {
+ success = false;
+ reg = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertTrue(success);
+ }
+
+ reg.unregister();
+ pluginReg.unregister();
+ config.delete();
+ }
+
+ public void testPidSpecificPlugin() throws Exception {
+
+ Configuration config = cm.getConfiguration("test");
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+
+ ConfigurationPlugin plugin = new ConfigurationPlugin() {
+
+ public void modifyConfiguration(ServiceReference reference, Dictionary properties) {
+ properties.put("plugin", "plugin1");
+ }
+ };
+ Dictionary pluginDict = new Properties();
+ pluginDict.put(ConfigurationPlugin.CM_TARGET, new String[] {"test"});
+ ServiceRegistration pluginReg = Activator.getBundleContext().registerService(ConfigurationPlugin.class.getName(), plugin, pluginDict);
+
+ ManagedService ms = new ManagedService() {
+ public void updated(Dictionary properties) throws ConfigurationException {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ success = "plugin1".equals(properties.get("plugin"));
+ }
+ }
+ };
+
+ Dictionary dict = new Properties();
+ dict.put(Constants.SERVICE_PID, "test");
+ ServiceRegistration reg = null;
+ synchronized (lock) {
+ success = false;
+ reg = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertTrue(success);
+ }
+
+ reg.unregister();
+ pluginReg.unregister();
+ config.delete();
+ }
+
+ public void testPidSpecificMissPlugin() throws Exception {
+
+ Configuration config = cm.getConfiguration("test");
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+
+ ConfigurationPlugin plugin = new ConfigurationPlugin() {
+
+ public void modifyConfiguration(ServiceReference reference, Dictionary properties) {
+ properties.put("plugin", "plugin1");
+ }
+ };
+ Dictionary pluginDict = new Properties();
+ pluginDict.put(ConfigurationPlugin.CM_TARGET, new String[] {"testXXX"});
+ ServiceRegistration pluginReg = Activator.getBundleContext().registerService(ConfigurationPlugin.class.getName(), plugin, pluginDict);
+
+ ManagedService ms = new ManagedService() {
+ public void updated(Dictionary properties) throws ConfigurationException {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ success = "plugin1".equals(properties.get("plugin"));
+ }
+ }
+ };
+
+ Dictionary dict = new Properties();
+ dict.put(Constants.SERVICE_PID, "test");
+ ServiceRegistration reg = null;
+ synchronized (lock) {
+ success = false;
+ reg = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+ locked = true;
+ lock.wait(5000);
+ assertFalse(success);
+ }
+
+ reg.unregister();
+ pluginReg.unregister();
+ config.delete();
+ }
+
+ public void testRankedPlugin() throws Exception {
+
+ Configuration config = cm.getConfiguration("test");
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+
+ ConfigurationPlugin plugin = new ConfigurationPlugin() {
+
+ public void modifyConfiguration(ServiceReference reference, Dictionary properties) {
+ properties.put("plugin", "plugin1");
+ }
+ };
+ Dictionary pluginDict = new Properties();
+ pluginDict.put(ConfigurationPlugin.CM_RANKING, new Integer(1));
+ ServiceRegistration pluginReg1 = Activator.getBundleContext().registerService(ConfigurationPlugin.class.getName(), plugin, pluginDict);
+
+ ConfigurationPlugin plugin2 = new ConfigurationPlugin() {
+
+ public void modifyConfiguration(ServiceReference reference, Dictionary properties) {
+ properties.put("plugin", "plugin2");
+ }
+ };
+
+ ServiceRegistration pluginReg2 = Activator.getBundleContext().registerService(ConfigurationPlugin.class.getName(), plugin, null);
+
+ ManagedService ms = new ManagedService() {
+ public void updated(Dictionary properties) throws ConfigurationException {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ success = "plugin1".equals(properties.get("plugin"));
+ }
+ }
+ };
+
+ Dictionary dict = new Properties();
+ dict.put(Constants.SERVICE_PID, "test");
+ ServiceRegistration reg = null;
+ synchronized (lock) {
+ success = false;
+ reg = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertTrue(success);
+ }
+
+ reg.unregister();
+ pluginReg1.unregister();
+ pluginReg2.unregister();
+ config.delete();
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceFactoryTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceFactoryTest.java
new file mode 100644
index 000000000..707d9d13d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceFactoryTest.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * 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.cm.test;
+
+import java.util.Dictionary;
+import java.util.Properties;
+import junit.framework.TestCase;
+import org.osgi.framework.*;
+import org.osgi.service.cm.*;
+
+public class ManagedServiceFactoryTest extends TestCase {
+
+ private ConfigurationAdmin cm;
+ private ServiceReference reference;
+ int updateCount = 0;
+ boolean locked = false;
+ Object lock = new Object();
+
+ public ManagedServiceFactoryTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ Activator.getBundle("org.eclipse.equinox.cm").start();
+ reference = Activator.getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
+ cm = (ConfigurationAdmin) Activator.getBundleContext().getService(reference);
+
+ }
+
+ protected void tearDown() throws Exception {
+ Activator.getBundleContext().ungetService(reference);
+ Activator.getBundle("org.eclipse.equinox.cm").stop();
+ }
+
+ public void testSamePidManagedServiceFactory() throws Exception {
+
+ Configuration config = cm.createFactoryConfiguration("test");
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+
+ updateCount = 0;
+ ManagedServiceFactory msf = new ManagedServiceFactory() {
+
+ public void deleted(String pid) {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ updateCount++;
+ }
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public void updated(String pid, Dictionary properties) throws ConfigurationException {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ updateCount++;
+ }
+ }
+ };
+
+ Dictionary dict = new Properties();
+ dict.put(Constants.SERVICE_PID, "test");
+ ServiceRegistration reg = null;
+ synchronized (lock) {
+ reg = Activator.getBundleContext().registerService(ManagedServiceFactory.class.getName(), msf, dict);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(1, updateCount);
+ }
+
+ ServiceRegistration reg2 = null;
+ synchronized (lock) {
+ reg2 = Activator.getBundleContext().registerService(ManagedServiceFactory.class.getName(), msf, dict);
+ locked = true;
+ lock.wait(100);
+ assertTrue(locked);
+ assertEquals(1, updateCount);
+ locked = false;
+ }
+ reg.unregister();
+ reg2.unregister();
+ config.delete();
+ }
+
+ public void testGeneralManagedServiceFactory() throws Exception {
+ updateCount = 0;
+ ManagedServiceFactory msf = new ManagedServiceFactory() {
+
+ public void deleted(String pid) {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ updateCount++;
+ }
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public void updated(String pid, Dictionary properties) throws ConfigurationException {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ updateCount++;
+ }
+ }
+ };
+
+ Dictionary dict = new Properties();
+ dict.put(Constants.SERVICE_PID, "test");
+
+ ServiceRegistration reg = null;
+ synchronized (lock) {
+ reg = Activator.getBundleContext().registerService(ManagedServiceFactory.class.getName(), msf, dict);
+ locked = true;
+ lock.wait(100);
+ assertTrue(locked);
+ assertEquals(0, updateCount);
+ locked = false;
+ }
+
+ Configuration config = cm.createFactoryConfiguration("test");
+ assertNull(config.getProperties());
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+
+ synchronized (lock) {
+ config.update(props);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(1, updateCount);
+ }
+
+ dict.remove(Constants.SERVICE_PID);
+ synchronized (lock) {
+ reg.setProperties(dict);
+ props.put("testkey", "testvalue2");
+ config.update(props);
+ locked = true;
+ lock.wait(100);
+ assertTrue(locked);
+ assertEquals(1, updateCount);
+ locked = false;
+ }
+
+ config.delete();
+ config = cm.createFactoryConfiguration("test2");
+ dict.put(Constants.SERVICE_PID, "test2");
+ synchronized (lock) {
+ reg.setProperties(dict);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(2, updateCount);
+ }
+
+ synchronized (lock) {
+ config.delete();
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(3, updateCount);
+ }
+ reg.unregister();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
new file mode 100644
index 000000000..28671dd15
--- /dev/null
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/ManagedServiceTest.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * 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.cm.test;
+
+import java.util.Dictionary;
+import java.util.Properties;
+import junit.framework.TestCase;
+import org.osgi.framework.*;
+import org.osgi.service.cm.*;
+
+public class ManagedServiceTest extends TestCase {
+
+ private ConfigurationAdmin cm;
+ private ServiceReference reference;
+ int updateCount = 0;
+ boolean locked = false;
+ Object lock = new Object();
+
+ public ManagedServiceTest(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ Activator.getBundle("org.eclipse.equinox.cm").start();
+ reference = Activator.getBundleContext().getServiceReference(ConfigurationAdmin.class.getName());
+ cm = (ConfigurationAdmin) Activator.getBundleContext().getService(reference);
+ }
+
+ protected void tearDown() throws Exception {
+ Activator.getBundleContext().ungetService(reference);
+ Activator.getBundle("org.eclipse.equinox.cm").stop();
+ }
+
+ public void testSamePidManagedService() throws Exception {
+
+ Configuration config = cm.getConfiguration("test");
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+ config.update(props);
+
+ updateCount = 0;
+ ManagedService ms = new ManagedService() {
+
+ public void updated(Dictionary properties) throws ConfigurationException {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ updateCount++;
+ }
+
+ }
+ };
+
+ Dictionary dict = new Properties();
+ dict.put(Constants.SERVICE_PID, "test");
+ ServiceRegistration reg = null;
+ synchronized (lock) {
+ reg = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(1, updateCount);
+ }
+
+ ServiceRegistration reg2 = null;
+ synchronized (lock) {
+ reg2 = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+ locked = true;
+ lock.wait(100);
+ assertTrue(locked);
+ assertEquals(1, updateCount);
+ locked = false;
+ }
+ reg.unregister();
+ reg2.unregister();
+ config.delete();
+ }
+
+ public void testGeneralManagedService() throws Exception {
+ updateCount = 0;
+ ManagedService ms = new ManagedService() {
+
+ public void updated(Dictionary properties) throws ConfigurationException {
+ synchronized (lock) {
+ locked = false;
+ lock.notify();
+ updateCount++;
+ }
+
+ }
+ };
+
+ Dictionary dict = new Properties();
+ dict.put(Constants.SERVICE_PID, "test");
+
+ ServiceRegistration reg = null;
+ synchronized (lock) {
+ reg = Activator.getBundleContext().registerService(ManagedService.class.getName(), ms, dict);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(1, updateCount);
+ }
+
+ Configuration config = cm.getConfiguration("test");
+ assertNull(config.getProperties());
+ Properties props = new Properties();
+ props.put("testkey", "testvalue");
+
+ synchronized (lock) {
+ config.update(props);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(2, updateCount);
+ }
+
+ dict.remove(Constants.SERVICE_PID);
+ synchronized (lock) {
+ reg.setProperties(dict);
+ props.put("testkey", "testvalue2");
+ config.update(props);
+ locked = true;
+ lock.wait(100);
+ assertTrue(locked);
+ assertEquals(2, updateCount);
+ locked = false;
+ }
+
+ config.delete();
+ config = cm.getConfiguration("test2");
+ dict.put(Constants.SERVICE_PID, "test2");
+ synchronized (lock) {
+ reg.setProperties(dict);
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(3, updateCount);
+ }
+
+ synchronized (lock) {
+ config.delete();
+ locked = true;
+ lock.wait(5000);
+ if (locked)
+ fail("should have updated");
+ assertEquals(4, updateCount);
+ }
+ reg.unregister();
+ }
+}

Back to the top