From 03df64d78dce344f951fa79eb44e23a3f54004b0 Mon Sep 17 00:00:00 2001 From: Nicolas FAUVERGUE Date: Wed, 24 Jun 2015 16:43:21 +0200 Subject: Bug 470865: [Stereotype Display] JUnit tests will be implemented for Stereotype Display Table https://bugs.eclipse.org/bugs/show_bug.cgi?id=470865 Add the stereotype display table tests Change-Id: I4ad524f056f24a698eeec718917d76a6d4b65134 Signed-off-by: Nicolas FAUVERGUE Reviewed-on: https://git.eclipse.org/r/50812 Tested-by: Hudson CI Reviewed-by: Gabriel Pascual Reviewed-by: Camille Letavernier --- .../.classpath | 7 + .../.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 291 +++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 68 +++ .../META-INF/MANIFEST.MF | 37 ++ .../about.html | 28 + .../build.properties | 8 + ...us.uml.nattable.stereotype.display.tests.launch | 48 ++ .../plugin.properties | 4 + .../pom.xml | 14 + .../resources/StereotypeDisplayTableTests.di | 2 + .../resources/StereotypeDisplayTableTests.notation | 242 ++++++++ .../StereotypeDisplayTableTests.profile.di | 2 + .../StereotypeDisplayTableTests.profile.notation | 248 ++++++++ .../StereotypeDisplayTableTests.profile.uml | 139 +++++ .../resources/StereotypeDisplayTableTests.uml | 40 ++ .../stereotype/display/tests/Activator.java | 72 +++ .../stereotype/display/tests/tests/AllTests.java | 26 + .../tests/tests/StereotypeDisplayTableTest.java | 592 ++++++++++++++++++ .../tests/StereotypeDisplayTableTestsUtils.java | 659 +++++++++++++++++++++ 20 files changed, 2555 insertions(+) create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.classpath create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.project create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.settings/org.eclipse.jdt.core.prefs create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.settings/org.eclipse.jdt.ui.prefs create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/about.html create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/build.properties create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/org.eclipse.papyrus.uml.nattable.stereotype.display.tests.launch create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/plugin.properties create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/pom.xml create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.di create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.notation create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.di create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.notation create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.uml create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.uml create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/Activator.java create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/AllTests.java create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java create mode 100644 tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTestsUtils.java (limited to 'tests/junit/plugins/uml/nattable') diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.classpath b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.classpath new file mode 100644 index 00000000000..e8ea977a694 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.project b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.project new file mode 100644 index 00000000000..6bbeff8e27c --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.uml.nattable.stereotype.display.tests + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..f08be2b06c4 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +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_method_declaration=0 +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_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +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_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.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=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +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=260 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +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=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_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=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_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +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_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +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=false +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=260 +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=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_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/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..954281dbc31 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..f50e9a576b5 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF @@ -0,0 +1,37 @@ +Manifest-Version: 1.0 +Require-Bundle: org.junit;bundle-version="4.11.0", + org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.papyrus.junit.utils;bundle-version="1.1.0", + org.eclipse.papyrus.uml.nattable.clazz.config.tests;bundle-version="1.1.0", + org.eclipse.papyrus.editor.integration.tests;bundle-version="1.1.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0", + org.eclipse.papyrus.junit.framework;bundle-version="1.1.0", + org.eclipse.uml2.uml, + org.eclipse.gmf.runtime.notation, + org.eclipse.papyrus.infra.core;bundle-version="1.1.0", + org.eclipse.gef, + org.eclipse.emf.transaction, + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0", + org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0", + org.eclipse.papyrus.infra.nattable.common;bundle-version="1.1.0", + org.eclipse.papyrus.infra.nattable;bundle-version="1.1.0", + org.eclipse.papyrus.infra.nattable.model;bundle-version="1.1.0", + org.eclipse.nebula.widgets.nattable.core;bundle-version="1.2.0", + org.eclipse.papyrus.uml.diagram.clazz;bundle-version="1.1.0", + org.eclipse.core.expressions, + org.eclipse.papyrus.uml.diagram.common;bundle-version="1.1.0", + org.eclipse.papyrus.infra.emf;bundle-version="1.1.0", + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.1.0" +Export-Package: org.eclipse.papyrus.uml.nattable.stereotype.display.tests.tests +Bundle-Vendor: %Bundle-Vendor +Bundle-ActivationPolicy: lazy +Bundle-Version: 1.1.0.qualifier +Bundle-Name: %Bundle-Name +Bundle-Localization: plugin +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.uml.nattable.stereotype.display.tests.Activator +Bundle-Description: %Bundle-Description +Bundle-SymbolicName: org.eclipse.papyrus.uml.nattable.stereotype.display.tests +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/about.html b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/about.html new file mode 100644 index 00000000000..d35d5aed64c --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

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 http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

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 http://www.eclipse.org.

+ + + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/build.properties b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/build.properties new file mode 100644 index 00000000000..4cb3ab7b83e --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/build.properties @@ -0,0 +1,8 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + about.html,\ + plugin.properties,\ + resources/ +src.includes = about.html diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/org.eclipse.papyrus.uml.nattable.stereotype.display.tests.launch b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/org.eclipse.papyrus.uml.nattable.stereotype.display.tests.launch new file mode 100644 index 00000000000..9a31882c379 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/org.eclipse.papyrus.uml.nattable.stereotype.display.tests.launch @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/plugin.properties b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/plugin.properties new file mode 100644 index 00000000000..52ac0bdabb2 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/plugin.properties @@ -0,0 +1,4 @@ +#Properties file for org.eclipse.papyrus.uml.nattable.stereotype.display.tests +Bundle-Vendor = Eclipse Modeling Project +Bundle-Name = Papyrus Stereotype Display Table Tests +Bundle-Description = This plugin provides Tests for the plugin org.eclipse.papyrus.uml.nattable.stereotype.display. \ No newline at end of file diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/pom.xml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/pom.xml new file mode 100644 index 00000000000..a00f75cc055 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + org.eclipse.papyrus.tests.releng + org.eclipse.papyrus + 1.1.0-SNAPSHOT + ../../../../../../releng/main-tests + + org.eclipse.papyrus.uml.nattable.stereotype.display.tests + org.eclipse.papyrus + 1.1.0-SNAPSHOT + eclipse-test-plugin + \ No newline at end of file diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.di b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.notation new file mode 100644 index 00000000000..120e3f3350f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.notation @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.di b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.di new file mode 100644 index 00000000000..bf9abab340f --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.di @@ -0,0 +1,2 @@ + + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.notation b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.notation new file mode 100644 index 00000000000..52a3b60d82e --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.notation @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.uml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.uml new file mode 100644 index 00000000000..99f427220ae --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.profile.uml @@ -0,0 +1,139 @@ + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.uml b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.uml new file mode 100644 index 00000000000..0ca289d5c9c --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/resources/StereotypeDisplayTableTests.uml @@ -0,0 +1,40 @@ + + + + + + + + + + + +
+ + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/Activator.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/Activator.java new file mode 100644 index 00000000000..7154f386480 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/Activator.java @@ -0,0 +1,72 @@ +/***************************************************************************** + * Copyright (c) 2015 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.stereotype.display.tests; + +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + /** The plug-in ID. */ + public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.nattable.stereotype.display.tests"; //$NON-NLS-1$ + + /** The shared instance. */ + private static Activator plugin; + + /** The log helper. */ + public static LogHelper log; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance. + * + * @return the shared instance. + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/AllTests.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/AllTests.java new file mode 100644 index 00000000000..be48e78c391 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/AllTests.java @@ -0,0 +1,26 @@ +/***************************************************************************** + * Copyright (c) 2015 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.stereotype.display.tests.tests; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ + StereotypeDisplayTableTest.class +}) +public class AllTests { + // JUnit 4 test suite +} diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java new file mode 100644 index 00000000000..5e04ca5e24e --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java @@ -0,0 +1,592 @@ +/***************************************************************************** + * Copyright (c) 2015 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.stereotype.display.tests.tests; + +import java.util.List; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.core.utils.ServiceUtils; +import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; +import org.eclipse.papyrus.infra.nattable.common.editor.NatTableEditor; +import org.eclipse.papyrus.infra.nattable.common.modelresource.PapyrusNattableModel; +import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; +import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration; +import org.eclipse.papyrus.infra.nattable.tree.CollapseAndExpandActionsEnum; +import org.eclipse.papyrus.infra.nattable.utils.TableHelper; +import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; +import org.eclipse.papyrus.junit.utils.DiagramUtils; +import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture; +import org.eclipse.papyrus.junit.utils.rules.PluginResource; +import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil; +import org.eclipse.papyrus.uml.nattable.stereotype.display.tests.Activator; +import org.eclipse.ui.IEditorPart; +import org.eclipse.uml2.uml.Model; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +/** + * This class allows to manage the tests of stereotype display table (creation, display and modification). + */ +@PluginResource("resources/StereotypeDisplayTableTests.di") +public class StereotypeDisplayTableTest extends AbstractPapyrusTest { + + /** + * The class diagram name. + */ + private static final String CLASS_DIAGRAM_NAME = "ClassDiagram"; + + /** + * The component diagram name. + */ + private static final String COMPONENT_DIAGRAM_NAME = "ComponentDiagram"; + + /** + * The class name. + */ + private static final String CLASS1_NAME = "Class1"; + + /** + * The interface name. + */ + private static final String INTERFACE1_NAME = "Interface1"; + + /** + * The component name. + */ + private static final String COMPONENT1_NAME = "Component1"; + + /** + * The port name. + */ + private static final String PORT1_NAME = "Port1"; + + /** + * The association name. + */ + private static final String ASSOCIATION1_NAME = "Association1"; + + /** + * The time observation name. + */ + private static final String TIME_OBSERVATION1_NAME = "TimeObservation1"; + + /** + * The URI of the table configuration. + */ + private static final String TABLE_CONFIRURATION = "platform:/plugin/org.eclipse.papyrus.uml.nattable.stereotype.display/config/stereotype.nattableconfiguration"; + + /** + * The number of column in the stereotype display table. + */ + private static final int COLUMN_NUMBER = 5; + + /** + * The number of rows for the object with the 'human' stereotype applied. + */ + private static final int NUMBER_ROWS_HUMAN_STEREOTYPE = 12; + + /** + * The number of rows for the object with the 'animal' stereotype applied. + */ + private static final int NUMBER_ROWS_ANIMAL_STEREOTYPE = 8; + + + /** + * The papyrus editor fixture. + */ + @Rule + public final PapyrusEditorFixture editorFixture = new PapyrusEditorFixture(); + + /** + * The class existing in the model. + */ + private org.eclipse.uml2.uml.Class class1 = null; + + /** + * The interface existing in the model. + */ + private org.eclipse.uml2.uml.Interface interface1 = null; + + /** + * The port existing in the model. + */ + private org.eclipse.uml2.uml.Port port1 = null; + + /** + * The association existing in the model. + */ + private org.eclipse.uml2.uml.Association association1 = null; + + /** + * The time observation existing in the model. + */ + private org.eclipse.uml2.uml.TimeObservation timeObservation1 = null; + + /** + * The singleton instance. + */ + private StereotypeDisplayUtil helper = StereotypeDisplayUtil.getInstance(); + + + /** + * Constructor. + */ + public StereotypeDisplayTableTest() { + super(); + } + + @Before + public void manageDiagram() { + // get all semantic element that will handled + final Model model = (Model) editorFixture.getModel(); + Assert.assertNotNull("RootModel is null", model); + + // Get the class and the interface in the model + class1 = (org.eclipse.uml2.uml.Class) model.getPackagedElement(CLASS1_NAME); + StringBuilder error = new StringBuilder(CLASS1_NAME); + error.append(" doesn't exist"); + Assert.assertNotNull(error.toString(), class1); + interface1 = (org.eclipse.uml2.uml.Interface) model.getPackagedElement(INTERFACE1_NAME); + error = new StringBuilder(INTERFACE1_NAME); + error.append(" doesn't exist"); + Assert.assertNotNull(error.toString(), interface1); + org.eclipse.uml2.uml.Component component1 = (org.eclipse.uml2.uml.Component) model.getPackagedElement(COMPONENT1_NAME); + error = new StringBuilder(COMPONENT1_NAME); + error.append(" doesn't exist"); + Assert.assertNotNull(error.toString(), component1); + port1 = (org.eclipse.uml2.uml.Port) component1.getOwnedPort(PORT1_NAME, null); + error = new StringBuilder(PORT1_NAME); + error.append(" doesn't exist"); + Assert.assertNotNull(error.toString(), port1); + association1 = (org.eclipse.uml2.uml.Association) model.getPackagedElement(ASSOCIATION1_NAME); + error = new StringBuilder(ASSOCIATION1_NAME); + error.append(" doesn't exist"); + Assert.assertNotNull(error.toString(), association1); + timeObservation1 = (org.eclipse.uml2.uml.TimeObservation) model.getPackagedElement(TIME_OBSERVATION1_NAME); + error = new StringBuilder(TIME_OBSERVATION1_NAME); + error.append(" doesn't exist"); + Assert.assertNotNull(error.toString(), timeObservation1); + } + + /** + * This allow to test the stereotype display for the class object. + * + * @throws Exception + * The exception + */ + @Test + public void testCreateStereotypedClassTable() throws Exception { + // Open the diagram + final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), CLASS_DIAGRAM_NAME); + editorFixture.getPageManager().openPage(mainDiagram); + Assert.assertEquals("Current opened diagram is not the expected one", CLASS_DIAGRAM_NAME, mainDiagram.getName()); + + // Get the class view + final View class1View = DiagramUtils.findShape(mainDiagram, CLASS1_NAME); + Assert.assertNotNull("Class view not present", class1View); + + // Select the class in the diagram + final EditPart classEP = editorFixture.findEditPart(class1); + editorFixture.select(classEP); + + final ISelection selection = editorFixture.getActiveDiagramEditor().getSite().getSelectionProvider().getSelection(); + final Object editorSelection = ((IStructuredSelection) selection).getFirstElement(); + + final StringBuilder error = new StringBuilder("The object selected is not the "); + error.append(CLASS1_NAME); + Assert.assertEquals(error.toString(), classEP, editorSelection); + + // Create the table + final ITreeNattableModelManager manager = createTable(class1View); + + // Check the columns + final List columnElements = manager.getColumnElementsList(); + Assert.assertEquals("The number of columns is not correct", COLUMN_NUMBER, columnElements.size()); + StereotypeDisplayTableTestsUtils.checkColumns(columnElements); + + // Check the rows elements + final List rowElements = manager.getRowElementsList(); + Assert.assertEquals("The number of rows is not correct", NUMBER_ROWS_HUMAN_STEREOTYPE, rowElements.size()); + StereotypeDisplayTableTestsUtils.checkClassRows(rowElements, 0, NUMBER_ROWS_HUMAN_STEREOTYPE); + + // Check the initial data in the table + StereotypeDisplayTableTestsUtils.checkInitialTableData(manager, 0, NUMBER_ROWS_HUMAN_STEREOTYPE); + + // Try to modify some values and check its result + StereotypeDisplayTableTestsUtils.modifyHumanStereotypedValues(helper, manager, class1View, class1, 0); + + // Reselect the main diagram page + editorFixture.getPageManager().selectPage(mainDiagram); + editorFixture.deselect(classEP); + editorFixture.flushDisplayEvents(); + } + + /** + * This allow to test the stereotype display for the interface object. + * + * @throws Exception + * The exception + */ + @Test + public void testCreateStereotypedInterfaceTable() throws Exception { + // Open the diagram + final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), CLASS_DIAGRAM_NAME); + editorFixture.getPageManager().openPage(mainDiagram); + Assert.assertEquals("Current opened diagram is not the expected one", CLASS_DIAGRAM_NAME, mainDiagram.getName()); + + // Get the interface view + final View interface1View = DiagramUtils.findShape(mainDiagram, INTERFACE1_NAME); + Assert.assertNotNull("Interface view not present", interface1View); + + // Select the class in the diagram + final EditPart interfaceEP = editorFixture.findEditPart(interface1); + editorFixture.select(interfaceEP); + + final ISelection selection = editorFixture.getActiveDiagramEditor().getSite().getSelectionProvider().getSelection(); + final Object editorSelection = ((IStructuredSelection) selection).getFirstElement(); + + final StringBuilder error = new StringBuilder("The object selected is not the "); + error.append(INTERFACE1_NAME); + Assert.assertEquals(error.toString(), interfaceEP, editorSelection); + + // Create the table + final ITreeNattableModelManager manager = createTable(interface1View); + + // Check the columns + final List columnElements = manager.getColumnElementsList(); + Assert.assertEquals("The number of columns is not correct", COLUMN_NUMBER, columnElements.size()); + StereotypeDisplayTableTestsUtils.checkColumns(columnElements); + + // Check the rows elements + final List rowElements = manager.getRowElementsList(); + Assert.assertEquals("The number of rows is not correct", NUMBER_ROWS_ANIMAL_STEREOTYPE, rowElements.size()); + StereotypeDisplayTableTestsUtils.checkInterfaceRows(rowElements, 0, NUMBER_ROWS_ANIMAL_STEREOTYPE); + + // Check the initial data in the table + StereotypeDisplayTableTestsUtils.checkInitialTableData(manager, 0, NUMBER_ROWS_ANIMAL_STEREOTYPE); + + // Try to modify some values and check its result + StereotypeDisplayTableTestsUtils.modifyAnimalStereotypedValues(helper, manager, interface1View, interface1, 0); + + // Reselect the main diagram page + editorFixture.getPageManager().selectPage(mainDiagram); + editorFixture.deselect(interfaceEP); + editorFixture.flushDisplayEvents(); + } + + /** + * This allow to test the stereotype display for the multiple object. + * + * @throws Exception + * The exception + */ + @Test + public void testCreateStereotypedClassAndInterfaceTable() throws Exception { + // Open the diagram + final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), CLASS_DIAGRAM_NAME); + editorFixture.getPageManager().openPage(mainDiagram); + Assert.assertEquals("Current opened diagram is not the expected one", CLASS_DIAGRAM_NAME, mainDiagram.getName()); + + // Get the interface view + final View class1View = DiagramUtils.findShape(mainDiagram, CLASS1_NAME); + Assert.assertNotNull("Class view not present", class1View); + final View interface1View = DiagramUtils.findShape(mainDiagram, INTERFACE1_NAME); + Assert.assertNotNull("Interface view not present", interface1View); + + // Select the class in the diagram + final EditPart classEP = editorFixture.findEditPart(class1); + editorFixture.select(classEP); + final EditPart interfaceEP = editorFixture.findEditPart(interface1); + editorFixture.select(interfaceEP); + + // Create the table + final ITreeNattableModelManager manager = createTable(class1View); + + // Check the columns + final List columnElements = manager.getColumnElementsList(); + Assert.assertEquals("The number of columns is not correct", COLUMN_NUMBER, columnElements.size()); + StereotypeDisplayTableTestsUtils.checkColumns(columnElements); + + // Check the rows elements + final List rowElements = manager.getRowElementsList(); + Assert.assertEquals("The number of rows is not correct", NUMBER_ROWS_HUMAN_STEREOTYPE + NUMBER_ROWS_ANIMAL_STEREOTYPE, rowElements.size()); + StereotypeDisplayTableTestsUtils.checkClassRows(rowElements, 0, NUMBER_ROWS_HUMAN_STEREOTYPE); + StereotypeDisplayTableTestsUtils.checkInterfaceRows(rowElements, NUMBER_ROWS_HUMAN_STEREOTYPE, NUMBER_ROWS_ANIMAL_STEREOTYPE); + + // Check the initial data in the table + StereotypeDisplayTableTestsUtils.checkInitialTableData(manager, 0, NUMBER_ROWS_HUMAN_STEREOTYPE); + StereotypeDisplayTableTestsUtils.checkInitialTableData(manager, NUMBER_ROWS_HUMAN_STEREOTYPE, NUMBER_ROWS_ANIMAL_STEREOTYPE); + + // Try to modify some values and check its result + StereotypeDisplayTableTestsUtils.modifyHumanStereotypedValues(helper, manager, class1View, class1, 0); + StereotypeDisplayTableTestsUtils.modifyAnimalStereotypedValues(helper, manager, interface1View, interface1, NUMBER_ROWS_HUMAN_STEREOTYPE); + + // Reselect the main diagram page + editorFixture.getPageManager().selectPage(mainDiagram); + editorFixture.deselect(classEP); + editorFixture.deselect(interfaceEP); + editorFixture.flushDisplayEvents(); + } + + /** + * This allow to test the stereotype display for the interface object. + * + * @throws Exception + * The exception + */ + @Test + public void testCreateStereotypedPortTable() throws Exception { + // Open the diagram + final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), COMPONENT_DIAGRAM_NAME); + editorFixture.getPageManager().openPage(mainDiagram); + Assert.assertEquals("Current opened diagram is not the expected one", COMPONENT_DIAGRAM_NAME, mainDiagram.getName()); + + // Get the interface view + final View component1View = DiagramUtils.findShape(mainDiagram, COMPONENT1_NAME); + Assert.assertNotNull("Component view not present", component1View); + final View port1View = DiagramUtils.findShape(component1View, PORT1_NAME); + Assert.assertNotNull("Port view not present", port1View); + + // Select the class in the diagram + final EditPart portEP = editorFixture.findEditPart(port1); + editorFixture.select(portEP); + + final ISelection selection = editorFixture.getActiveDiagramEditor().getSite().getSelectionProvider().getSelection(); + final Object editorSelection = ((IStructuredSelection) selection).getFirstElement(); + final StringBuilder error = new StringBuilder("The object selected is not the "); + error.append(PORT1_NAME); + Assert.assertEquals(error.toString(), portEP, editorSelection); + + // Create the table + final ITreeNattableModelManager manager = createTable(port1View); + + // Check the columns + final List columnElements = manager.getColumnElementsList(); + Assert.assertEquals("The number of columns is not correct", COLUMN_NUMBER, columnElements.size()); + StereotypeDisplayTableTestsUtils.checkColumns(columnElements); + + // Check the rows elements + final List rowElements = manager.getRowElementsList(); + Assert.assertEquals("The number of rows is not correct", NUMBER_ROWS_HUMAN_STEREOTYPE, rowElements.size()); + StereotypeDisplayTableTestsUtils.checkPortRows(rowElements, 0, NUMBER_ROWS_HUMAN_STEREOTYPE); + + // Check the initial data in the table + StereotypeDisplayTableTestsUtils.checkInitialTableData(manager, 0, NUMBER_ROWS_HUMAN_STEREOTYPE, false, false, true); + + // Try to modify some values and check its result + StereotypeDisplayTableTestsUtils.modifyHumanStereotypedValues(helper, manager, port1View, port1, 0); + + // Reselect the main diagram page + editorFixture.getPageManager().selectPage(mainDiagram); + editorFixture.deselect(portEP); + editorFixture.flushDisplayEvents(); + } + + /** + * This allow to test the stereotype display for the association object. + * + * @throws Exception + * The exception + */ + @Test + public void testCreateStereotypedAssociationTable() throws Exception { + // Open the diagram + final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), CLASS_DIAGRAM_NAME); + editorFixture.getPageManager().openPage(mainDiagram); + Assert.assertEquals("Current opened diagram is not the expected one", CLASS_DIAGRAM_NAME, mainDiagram.getName()); + + // Get the interface view + final View associationView = DiagramUtils.findEdge(mainDiagram, ASSOCIATION1_NAME); + Assert.assertNotNull("Association view not present", associationView); + + // Select the class in the diagram + final EditPart associationEP = editorFixture.findEditPart(association1); + editorFixture.select(associationEP); + + final ISelection selection = editorFixture.getActiveDiagramEditor().getSite().getSelectionProvider().getSelection(); + final Object editorSelection = ((IStructuredSelection) selection).getFirstElement(); + final StringBuilder error = new StringBuilder("The object selected is not the "); + error.append(ASSOCIATION1_NAME); + Assert.assertEquals(error.toString(), associationEP, editorSelection); + + // Create the table + final ITreeNattableModelManager manager = createTable(associationView); + + // Check the columns + final List columnElements = manager.getColumnElementsList(); + Assert.assertEquals("The number of columns is not correct", COLUMN_NUMBER, columnElements.size()); + StereotypeDisplayTableTestsUtils.checkColumns(columnElements); + + // Check the rows elements + final List rowElements = manager.getRowElementsList(); + Assert.assertEquals("The number of rows is not correct", NUMBER_ROWS_ANIMAL_STEREOTYPE, rowElements.size()); + StereotypeDisplayTableTestsUtils.checkAssociationRows(rowElements, 0, NUMBER_ROWS_ANIMAL_STEREOTYPE); + + // Check the initial data in the table + StereotypeDisplayTableTestsUtils.checkInitialTableData(manager, 0, NUMBER_ROWS_ANIMAL_STEREOTYPE, true, false, true); + + // Try to modify some values and check its result + StereotypeDisplayTableTestsUtils.modifyAnimalStereotypedValues(helper, manager, associationView, association1, 0); + + // Reselect the main diagram page + editorFixture.getPageManager().selectPage(mainDiagram); + editorFixture.deselect(associationEP); + editorFixture.flushDisplayEvents(); + } + + /** + * This allow to test the stereotype display for the time observation object. + * + * @throws Exception + * The exception + */ + @Test + public void testCreateStereotypedTimeObservationTable() throws Exception { + // Open the diagram + final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), CLASS_DIAGRAM_NAME); + editorFixture.getPageManager().openPage(mainDiagram); + Assert.assertEquals("Current opened diagram is not the expected one", CLASS_DIAGRAM_NAME, mainDiagram.getName()); + + // Get the interface view + final View timeObservationView = DiagramUtils.findShape(mainDiagram, TIME_OBSERVATION1_NAME); + Assert.assertNotNull("Time Observation view not present", timeObservationView); + + // Select the class in the diagram + final EditPart timeObservationEP = editorFixture.findEditPart(timeObservation1); + editorFixture.select(timeObservationEP); + + final ISelection selection = editorFixture.getActiveDiagramEditor().getSite().getSelectionProvider().getSelection(); + final Object editorSelection = ((IStructuredSelection) selection).getFirstElement(); + final StringBuilder error = new StringBuilder("The object selected is not the "); + error.append(TIME_OBSERVATION1_NAME); + Assert.assertEquals(error.toString(), timeObservationEP, editorSelection); + + // Create the table + final ITreeNattableModelManager manager = createTable(timeObservationView); + + // Check the columns + final List columnElements = manager.getColumnElementsList(); + Assert.assertEquals("The number of columns is not correct", COLUMN_NUMBER, columnElements.size()); + StereotypeDisplayTableTestsUtils.checkColumns(columnElements); + + // Check the rows elements + final List rowElements = manager.getRowElementsList(); + Assert.assertEquals("The number of rows is not correct", NUMBER_ROWS_ANIMAL_STEREOTYPE, rowElements.size()); + StereotypeDisplayTableTestsUtils.checkTimeObservationRows(rowElements, 0, NUMBER_ROWS_ANIMAL_STEREOTYPE); + + // Check the initial data in the table + StereotypeDisplayTableTestsUtils.checkInitialTableData(manager, 0, NUMBER_ROWS_ANIMAL_STEREOTYPE); + + // Try to modify some values and check its result + StereotypeDisplayTableTestsUtils.modifyAnimalStereotypedValues(helper, manager, timeObservationView, association1, 0); + + // Reselect the main diagram page + editorFixture.getPageManager().selectPage(mainDiagram); + editorFixture.deselect(timeObservationEP); + editorFixture.flushDisplayEvents(); + } + + /** + * This allow to create the table and the nattable manager. + * + * @param context The context of the table. + * @return The created nattable manager. + * @throws Exception The exception. + */ + public ITreeNattableModelManager createTable(final View context) throws Exception{ + ITreeNattableModelManager manager = null; + + // Create the table from the selected class in the diagram + createEditorTable(context); + editorFixture.flushDisplayEvents(); + + // The new editor is the table + final IEditorPart timeObservationTableEditor = editorFixture.getEditor().getActiveEditor(); + Assert.assertTrue(timeObservationTableEditor instanceof NatTableEditor); + manager = (ITreeNattableModelManager) timeObservationTableEditor.getAdapter(INattableModelManager.class); + + // expand the table + manager.doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null); + editorFixture.flushDisplayEvents(); + + return manager; + } + + /** + * Create a model identifying the editor. This model will be saved with the sash. + * + * @param view + * The view context of the table. + * @throws Exception + * The exception. + */ + protected void createEditorTable(final View view) throws Exception { + final ServicesRegistry serviceRegistry = ServiceUtilsForEObject.getInstance().getServiceRegistry(view); + final ModelSet modelSet = ServiceUtils.getInstance().getModelSet(serviceRegistry); + final TableConfiguration configuration = getDefaultTableEditorConfiguration(modelSet); + Assert.assertNotNull(configuration); + + final TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry); + domain.getCommandStack().execute(new RecordingCommand(domain) { + @Override + protected void doExecute() { + Table editorModel; + try { + editorModel = TableHelper.createTable(configuration, view, configuration.getName(), description); + // Save the model in the associated resource + final PapyrusNattableModel model = (PapyrusNattableModel) modelSet.getModelChecked(PapyrusNattableModel.MODEL_ID); + model.addPapyrusTable(editorModel); + + // Get the manager allowing to add/open new editor. + final IPageManager pageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry); + pageMngr.openPage(editorModel); + } catch (Exception e) { + Activator.log.error(e); + } + } + }); + } + + /** + * Get the configuration to use for the new table + * + * @param resourceSet + * The resource set. + * @return The configuration to use for the new table + */ + protected TableConfiguration getDefaultTableEditorConfiguration(final ResourceSet resourceSet) { + final Resource resource = resourceSet.getResource(URI.createURI(TABLE_CONFIRURATION), true); + TableConfiguration tableConfiguration = null; + if (resource.getContents().get(0) instanceof TableConfiguration) { + tableConfiguration = (TableConfiguration) resource.getContents().get(0); + } + return tableConfiguration; + } +} diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTestsUtils.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTestsUtils.java new file mode 100644 index 00000000000..1b9147c8e12 --- /dev/null +++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTestsUtils.java @@ -0,0 +1,659 @@ +/***************************************************************************** + * Copyright (c) 2015 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: + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.nattable.stereotype.display.tests.tests; + +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.notation.DecorationNode; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EOperationAxis; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.EStructuralFeatureAxis; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis; +import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration; +import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil; +import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.Stereotype; +import org.eclipse.uml2.uml.UMLPackage; +import org.junit.Assert; + +/** + * This class allows to define the methods to check the table data. + */ +public class StereotypeDisplayTableTestsUtils { + + /** + * The class name. + */ + private static final String CLASS1_NAME = "Class1"; + + /** + * The interface name. + */ + private static final String INTERFACE1_NAME = "Interface1"; + + /** + * The port name. + */ + private static final String PORT1_NAME = "Port1"; + + /** + * The association name. + */ + private static final String ASSOCIATION1_NAME = "Association1"; + + /** + * The time observation name. + */ + private static final String TIME_OBSERVATION1_NAME = "TimeObservation1"; + + /** + * The human stereotype name. + */ + private static final String HUMAN_STEREOTYPE = "Human"; + + /** + * The animal stereotype name. + */ + private static final String ANIMAL_STEREOTYPE = "Animal"; + + /** + * The non available value. + */ + private static final String NA = "N/A"; + + /** + * Check the columns. + * + * @param columnElements + * The column elements. + * @throws Exception + * The exception. + */ + public static void checkColumns(final List columnElements) throws Exception { + int indexColumn = 0; + final IAxis firstColumn = (IAxis) columnElements.get(indexColumn); + final Object firstColumnRepresentedElement = firstColumn.getElement(); + Assert.assertEquals("stereotype_display_properties:/nameDepth", firstColumnRepresentedElement); + indexColumn++; + + final IAxis secondColumn = (IAxis) columnElements.get(indexColumn); + final Object secondColumnRepresentedElement = secondColumn.getElement(); + Assert.assertEquals("stereotype_display_properties:/isDisplayed", secondColumnRepresentedElement); + indexColumn++; + + final IAxis thirdColumn = (IAxis) columnElements.get(indexColumn); + final Object thirdColumnRepresentedElement = thirdColumn.getElement(); + Assert.assertEquals("stereotype_display_properties:/isDisplayedInBraces", thirdColumnRepresentedElement); + indexColumn++; + + final IAxis fourthColumn = (IAxis) columnElements.get(indexColumn); + final Object fourthColumnRepresentedElement = fourthColumn.getElement(); + Assert.assertEquals("stereotype_display_properties:/isDisplayedInComment", fourthColumnRepresentedElement); + indexColumn++; + + final IAxis fifthColumn = (IAxis) columnElements.get(indexColumn); + final Object fifthColumnRepresentedElement = fifthColumn.getElement(); + Assert.assertEquals("stereotype_display_properties:/isDisplayedInCompartment", fifthColumnRepresentedElement); + } + + /** + * Check the rows concerning the Class object. + * + * @param rowElements + * The row elements. + * @param firstPosition + * The position of the first object to inspect. + * @param rowsNumberToCheck + * The rows number to check. + * @throws Exception + * The exception. + */ + public static void checkClassRows(final List rowElements, final int firstPosition, final int rowsNumberToCheck) throws Exception { + // Check the generic rows + checkGenericRows(rowElements, firstPosition, rowsNumberToCheck, HUMAN_STEREOTYPE); + + // Check the specific row + int indexRow = firstPosition + 2; + final IAxis thirdRow = (IAxis) rowElements.get(indexRow); + final Object thirdRowRepresentedElement = thirdRow.getElement(); + Assert.assertEquals(UMLPackage.eINSTANCE.getClass_(), ((EObject) thirdRowRepresentedElement).eClass()); + Assert.assertEquals(CLASS1_NAME, ((org.eclipse.uml2.uml.Class) thirdRowRepresentedElement).getName()); + } + + /** + * Check the rows for the interface object. + * + * @param rowElements + * The rows elements. + * @param firstPosition + * The position of the first object to inspect. + * @param rowsNumberToCheck + * The rows number to check. + * @throws Exception + * The exception. + */ + public static void checkInterfaceRows(final List rowElements, final int firstPosition, final int rowsNumberToCheck) throws Exception { + // Check the generic rows + checkGenericRows(rowElements, firstPosition, rowsNumberToCheck, ANIMAL_STEREOTYPE); + + // Check the specific row + int indexRow = firstPosition + 2; + final IAxis thirdRow = (IAxis) rowElements.get(indexRow); + final Object thirdRowRepresentedElement = thirdRow.getElement(); + Assert.assertEquals(UMLPackage.eINSTANCE.getInterface(), ((EObject) thirdRowRepresentedElement).eClass()); + Assert.assertEquals(INTERFACE1_NAME, ((org.eclipse.uml2.uml.Interface) thirdRowRepresentedElement).getName()); + } + + /** + * Check the rows concerning the Class object. + * + * @param rowElements + * The row elements. + * @param firstPosition + * The position of the first object to inspect. + * @param rowsNumberToCheck + * The rows number to check. + * @throws Exception + * The exception. + */ + public static void checkPortRows(final List rowElements, final int firstPosition, final int rowsNumberToCheck) throws Exception { + // Check the generic rows + checkGenericRows(rowElements, firstPosition, rowsNumberToCheck, HUMAN_STEREOTYPE); + + // Check the specific row + int indexRow = firstPosition + 2; + final IAxis thirdRow = (IAxis) rowElements.get(indexRow); + final Object thirdRowRepresentedElement = thirdRow.getElement(); + Assert.assertEquals(UMLPackage.eINSTANCE.getPort(), ((EObject) thirdRowRepresentedElement).eClass()); + Assert.assertEquals(PORT1_NAME, ((org.eclipse.uml2.uml.Port) thirdRowRepresentedElement).getName()); + } + + /** + * Check the rows concerning the Class object. + * + * @param rowElements + * The row elements. + * @param firstPosition + * The position of the first object to inspect. + * @param rowsNumberToCheck + * The rows number to check. + * @throws Exception + * The exception. + */ + public static void checkAssociationRows(final List rowElements, final int firstPosition, final int rowsNumberToCheck) throws Exception { + // Check the generic rows + checkGenericRows(rowElements, firstPosition, rowsNumberToCheck, ANIMAL_STEREOTYPE); + + // Check the specific row + int indexRow = firstPosition + 2; + final IAxis thirdRow = (IAxis) rowElements.get(indexRow); + final Object thirdRowRepresentedElement = thirdRow.getElement(); + Assert.assertEquals(UMLPackage.eINSTANCE.getAssociation(), ((EObject) thirdRowRepresentedElement).eClass()); + Assert.assertEquals(ASSOCIATION1_NAME, ((org.eclipse.uml2.uml.Association) thirdRowRepresentedElement).getName()); + } + + /** + * Check the rows concerning the Class object. + * + * @param rowElements + * The row elements. + * @param firstPosition + * The position of the first object to inspect. + * @param rowsNumberToCheck + * The rows number to check. + * @throws Exception + * The exception. + */ + public static void checkTimeObservationRows(final List rowElements, final int firstPosition, final int rowsNumberToCheck) throws Exception { + // Check the generic rows + checkGenericRows(rowElements, firstPosition, rowsNumberToCheck, ANIMAL_STEREOTYPE); + + // Check the specific row + int indexRow = firstPosition + 2; + final IAxis thirdRow = (IAxis) rowElements.get(indexRow); + final Object thirdRowRepresentedElement = thirdRow.getElement(); + Assert.assertEquals(UMLPackage.eINSTANCE.getTimeObservation(), ((EObject) thirdRowRepresentedElement).eClass()); + Assert.assertEquals(TIME_OBSERVATION1_NAME, ((org.eclipse.uml2.uml.TimeObservation) thirdRowRepresentedElement).getName()); + } + + /** + * Check the generic rows for the stereotype display table. + * + * @param rowElements + * The row elements. + * @param firstPosition + * The position of the first object to inspect. + * @param rowsNumberToCheck + * The rows number to check. + * @param stereotypeNameApplied + * The name of the stereotype applied. + * @throws Exception + * The exception. + */ + private static void checkGenericRows(final List rowElements, final int firstPosition, final int rowsNumberToCheck, final String stereotypeNameApplied) throws Exception { + int indexRow = firstPosition; + final IAxis firstRow = (IAxis) rowElements.get(indexRow); + final Object firstRowRepresentedElement = firstRow.getElement(); + Assert.assertTrue("The first row is not a view", firstRowRepresentedElement instanceof View); + indexRow++; + + final IAxis secondRow = (IAxis) rowElements.get(indexRow); + final Object secondRowRepresentedElement = secondRow.getElement(); + Assert.assertTrue(secondRowRepresentedElement instanceof TreeFillingConfiguration); + final IAxis secondAxis = ((TreeFillingConfiguration) secondRowRepresentedElement).getAxisUsedAsAxisProvider(); + Assert.assertTrue(secondAxis instanceof EStructuralFeatureAxis); + Assert.assertEquals(NotationPackage.eINSTANCE.getView_Element(), secondAxis.getElement()); + indexRow++; + + // The third row is specific, don't check it here + indexRow++; + + final IAxis fourthRow = (IAxis) rowElements.get(indexRow); + final Object fourthRowRepresentedElement = fourthRow.getElement(); + Assert.assertTrue(fourthRowRepresentedElement instanceof TreeFillingConfiguration); + final IAxis fourthAxis = ((TreeFillingConfiguration) fourthRowRepresentedElement).getAxisUsedAsAxisProvider(); + Assert.assertTrue(fourthAxis instanceof EOperationAxis); + Assert.assertEquals(UMLPackage.eINSTANCE.getElement__GetAppliedStereotypes(), fourthAxis.getElement()); + indexRow++; + + final IAxis fifthRow = (IAxis) rowElements.get(indexRow); + final Object fifthRowRepresentedElement = fifthRow.getElement(); + Assert.assertEquals(UMLPackage.eINSTANCE.getStereotype(), ((EObject) fifthRowRepresentedElement).eClass()); + Assert.assertEquals(stereotypeNameApplied, ((org.eclipse.uml2.uml.Stereotype) fifthRowRepresentedElement).getName()); + indexRow++; + + final IAxis sixthRow = (IAxis) rowElements.get(indexRow); + final Object sixthRowRepresentedElement = sixthRow.getElement(); + Assert.assertTrue(sixthRowRepresentedElement instanceof TreeFillingConfiguration); + final IAxis sixthAxis = ((TreeFillingConfiguration) sixthRowRepresentedElement).getAxisUsedAsAxisProvider(); + Assert.assertTrue(sixthAxis instanceof EOperationAxis); + Assert.assertEquals(UMLPackage.eINSTANCE.getClassifier__GetAllAttributes(), sixthAxis.getElement()); + indexRow++; + + for (; indexRow < firstPosition + rowsNumberToCheck; indexRow++) { + final IAxis lastRow = (IAxis) rowElements.get(indexRow); + final Object lastRowRepresentedElement = lastRow.getElement(); + final StringBuilder errorMessage = new StringBuilder("The object at row "); + errorMessage.append(indexRow); + errorMessage.append(" is not a property"); + Assert.assertEquals(errorMessage.toString(), UMLPackage.eINSTANCE.getProperty(), ((EObject) lastRowRepresentedElement).eClass()); + } + } + + /** + * Check the initial data in the table. + * + * @param manager + * The tree table model manager. + * @param firstPosition + * The first position which one to check. + * @param rowsNumberToCheck + * The number of rows to check. + * @throws Exception + * The exception. + */ + public static void checkInitialTableData(final ITreeNattableModelManager manager, final int firstPosition, final int rowsNumberToCheck) throws Exception { + checkInitialTableData(manager, firstPosition, rowsNumberToCheck, false, false, false); + } + + /** + * Check the initial data in the table. + * + * @param manager + * The tree table model manager. + * @param firstPosition + * The first position which one to check. + * @param rowsNumberToCheck + * The number of rows to check. + * @param isBracesNA + * Boolean to determinate if the column 'In Braces' fill be filled by 'N/A' value. + * @param isCommentNA + * Boolean to determinate if the column 'In Comment' fill be filled by 'N/A' value. + * @param isCompartmentNA + * Boolean to determinate if the column 'In Compartment' fill be filled by 'N/A' value. + * @throws Exception + * The exception. + */ + public static void checkInitialTableData(final ITreeNattableModelManager manager, final int firstPosition, final int rowsNumberToCheck, final boolean isBracesNA, final boolean isCommentNA, final boolean isCompartmentNA) throws Exception { + // Check name depth + int columnIndex = 0; + for (int rowIndex = firstPosition; rowIndex < firstPosition + rowsNumberToCheck; rowIndex++) { + final Object depthValue = manager.getDataValue(columnIndex, rowIndex); + // The depth value is initialized only for the Stereotype object + if ((firstPosition + 4) == rowIndex) { + final StringBuilder errorMessage = new StringBuilder("The initial value of depth will be 'none' for row "); + errorMessage.append(rowIndex); + Assert.assertEquals(errorMessage.toString() + rowIndex, "none", depthValue); + } else { + final StringBuilder errorMessage = new StringBuilder("The depth value won't be initialized for row "); + errorMessage.append(rowIndex); + Assert.assertTrue(errorMessage.toString(), depthValue instanceof String); + Assert.assertTrue(errorMessage.toString(), ((String) depthValue).isEmpty()); + } + } + + // Check Visible + columnIndex++; + for (int rowIndex = firstPosition; rowIndex < firstPosition + rowsNumberToCheck; rowIndex++) { + final Object visibleValue = manager.getDataValue(columnIndex, rowIndex); + if ((firstPosition + 4) == rowIndex) { + final StringBuilder errorMessage = new StringBuilder("The visible display value will be true by intiialisation for row "); + errorMessage.append(rowIndex); + Assert.assertEquals(errorMessage.toString(), true, visibleValue); + } else { + final StringBuilder errorMessage = new StringBuilder("The visible display value won't be initialized for row "); + errorMessage.append(rowIndex); + Assert.assertTrue(errorMessage.toString(), visibleValue instanceof String); + Assert.assertTrue(errorMessage.toString(), ((String) visibleValue).isEmpty()); + } + } + + // Check Braces + checkInitialBracesColumn(manager, firstPosition, rowsNumberToCheck, isBracesNA); + + // Check Comment + checkInitialCommentColumn(manager, firstPosition, rowsNumberToCheck, isCommentNA); + + // Check Compartment + checkInitialCompartmentColumn(manager, firstPosition, rowsNumberToCheck, isCompartmentNA); + } + + /** + * Check the initial data in the 'In Braces' column. + * + * @param manager + * The tree table model manager. + * @param firstPosition + * The first position which one to check. + * @param rowsNumberToCheck + * The number of rows to check. + * @param isBracesNA + * Boolean to determinate if the column 'In Braces' fill be filled by 'N/A' value. + * @throws Exception + * The exception. + */ + private static void checkInitialBracesColumn(final ITreeNattableModelManager manager, final int firstPosition, final int rowsNumberToCheck, final boolean isBracesNA) throws Exception { + // Check Braces + int columnIndex = 2; + for (int rowIndex = firstPosition; rowIndex < firstPosition + rowsNumberToCheck; rowIndex++) { + final Object braceValue = manager.getDataValue(columnIndex, rowIndex); + if ((firstPosition + 4) == rowIndex || (firstPosition + 6) <= rowIndex) { + Object valueToCheck = true; + if (isBracesNA){ + valueToCheck = NA; + }else if ((firstPosition + 4) == rowIndex) { + valueToCheck = false; + } + + final StringBuilder errorMessage = new StringBuilder("The braces display value will be initiazed by '"); + errorMessage.append(valueToCheck); + errorMessage.append("' value for row "); + errorMessage.append(rowIndex); + Assert.assertEquals(errorMessage.toString(), valueToCheck, braceValue); + } else { + final StringBuilder errorMessage = new StringBuilder("The braces display value won't be initialized for row "); + errorMessage.append(rowIndex); + Assert.assertTrue(errorMessage.toString(), braceValue instanceof String); + Assert.assertTrue(errorMessage.toString(), ((String) braceValue).isEmpty()); + } + } + } + + /** + * Check the initial data in the 'In Comment' column. + * + * @param manager + * The tree table model manager. + * @param firstPosition + * The first position which one to check. + * @param rowsNumberToCheck + * The number of rows to check. + * @param isCommentNA + * Boolean to determinate if the column 'In Comment' fill be filled by 'N/A' value. + * @throws Exception + * The exception. + */ + private static void checkInitialCommentColumn(final ITreeNattableModelManager manager, final int firstPosition, final int rowsNumberToCheck, final boolean isCommentNA) throws Exception { + // Check Comment + int columnIndex = 3; + for (int rowIndex = firstPosition; rowIndex < firstPosition + rowsNumberToCheck; rowIndex++) { + final Object commentValue = manager.getDataValue(columnIndex, rowIndex); + if ((firstPosition + 4) == rowIndex || (firstPosition + 6) <= rowIndex) { + Object valueToCheck = true; + if (isCommentNA){ + valueToCheck = NA; + }else if ((firstPosition + 4) == rowIndex) { + valueToCheck = false; + } + + final StringBuilder errorMessage = new StringBuilder("The comment display value will be initiazed by '"); + errorMessage.append(valueToCheck); + errorMessage.append("' value for row "); + errorMessage.append(rowIndex); + Assert.assertEquals(errorMessage.toString(), valueToCheck, commentValue); + } else { + final StringBuilder errorMessage = new StringBuilder("The comment display value won't be initialized for row "); + errorMessage.append(rowIndex); + Assert.assertTrue(errorMessage.toString(), commentValue instanceof String); + Assert.assertTrue(errorMessage.toString(), ((String) commentValue).isEmpty()); + } + } + } + + /** + * Check the initial data in the 'In Compartment' column. + * + * @param manager + * The tree table model manager. + * @param firstPosition + * The first position which one to check. + * @param rowsNumberToCheck + * The number of rows to check. + * @param isCompartmentNA + * Boolean to determinate if the column 'In Compartment' fill be filled by 'N/A' value. + * @throws Exception + * The exception. + */ + private static void checkInitialCompartmentColumn(final ITreeNattableModelManager manager, final int firstPosition, final int rowsNumberToCheck, final boolean isCompartmentNA) throws Exception { + // Check Compartment + int columnIndex = 4; + for (int rowIndex = firstPosition; rowIndex < firstPosition + rowsNumberToCheck; rowIndex++) { + final Object compartmentValue = manager.getDataValue(columnIndex, rowIndex); + if ((firstPosition + 4) == rowIndex || (firstPosition + 6) <= rowIndex) { + Object valueToCheck = true; + if (isCompartmentNA){ + valueToCheck = NA; + }else if ((firstPosition + 4) == rowIndex) { + valueToCheck = false; + } + + final StringBuilder errorMessage = new StringBuilder("The compartment display value will be initiazed by '"); + errorMessage.append(valueToCheck); + errorMessage.append("' value for row "); + errorMessage.append(rowIndex); + Assert.assertEquals(errorMessage.toString(), valueToCheck, compartmentValue); + } else { + final StringBuilder errorMessage = new StringBuilder("The compartment display value won't be initialized for row "); + errorMessage.append(rowIndex); + Assert.assertTrue(errorMessage.toString(), compartmentValue instanceof String); + Assert.assertTrue(errorMessage.toString(), ((String) compartmentValue).isEmpty()); + } + } + } + + + /** + * Try to modify some values in the human stereotyped object table value. + * + * @param helper + * The Stereotype display helper. + * @param manager + * The tree nattable model manager. + * @param class1View + * The view of the class1. + * @param firstPosition + * The first row position. + * @throws Exception + * The exception. + */ + public static void modifyHumanStereotypedValues(final StereotypeDisplayUtil helper, final ITreeNattableModelManager manager, final View class1View, final Element class1, final int firstPosition) throws Exception { + final Stereotype humanStereotype = class1.getAppliedStereotype("RootElement::Body::Human"); + final View label = helper.getStereotypeLabel(class1View, humanStereotype); + Assert.assertTrue("Label have to be a decoration node", label instanceof DecorationNode); + + // Modify the depth value + Assert.assertEquals("The initial depth is not correct", "Human", helper.getStereotypeName((DecorationNode) label)); + manager.setDataValue(0, firstPosition + 4, "-1"); + Assert.assertEquals("The depth was not modified", "Body::Human", helper.getStereotypeName((DecorationNode) label)); + manager.setDataValue(0, firstPosition + 4, "full"); + Assert.assertEquals("The depth was not modified", "RootElement::Body::Human", helper.getStereotypeName((DecorationNode) label)); + + // Modify the visible value + Assert.assertEquals("The initial 'Visible' value is not correct", true, label.isVisible()); + manager.setDataValue(1, firstPosition + 4, false); + Assert.assertEquals("The 'Visible' value was not modified", false, label.isVisible()); + + modifyBooleanValues(helper, manager, class1View, humanStereotype, firstPosition); + } + + /** + * Try to modify some values in the animal stereotyped object table value. + * + * @param helper + * The Stereotype display helper. + * @param manager + * The tree nattable model manager. + * @param interface1View + * The view of the interface1. + * @param firstPosition + * The first row position. + * @throws Exception + * The exception. + */ + public static void modifyAnimalStereotypedValues(final StereotypeDisplayUtil helper, final ITreeNattableModelManager manager, final View interface1View, final Element interface1, final int firstPosition) throws Exception { + final Stereotype animalStereotype = interface1.getAppliedStereotype("RootElement::Body::Animal"); + final View label = helper.getStereotypeLabel(interface1View, animalStereotype); + Assert.assertTrue("Label have to be a decoration node", label instanceof DecorationNode); + + // Modify the depth value + Assert.assertEquals("The initial depth is not correct", "Animal", helper.getStereotypeName((DecorationNode) label)); + manager.setDataValue(0, firstPosition + 4, "-1"); + Assert.assertEquals("The depth was not modified", "Body::Animal", helper.getStereotypeName((DecorationNode) label)); + manager.setDataValue(0, firstPosition + 4, "full"); + Assert.assertEquals("The depth was not modified", "RootElement::Body::Animal", helper.getStereotypeName((DecorationNode) label)); + + // Modify the visible value + Assert.assertEquals("The initial 'Visible' value is not correct", true, label.isVisible()); + manager.setDataValue(1, firstPosition + 4, false); + Assert.assertEquals("The 'Visible' value was not modified", false, label.isVisible()); + + modifyBooleanValues(helper, manager, interface1View, animalStereotype, firstPosition); + } + + /** + * Check the boolean values ('In Braces', 'In comment' and 'In Compartment') in the table. + * + * @param helper + * The Stereotype display helper. + * @param manager + * The tree nattable model manager. + * @param view + * The view. + * @param stereotype + * The applied stereotype. + * @param firstPosition + * The first row position. + */ + private static void modifyBooleanValues(final StereotypeDisplayUtil helper, final ITreeNattableModelManager manager, final View view, final Stereotype stereotype, final int firstPosition) { + // Modify the in braces values + final Object braceValue = manager.getDataValue(2, firstPosition + 4); + if(!braceValue.equals(NA)){ + final View brace = helper.getStereotypeBraceCompartment(view, stereotype); + Assert.assertEquals("The initial 'In Braces' value is not correct", false, brace.isVisible()); + manager.setDataValue(2, firstPosition + 4, true); + Assert.assertEquals("The 'In Braces' value was not modified", true, brace.isVisible()); + int rowPosition = 6; + for (Property property : stereotype.getAllAttributes()) { + if (StereotypeUtil.isValidStereotypeProperty(property)) { + StringBuilder errorMessage = new StringBuilder("The initial 'In Braces' value is not correct for property '"); + errorMessage.append(property.getName()); + errorMessage.append("'"); + View braceProperty = helper.getStereotypePropertyInBrace(view, stereotype, property); + Assert.assertEquals(errorMessage.toString(), true, braceProperty.isVisible()); + manager.setDataValue(2, firstPosition + rowPosition, false); + errorMessage = new StringBuilder("The 'In Braces' value was not modified on property '"); + errorMessage.append(property.getName()); + errorMessage.append("'"); + Assert.assertEquals(errorMessage.toString(), false, braceProperty.isVisible()); + rowPosition++; + } + } + } + + // Modify the in comment values + final Object commentValue = manager.getDataValue(3, firstPosition + 4); + if(!commentValue.equals(NA)){ + final View comment = helper.getStereotypeComment(view); + Assert.assertEquals("The initial 'In Comment' value is not correct", false, comment.isVisible()); + manager.setDataValue(3, firstPosition + 4, true); + Assert.assertEquals("The 'In Comment' value was not modified", true, comment.isVisible()); + int rowPosition = 6; + for (Property property : stereotype.getAllAttributes()) { + if (StereotypeUtil.isValidStereotypeProperty(property)) { + StringBuilder errorMessage = new StringBuilder("The initial 'In Comment' value is not correct for property '"); + errorMessage.append(property.getName()); + errorMessage.append("'"); + View commentProperty = helper.getStereotypePropertyInComment(view, stereotype, property); + Assert.assertEquals(errorMessage.toString(), true, commentProperty.isVisible()); + manager.setDataValue(3, firstPosition + rowPosition, false); + errorMessage = new StringBuilder("The 'In Comment' value was not modified on property '"); + errorMessage.append(property.getName()); + errorMessage.append("'"); + Assert.assertEquals(errorMessage.toString(), false, commentProperty.isVisible()); + rowPosition++; + } + } + } + + // Modify the in compartment values + final Object compartmentValue = manager.getDataValue(4, firstPosition + 4); + if(!compartmentValue.equals(NA)){ + final View compartment = helper.getStereotypeCompartment(view, stereotype); + Assert.assertEquals("The initial 'In Compartment' value is not correct", false, compartment.isVisible()); + manager.setDataValue(4, firstPosition + 4, true); + Assert.assertEquals("The 'In Compartment' value was not modified", true, compartment.isVisible()); + int rowPosition = 6; + for (Property property : stereotype.getAllAttributes()) { + if (StereotypeUtil.isValidStereotypeProperty(property)) { + StringBuilder errorMessage = new StringBuilder("The initial 'In Comment' value is not correct for property '"); + errorMessage.append(property.getName()); + errorMessage.append("'"); + View compartmentProperty = helper.getStereotypePropertyInCompartment(view, stereotype, property); + Assert.assertEquals(errorMessage.toString(), true, compartmentProperty.isVisible()); + manager.setDataValue(4, firstPosition + rowPosition, false); + errorMessage = new StringBuilder("The 'In Compartment' value was not modified on property '"); + errorMessage.append(property.getName()); + errorMessage.append("'"); + Assert.assertEquals(errorMessage.toString(), false, compartmentProperty.isVisible()); + rowPosition++; + } + } + } + } +} -- cgit v1.2.3