diff options
author | cletavernie | 2013-03-11 18:23:48 +0000 |
---|---|---|
committer | cletavernie | 2013-03-11 18:23:48 +0000 |
commit | b1fa32c3c6b6796e01899b893ac52dc94f1d18cc (patch) | |
tree | 230c913a84f0f4f10e0ebfa1fb7e2fb735080654 /tests/junit | |
parent | 170791ab54822c9891117cdea1b4ce651f3b65d9 (diff) | |
download | org.eclipse.papyrus-b1fa32c3c6b6796e01899b893ac52dc94f1d18cc.tar.gz org.eclipse.papyrus-b1fa32c3c6b6796e01899b893ac52dc94f1d18cc.tar.xz org.eclipse.papyrus-b1fa32c3c6b6796e01899b893ac52dc94f1d18cc.zip |
290952: [CDO] Support for CDO model repository
https://bugs.eclipse.org/bugs/show_bug.cgi?id=290952
Merge the tests from cdo_kepler to the trunk (From r10476)
Diffstat (limited to 'tests/junit')
16 files changed, 1621 insertions, 0 deletions
diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.classpath b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.classpath new file mode 100644 index 00000000000..304e86186aa --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.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/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.project b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.project new file mode 100644 index 00000000000..838ed026ca8 --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.cdo.validation.problems.tests</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.jdt.core.javanature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + </natures> +</projectDescription> diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..a13557a0d1f --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,287 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=1 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=1 +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=next_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_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=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +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=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=150 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=1 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +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=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=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=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=do not 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=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_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +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=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_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +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=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not 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_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +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.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=200 +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=5 +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_on_off_tags=false +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.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..272e835ec52 --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,58 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Papyrus Formatter Profile CDM +formatter_settings_version=12 +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n *****************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * This is the ${type_name} type. Enjoy.\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></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_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_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/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/META-INF/MANIFEST.MF b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..1c5498be76f --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.cdo.validation.problems.tests;singleton:=true +Bundle-Version: 0.10.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: org.eclipse.papyrus.cdo.validation.problems.edit.tests, + org.eclipse.papyrus.cdo.validation.problems.tests, + org.eclipse.papyrus.cdo.validation.problems.util.tests +Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0.0)", + org.eclipse.papyrus.cdo.validation.problems;bundle-version="0.10.0";visibility:=reexport, + org.eclipse.papyrus.cdo.validation.problems.edit;bundle-version="0.10.0", + org.eclipse.emf.ecore.xmi;bundle-version="[2.8.0,3.0.0)";visibility:=reexport, + org.eclipse.emf.ecore.edit;bundle-version="[2.8.0,3.0.0)", + org.eclipse.papyrus.cdo.core.tests;bundle-version="0.10.0" diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/about.html b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/about.html new file mode 100644 index 00000000000..209103075a7 --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.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>November 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/build.properties b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/build.properties new file mode 100644 index 00000000000..ebd6dd3918c --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/build.properties @@ -0,0 +1,20 @@ +# Copyright (c) 2013 CEA LIST. +# +# 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: +# CEA LIST - Initial API and implementation +# + +jars.compile.order = . +source.. = src/ +output.. = bin/ + +bin.includes = .,\ + META-INF/,\ + plugin.properties,\ + about.html +src.includes = about.html diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/plugin.properties b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/plugin.properties new file mode 100644 index 00000000000..2c7db5186c5 --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/plugin.properties @@ -0,0 +1,13 @@ +# Copyright (c) 2013 CEA LIST. +# +# 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: +# CEA LIST - Initial API and implementation +# + +pluginName = Papyrus CDO Model Repository Problems Model Tests (Incubation) +providerName = Eclipse Modeling Project diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/edit/tests/AllProblemsEditTests.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/edit/tests/AllProblemsEditTests.java new file mode 100644 index 00000000000..28fb8db5b98 --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/edit/tests/AllProblemsEditTests.java @@ -0,0 +1,40 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.cdo.validation.problems.edit.tests; + +import junit.framework.Test; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +import org.eclipse.papyrus.cdo.validation.problems.tests.ProblemsAllTests; + +/** + * Test suite for the Problems Edit API. + */ +public class AllProblemsEditTests + extends TestSuite { + + public AllProblemsEditTests(String name) { + super(name); + } + + public static void main(String[] args) { + TestRunner.run(suite()); + } + + public static Test suite() { + TestSuite suite = new ProblemsAllTests("Problems Edit Tests"); //$NON-NLS-1$ + suite.addTest(ProblemEditUtilTest.suite()); + return suite; + } + +} diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/edit/tests/ProblemEditUtilTest.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/edit/tests/ProblemEditUtilTest.java new file mode 100644 index 00000000000..ad7648ba764 --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/edit/tests/ProblemEditUtilTest.java @@ -0,0 +1,73 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.cdo.validation.problems.edit.tests; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.papyrus.cdo.validation.problems.EProblem; +import org.eclipse.papyrus.cdo.validation.problems.ProblemsFactory; +import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; +import org.eclipse.papyrus.cdo.validation.problems.edit.ProblemEditUtil; +import org.eclipse.papyrus.cdo.validation.problems.provider.ProblemsItemProviderAdapterFactory; + +/** + * Test suite for the {@link ProblemEditUtil} class. + */ +public class ProblemEditUtilTest + extends TestCase { + + public ProblemEditUtilTest(String name) { + super(name); + } + + public static Test suite() { + return new TestSuite(ProblemEditUtilTest.class, "ProblemEditUtil tests"); + } + + public void testDefaultProblemType() { + ProblemEditUtil util = new ProblemEditUtil( + new EcoreItemProviderAdapterFactory()); + + EProblem problem = ProblemsFactory.eINSTANCE.createEProblem(); + problem.setElement(problem); // Oo! a meta-problem + + assertEquals(ProblemsPackage.eNAME, util.getProblemType(problem)); + } + + public void testDefaultProblemType_nullElement() { + ProblemEditUtil util = new ProblemEditUtil( + new EcoreItemProviderAdapterFactory()); + + EProblem problem = ProblemsFactory.eINSTANCE.createEProblem(); + // no element + + assertNull(util.getProblemType(problem)); + } + + public void testProblemTypeProvider() { + ProblemEditUtil util = new ProblemEditUtil(new ComposedAdapterFactory( + new AdapterFactory[]{new ProblemsItemProviderAdapterFactory(), // + new EcoreItemProviderAdapterFactory() // + })); + + EProblem problem = ProblemsFactory.eINSTANCE.createEProblem(); + problem.setElement(problem); // Oo! a meta-problem + + assertEquals("Papyrus Problem", util.getProblemType(problem)); + } + +} diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/EProblemTest.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/EProblemTest.java new file mode 100644 index 00000000000..f85c3213869 --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/EProblemTest.java @@ -0,0 +1,164 @@ +/** + * Copyright (c) 2013 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +package org.eclipse.papyrus.cdo.validation.problems.tests; + +import static org.junit.Assert.assertArrayEquals; + +import java.util.Arrays; + +import junit.framework.TestCase; +import junit.textui.TestRunner; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.cdo.validation.problems.EProblem; +import org.eclipse.papyrus.cdo.validation.problems.ESeverity; +import org.eclipse.papyrus.cdo.validation.problems.ProblemsFactory; +import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; + +/** + * <!-- begin-user-doc --> A test case for the model object ' + * <em><b>EProblem</b></em>'. <!-- end-user-doc --> + * <p> + * The following operations are tested: + * <ul> + * <li> + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblem#toDiagnostic() + * <em>To Diagnostic</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class EProblemTest + extends TestCase { + + protected static ESeverity SEVERITY = ESeverity.ERROR; + + protected static String SOURCE = "org.eclipse.papyrus.cdo.validation.problems.tests"; + + protected static String MESSAGE = "This is a test."; + + protected static int CODE = 42; + + protected static EObject ELEMENT = ProblemsPackage.eINSTANCE; + + protected static EObject RELATED1 = ProblemsPackage.Literals.EPROBLEM; + + protected static EObject RELATED2 = ProblemsPackage.Literals.EDIAGNOSTIC; + + /** + * The fixture for this EProblem test case. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + protected EProblem fixture = null; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(EProblemTest.class); + } + + /** + * Constructs a new EProblem test case with the given name. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EProblemTest(String name) { + super(name); + } + + /** + * Sets the fixture for this EProblem test case. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void setFixture(EProblem fixture) { + this.fixture = fixture; + } + + /** + * Returns the fixture for this EProblem test case. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected EProblem getFixture() { + return fixture; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see junit.framework.TestCase#setUp() + * @generated NOT + */ + @Override + protected void setUp() + throws Exception { + setFixture(ProblemsFactory.eINSTANCE.createEProblem()); + + getFixture().setSeverity(SEVERITY); + getFixture().setSource(SOURCE); + getFixture().setCode(CODE); + getFixture().setMessage(MESSAGE); + getFixture().setElement(ELEMENT); + getFixture().getRelated().addAll(Arrays.asList(RELATED1, RELATED2)); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() + throws Exception { + setFixture(null); + } + + /** + * Tests the ' + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblem#toDiagnostic() + * <em>To Diagnostic</em>}' operation. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.papyrus.cdo.validation.problems.EProblem#toDiagnostic() + * @generated NOT + */ + public void testToDiagnostic() { + Diagnostic diag = getFixture().toDiagnostic(); + + assertDiagnostic(diag, MESSAGE, new Object[]{ELEMENT, RELATED1, + RELATED2}); + } + + static void assertDiagnostic(Diagnostic diag, String message, + Object... data) { + assertEquals(Diagnostic.ERROR, diag.getSeverity()); + assertEquals(SOURCE, diag.getSource()); + assertEquals(CODE, diag.getCode()); + assertEquals(message, diag.getMessage()); + assertNotNull(diag.getData()); + assertArrayEquals(data, diag.getData().toArray()); + assertNull(diag.getException()); + assertTrue(diag.getChildren().isEmpty()); + } +} // EProblemTest diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/EProblemsContainerTest.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/EProblemsContainerTest.java new file mode 100644 index 00000000000..3de5a59ae4c --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/EProblemsContainerTest.java @@ -0,0 +1,277 @@ +/** + * Copyright (c) 2013 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +package org.eclipse.papyrus.cdo.validation.problems.tests; + +import static org.junit.Assert.assertArrayEquals; + +import java.util.Arrays; +import java.util.Iterator; + +import junit.framework.TestCase; +import junit.textui.TestRunner; + +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.papyrus.cdo.validation.problems.EProblem; +import org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer; +import org.eclipse.papyrus.cdo.validation.problems.ESeverity; +import org.eclipse.papyrus.cdo.validation.problems.ProblemsFactory; + +/** + * <!-- begin-user-doc --> A test case for the model object ' + * <em><b>EProblems Container</b></em>'. <!-- end-user-doc --> + * <p> + * The following operations are tested: + * <ul> + * <li> + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allProblems() + * <em>All Problems</em>}</li> + * <li> + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allProblems(org.eclipse.emf.ecore.EObject) + * <em>All Problems</em>}</li> + * <li> + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allDiagnostics() + * <em>All Diagnostics</em>}</li> + * <li> + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allDiagnostics(org.eclipse.emf.ecore.EObject) + * <em>All Diagnostics</em>}</li> + * <li> + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getWorstProblem(org.eclipse.emf.ecore.EObject) + * <em>Get Worst Problem</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class EProblemsContainerTest + extends TestCase { + + /** + * The fixture for this EProblems Container test case. <!-- begin-user-doc + * --> <!-- end-user-doc --> + * + * @generated + */ + protected EProblemsContainer fixture = null; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(EProblemsContainerTest.class); + } + + /** + * Constructs a new EProblems Container test case with the given name. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EProblemsContainerTest(String name) { + super(name); + } + + /** + * Sets the fixture for this EProblems Container test case. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected void setFixture(EProblemsContainer fixture) { + this.fixture = fixture; + } + + /** + * Returns the fixture for this EProblems Container test case. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected EProblemsContainer getFixture() { + return fixture; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see junit.framework.TestCase#setUp() + * @generated NOT + */ + @Override + protected void setUp() + throws Exception { + EProblemsContainer root = ProblemsFactory.eINSTANCE + .createEProblemsContainer(); + root.getProblems().add(createProblem(EProblemTest.ELEMENT, "root")); + + EProblemsContainer level1 = ProblemsFactory.eINSTANCE + .createEProblemsContainer(); + root.getSubcontainers().add(level1); + level1.getProblems().add(createProblem(EProblemTest.RELATED1, "a")); + level1.getProblems().add(createProblem(EProblemTest.RELATED2, "b")); + + EProblemsContainer level2 = ProblemsFactory.eINSTANCE + .createEProblemsContainer(); + level1.getSubcontainers().add(level2); + level1.getProblems().add(createProblem(EProblemTest.RELATED2, "c")); + level1.getProblems().add(createProblem(EProblemTest.RELATED1, "d")); + + setFixture(root); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see junit.framework.TestCase#tearDown() + * @generated + */ + @Override + protected void tearDown() + throws Exception { + setFixture(null); + } + + /** + * Tests the ' + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allProblems() + * <em>All Problems</em>}' operation. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allProblems() + * @generated NOT + */ + public void testAllProblems() { + final Iterator<String> messages = Arrays.asList("root", "a", "b", "c", + "d").iterator(); + final Iterator<EObject> elements = Arrays.asList(EProblemTest.ELEMENT, + EProblemTest.RELATED1, EProblemTest.RELATED2, + EProblemTest.RELATED2, EProblemTest.RELATED1).iterator(); + + for (Iterator<EProblem> allProblems = getFixture().allProblems(); allProblems + .hasNext();) { + assertProblem(allProblems.next(), messages.next(), elements.next()); + } + } + + /** + * Tests the ' + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allProblems(org.eclipse.emf.ecore.EObject) + * <em>All Problems</em>}' operation. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allProblems(org.eclipse.emf.ecore.EObject) + * @generated NOT + */ + public void testAllProblems__EObject() { + final Iterator<String> messages = Arrays.asList("b", "c").iterator(); + final Iterator<EObject> elements = Arrays.asList(EProblemTest.RELATED2, + EProblemTest.RELATED2).iterator(); + + for (Iterator<EProblem> allProblems = getFixture().allProblems( + EProblemTest.RELATED2); allProblems.hasNext();) { + assertProblem(allProblems.next(), messages.next(), elements.next()); + } + } + + /** + * Tests the ' + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allDiagnostics() + * <em>All Diagnostics</em>}' operation. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allDiagnostics() + * @generated NOT + */ + public void testAllDiagnostics() { + final Iterator<String> messages = Arrays.asList("root", "a", "b", "c", + "d").iterator(); + final Iterator<EObject> elements = Arrays.asList(EProblemTest.ELEMENT, + EProblemTest.RELATED1, EProblemTest.RELATED2, + EProblemTest.RELATED2, EProblemTest.RELATED1).iterator(); + + for (Diagnostic diag : getFixture().allDiagnostics()) { + EProblemTest.assertDiagnostic(diag, messages.next(), + elements.next()); + } + } + + /** + * Tests the ' + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allDiagnostics(org.eclipse.emf.ecore.EObject) + * <em>All Diagnostics</em>}' operation. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#allDiagnostics(org.eclipse.emf.ecore.EObject) + * @generated NOT + */ + public void testAllDiagnostics__EObject() { + final Iterator<String> messages = Arrays.asList("a", "d").iterator(); + final Iterator<EObject> elements = Arrays.asList(EProblemTest.RELATED1, + EProblemTest.RELATED1).iterator(); + + for (Diagnostic diag : getFixture().allDiagnostics( + EProblemTest.RELATED1)) { + EProblemTest.assertDiagnostic(diag, messages.next(), + elements.next()); + } + } + + /** + * Tests the ' + * {@link org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getWorstProblem(org.eclipse.emf.ecore.EObject) + * <em>Get Worst Problem</em>}' operation. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @see org.eclipse.papyrus.cdo.validation.problems.EProblemsContainer#getWorstProblem(org.eclipse.emf.ecore.EObject) + * @generated NOT + */ + public void testGetWorstProblem__EObject() { + // change severities in the fixture + Iterator<ESeverity> severities = Arrays.asList(ESeverity.INFO, + ESeverity.WARNING).iterator(); + for (Iterator<EProblem> problems = getFixture().allProblems( + EProblemTest.RELATED1); problems.hasNext();) { + problems.next().setSeverity(severities.next()); + } + + assertSame(ESeverity.WARNING, + getFixture().getWorstProblem(EProblemTest.RELATED1).getSeverity()); + assertSame(ESeverity.ERROR, + getFixture().getWorstProblem(EProblemTest.ELEMENT).getSeverity()); + assertNull(getFixture().getWorstProblem(EcorePackage.eINSTANCE)); + } + + protected EProblem createProblem(EObject element, String message) { + EProblem result = ProblemsFactory.eINSTANCE.createEProblem(); + + result.setSeverity(EProblemTest.SEVERITY); + result.setSource(EProblemTest.SOURCE); + result.setCode(EProblemTest.CODE); + result.setMessage(message); + result.setElement(element); + + return result; + } + + static void assertProblem(EProblem problem, String message, + EObject element, EObject... related) { + assertSame(ESeverity.ERROR, problem.getSeverity()); + assertEquals(EProblemTest.SOURCE, problem.getSource()); + assertEquals(EProblemTest.CODE, problem.getCode()); + assertEquals(message, problem.getMessage()); + assertSame(element, problem.getElement()); + assertArrayEquals(related, problem.getRelated().toArray()); + } +} // EProblemsContainerTest diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/ProblemsAllTests.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/ProblemsAllTests.java new file mode 100644 index 00000000000..c7a1143ac16 --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/ProblemsAllTests.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2013 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +package org.eclipse.papyrus.cdo.validation.problems.tests; + +import junit.framework.JUnit4TestAdapter; +import junit.framework.Test; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +import org.eclipse.emf.common.EMFPlugin; +import org.eclipse.papyrus.cdo.validation.problems.edit.tests.AllProblemsEditTests; +import org.eclipse.papyrus.cdo.validation.problems.util.tests.AllUtilTests; + +/** + * <!-- begin-user-doc --> A test suite for the '<em><b>Problems</b></em>' + * model. <!-- end-user-doc --> + * + * @generated + */ +public class ProblemsAllTests + extends TestSuite { + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(suite()); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated NOT + */ + public static Test suite() { + TestSuite suite = new ProblemsAllTests("Problems Tests"); //$NON-NLS-1$ + suite.addTest(ProblemsTests.suite()); + + if (EMFPlugin.IS_ECLIPSE_RUNNING) { + suite.addTest(new JUnit4TestAdapter(AllUtilTests.class)); + } + + suite.addTest(AllProblemsEditTests.suite()); + return suite; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public ProblemsAllTests(String name) { + super(name); + } + +} // ProblemsAllTests diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/ProblemsTests.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/ProblemsTests.java new file mode 100644 index 00000000000..4967b897cfa --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/tests/ProblemsTests.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2013 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +package org.eclipse.papyrus.cdo.validation.problems.tests; + +import junit.framework.Test; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +/** + * <!-- begin-user-doc --> A test suite for the '<em><b>problems</b></em>' + * package. <!-- end-user-doc --> + * + * @generated + */ +public class ProblemsTests + extends TestSuite { + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public static void main(String[] args) { + TestRunner.run(suite()); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public static Test suite() { + TestSuite suite = new ProblemsTests("problems Tests"); //$NON-NLS-1$ + suite.addTestSuite(EProblemTest.class); + suite.addTestSuite(EProblemsContainerTest.class); + return suite; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public ProblemsTests(String name) { + super(name); + } + +} // ProblemsTests diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/util/tests/AllUtilTests.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/util/tests/AllUtilTests.java new file mode 100644 index 00000000000..d2f62a25de7 --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/util/tests/AllUtilTests.java @@ -0,0 +1,28 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.cdo.validation.problems.util.tests; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * Test suite for the Problems Model utilities. + */ +@RunWith(Suite.class) +@SuiteClasses({ProblemsManagerTest.class}) +public class AllUtilTests { + + public AllUtilTests() { + super(); + } +} diff --git a/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/util/tests/ProblemsManagerTest.java b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/util/tests/ProblemsManagerTest.java new file mode 100644 index 00000000000..d101be44cd7 --- /dev/null +++ b/tests/junit/extraplugins/cdo/org.eclipse.papyrus.cdo.validation.problems.tests/src/org/eclipse/papyrus/cdo/validation/problems/util/tests/ProblemsManagerTest.java @@ -0,0 +1,456 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.cdo.validation.problems.util.tests; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.sameInstance; +import static org.junit.Assert.assertThat; + +import java.lang.ref.Reference; +import java.lang.ref.ReferenceQueue; +import java.lang.ref.WeakReference; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.regex.Pattern; + +import org.eclipse.emf.cdo.eresource.CDOResource; +import org.eclipse.emf.cdo.transaction.CDOTransaction; +import org.eclipse.emf.cdo.view.CDOView; +import org.eclipse.emf.common.util.BasicDiagnostic; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EValidator; +import org.eclipse.emf.ecore.impl.EValidatorRegistryImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.Diagnostician; +import org.eclipse.emf.ecore.util.ECrossReferenceAdapter; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.papyrus.cdo.core.tests.AbstractPapyrusCDOTest; +import org.eclipse.papyrus.cdo.validation.problems.EProblem; +import org.eclipse.papyrus.cdo.validation.problems.ESeverity; +import org.eclipse.papyrus.cdo.validation.problems.ProblemsPackage; +import org.eclipse.papyrus.cdo.validation.problems.util.ProblemsManager; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Interface; +import org.eclipse.uml2.uml.Model; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.util.UMLValidator; +import org.junit.After; +import org.junit.Test; + +/** + * Tests suite for the {@link ProblemsManager} API. + */ +public class ProblemsManagerTest + extends AbstractPapyrusCDOTest { + + private Set<ProblemsManager> managers = new java.util.HashSet<ProblemsManager>(); + + @Test + public void getProblemsAdapter() { + CDOTransaction transaction = createTransaction(); + + ProblemsManager mgr = getProblemsManager(transaction); + + // doesn't create a new instance + assertThat(mgr, + sameInstance(ProblemsManager.getProblemsManager(transaction + .getResourceSet()))); + } + + @Test + public void allProblems() { + CDOTransaction transaction = createTransaction(); + CDOResource resource = transaction + .createResource(getResourcePath("/resource1")); + + createTestModel(resource); + + ProblemsManager mgr = getProblemsManager(transaction); + mgr.addDiagnostic(validate(resource)); + + Collection<EProblem> allProblems = collect(mgr.getAllProblems()); + assertThat(allProblems.size(), equalTo(3)); + assertIndistinguishableMembersProblem(resource, allProblems); + assertGeneralCompatibilityProblem(resource, allProblems); + assertUnownedElementProblem(resource, allProblems); + } + + @Test + public void allProblems_EObject_noCrossReferencer() { + CDOTransaction transaction = createTransaction(); + CDOResource resource = transaction + .createResource(getResourcePath("/resource1")); + + createTestModel(resource); + + ProblemsManager mgr = getProblemsManager(transaction); + mgr.addDiagnostic(validate(resource)); + + Collection<EProblem> problems = collect(mgr + .getAllProblems(getClass2(resource))); + assertThat(problems.size(), equalTo(2)); + assertIndistinguishableMembersProblem(resource, problems); + assertGeneralCompatibilityProblem(resource, problems); + } + + @Test + public void allProblems_EObject_crossReferencer() { + CDOTransaction transaction = createTransaction(); + CDOResource resource = transaction + .createResource(getResourcePath("/resource1")); + + // attach a cross-reference adapter + transaction.getResourceSet().eAdapters() + .add(new ECrossReferenceAdapter()); + + createTestModel(resource); + + ProblemsManager mgr = getProblemsManager(transaction); + mgr.addDiagnostic(validate(resource)); + + Collection<EProblem> problems = collect(mgr + .getAllProblems(getClass2(resource))); + assertThat(problems.size(), equalTo(2)); + assertIndistinguishableMembersProblem(resource, problems); + assertGeneralCompatibilityProblem(resource, problems); + } + + @Test + public void purgeAll_noCrossReferencer() { + CDOTransaction transaction = createTransaction(); + CDOResource resource = transaction + .createResource(getResourcePath("/resource1")); + + createTestModel(resource); + + ProblemsManager mgr = getProblemsManager(transaction); + mgr.addDiagnostic(validate(resource)); + + mgr.purgeAllProblems(); + + assertThat(mgr.getAllProblems().hasNext(), is(false)); + } + + @Test + public void purgeAll_crossReferencer() { + CDOTransaction transaction = createTransaction(); + CDOResource resource = transaction + .createResource(getResourcePath("/resource1")); + + // attach a cross-reference adapter + transaction.getResourceSet().eAdapters() + .add(new ECrossReferenceAdapter()); + + createTestModel(resource); + + ProblemsManager mgr = getProblemsManager(transaction); + mgr.addDiagnostic(validate(resource)); + + mgr.purgeAllProblems(); + + assertThat(mgr.getAllProblems().hasNext(), is(false)); + } + + @Test + public void purge_noCrossReferencer() { + CDOTransaction transaction = createTransaction(); + CDOResource resource = transaction + .createResource(getResourcePath("/resource1")); + + createTestModel(resource); + + ProblemsManager mgr = getProblemsManager(transaction); + mgr.addDiagnostic(validate(resource)); + + mgr.purgeProblems(getClass3(resource)); + + Collection<EProblem> problems = collect(mgr.getAllProblems()); + assertThat(problems.size(), equalTo(2)); + assertIndistinguishableMembersProblem(resource, problems); + assertGeneralCompatibilityProblem(resource, problems); + } + + @Test + public void purge_crossReferencer() { + CDOTransaction transaction = createTransaction(); + CDOResource resource = transaction + .createResource(getResourcePath("/resource1")); + + // attach a cross-reference adapter + transaction.getResourceSet().eAdapters() + .add(new ECrossReferenceAdapter()); + + createTestModel(resource); + + ProblemsManager mgr = getProblemsManager(transaction); + mgr.addDiagnostic(validate(resource)); + + mgr.purgeProblems(getClass3(resource)); + + Collection<EProblem> problems = collect(mgr.getAllProblems()); + assertThat(problems.size(), equalTo(2)); + assertIndistinguishableMembersProblem(resource, problems); + assertGeneralCompatibilityProblem(resource, problems); + } + + @Test + public void disposeProblemsManager() + throws Exception { + + CDOTransaction transaction = createTransaction(); + CDOResource resource = transaction + .createResource(getResourcePath("/resource1")); + + // attach a cross-reference adapter + ECrossReferenceAdapter xrefs = new ECrossReferenceAdapter(); + transaction.getResourceSet().eAdapters().add(xrefs); + + createTestModel(resource); + + ProblemsManager mgr = getProblemsManager(transaction); + mgr.addDiagnostic(validate(resource)); + + // gather weak references to the problems + ReferenceQueue<EProblem> queue = new ReferenceQueue<EProblem>(); + List<Reference<EProblem>> references = new java.util.ArrayList<Reference<EProblem>>( + 3); + for (Iterator<EProblem> iter = mgr.getAllProblems(); iter.hasNext();) { + references.add(new WeakReference<EProblem>(iter.next(), queue)); + } + + mgr.dispose(); + + // try to force GC + for (int i = 0; i < 10; i++) { + System.gc(); + } + + // assert that the problems are unreachable + for (int i = 0; i < 3; i++) { + Reference<? extends EProblem> ref = queue.remove(1000); + assertThat(ref, notNullValue()); + } + } + + @Test + public void dispose_crossReferencerAddedAfter() + throws Exception { + + CDOTransaction transaction = createTransaction(); + CDOResource resource = transaction + .createResource(getResourcePath("/resource1")); + + createTestModel(resource); + + ProblemsManager mgr = getProblemsManager(transaction); + mgr.addDiagnostic(validate(resource)); + + // attach a cross-reference adapter *after* adding problems + ECrossReferenceAdapter xrefs = new ECrossReferenceAdapter(); + transaction.getResourceSet().eAdapters().add(xrefs); + + // gather weak references to the problems + ReferenceQueue<EProblem> queue = new ReferenceQueue<EProblem>(); + List<Reference<EProblem>> references = new java.util.ArrayList<Reference<EProblem>>( + 3); + for (Iterator<EProblem> iter = mgr.getAllProblems(); iter.hasNext();) { + references.add(new WeakReference<EProblem>(iter.next(), queue)); + } + + mgr.dispose(); + + // try to force GC + for (int i = 0; i < 10; i++) { + System.gc(); + } + + // assert that the problems are unreachable + for (int i = 0; i < 3; i++) { + Reference<? extends EProblem> ref = queue.remove(1000); + assertThat(ref, notNullValue()); + } + } + + @Test + public void customProblemClass() { + CDOTransaction transaction = createTransaction(); + CDOResource resource = transaction + .createResource(getResourcePath("/resource1")); + + createTestModel(resource); + + // not actually a different class, but a different way of creating it + ProblemsManager mgr = ProblemsManager.createProblemsManager( + transaction.getResourceSet(), ProblemsPackage.Literals.EPROBLEM); + managers.add(mgr); + mgr.addDiagnostic(validate(resource)); + + Collection<EProblem> allProblems = collect(mgr.getAllProblems()); + assertThat(allProblems.size(), equalTo(3)); + assertIndistinguishableMembersProblem(resource, allProblems); + assertGeneralCompatibilityProblem(resource, allProblems); + assertUnownedElementProblem(resource, allProblems); + } + + // + // Test framework + // + + @After + public void disposeProblemManagers() + throws Exception { + + for (ProblemsManager next : managers) { + next.dispose(); + } + } + + void createTestModel(Resource res) { + Model model = UMLFactory.eINSTANCE.createModel(); + model.setName("testmodel"); + res.getContents().add(model); + + Class class1 = model.createOwnedClass("Class1", false); + + Interface interface1 = model.createOwnedInterface("Interface1"); + + Class class2 = model.createOwnedClass("Class2", false); + class2.createGeneralization(interface1); // invalid generalization + class2.createOwnedAttribute("attr1", class1); + class2.createOwnedAttribute("attr1", class1); // indistinguishable + + Class class3 = UMLFactory.eINSTANCE.createClass(); + class3.setName("Class3"); + res.getContents().add(class3); // not owned + } + + Model getModel(Resource resource) { + return (Model) EcoreUtil.getObjectByType(resource.getContents(), + UMLPackage.Literals.MODEL); + } + + Class getClass1(Resource resource) { + return (Class) getModel(resource).getOwnedType("Class1"); + } + + Class getClass2(Resource resource) { + return (Class) getModel(resource).getOwnedType("Class2"); + } + + Class getClass3(Resource resource) { + return (Class) EcoreUtil.getObjectByType(resource.getContents(), + UMLPackage.Literals.CLASS); + } + + Interface getInterface1(Resource resource) { + return (Interface) getModel(resource).getOwnedType("Interface1"); + } + + ProblemsManager getProblemsManager(CDOView view) { + return getProblemsManager(view.getResourceSet()); + } + + ProblemsManager getProblemsManager(ResourceSet resourceSet) { + ProblemsManager result = ProblemsManager + .getProblemsManager(resourceSet); + managers.add(result); + return result; + } + + Diagnostic validate(Resource resource) { + EValidator.Registry registry = new EValidatorRegistryImpl( + EValidator.Registry.INSTANCE); + registry.put(UMLPackage.eINSTANCE, new UMLValidator()); + + BasicDiagnostic result = new BasicDiagnostic(); + Diagnostician diagnostician = new Diagnostician(registry); + + for (EObject next : resource.getContents()) { + diagnostician.validate(next, result); + } + + return result; + } + + Collection<EProblem> collect(Iterator<? extends EProblem> problems) { + Collection<EProblem> result = new java.util.ArrayList<EProblem>(); + + while (problems.hasNext()) { + result.add(problems.next()); + } + + return result; + } + + void assertProblem(Collection<EProblem> problems, ESeverity severity, + String source, int code, String messagePattern, EObject element, + EObject... related) { + + final List<EObject> relatedList = Arrays.asList(related); + final Pattern pattern = Pattern.compile(messagePattern); + + EProblem found = null; + for (EProblem problem : problems) { + if (problem.getElement() == element // + && problem.getRelated().equals(relatedList) // + && problem.getSeverity() == severity // + && pattern.matcher(problem.getMessage()).find() // + && source.equals(problem.getSource()) // + && problem.getCode() == code) { + found = problem; + break; + } + } + + assertThat(found, notNullValue()); + } + + void assertIndistinguishableMembersProblem(Resource resource, + Collection<EProblem> problems) { + + Class class2 = getClass2(resource); + + assertProblem(problems, ESeverity.WARNING, + UMLValidator.DIAGNOSTIC_SOURCE, + UMLValidator.NAMESPACE__MEMBERS_DISTINGUISHABLE, "disting", class2); + } + + void assertGeneralCompatibilityProblem(Resource resource, + Collection<EProblem> problems) { + + Class class2 = getClass2(resource); + Interface interface1 = getInterface1(resource); + + assertProblem(problems, ESeverity.WARNING, + UMLValidator.DIAGNOSTIC_SOURCE, + UMLValidator.CLASSIFIER__SPECIALIZE_TYPE, "special", class2, + interface1); + } + + void assertUnownedElementProblem(Resource resource, + Collection<EProblem> problems) { + + Class class3 = getClass3(resource); + + assertProblem(problems, ESeverity.WARNING, + UMLValidator.DIAGNOSTIC_SOURCE, UMLValidator.ELEMENT__HAS_OWNER, + "owned", class3); + } +} |