Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests')
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.classpath7
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.project28
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.settings/org.eclipse.jdt.core.prefs291
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.settings/org.eclipse.jdt.ui.prefs68
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/META-INF/MANIFEST.MF11
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/about.html28
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/build.properties18
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/org.eclipse.papyrus.eclipse.project.editors.tests.launch47
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/pom.xml15
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/feature_project/feature.xml32
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/manifest_project/META-INF/MANIFEST.MF23
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/platform_feature/feature.xml65
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/simple_project/hello.txt1
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/AllTests.java36
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/CreatedProject.java34
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/FeatureProjectEditorTest.java373
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/JavaProjectEditorTest.java239
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ManifestEditorTest.java490
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/MissingFiles.java39
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/PluginEditorTest.java483
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/PluginProjectEditorTest.java125
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorFixture.java248
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorTest.java58
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/TriConsumer.java24
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/WithResource.java29
25 files changed, 2812 insertions, 0 deletions
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.classpath b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.project b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.project
new file mode 100644
index 00000000000..81a9616c828
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.eclipse.project.editors.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..b3aa6d60f94
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.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.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
+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/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.settings/org.eclipse.jdt.ui.prefs b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..954281dbc31
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.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=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..61b73b1756b
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.junit.utils;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.eclipse.project.editors;bundle-version="[2.0.0,3.0.0)"
+Export-Package: org.eclipse.papyrus.eclipse.project.editors.tests
+Bundle-Vendor: Eclipse Modeling Project
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 2.0.0.qualifier
+Bundle-Name: Papyrus Project Editor Tests
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.eclipse.project.editors.tests
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/about.html b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/about.html
new file mode 100644
index 00000000000..d35d5aed64c
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/build.properties b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/build.properties
new file mode 100644
index 00000000000..74ebb5f9be9
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/build.properties
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2016 Christian W. Damus and others
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Christian W. Damus - Initial API and implementation
+#
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ resources/
+src.includes = about.html
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/org.eclipse.papyrus.eclipse.project.editors.tests.launch b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/org.eclipse.papyrus.eclipse.project.editors.tests.launch
new file mode 100644
index 00000000000..2f5e94215cc
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/org.eclipse.papyrus.eclipse.project.editors.tests.launch
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<listAttribute key="com.mountainminds.eclemma.core.SCOPE_IDS">
+<listEntry value="=org.eclipse.papyrus.eclipse.project.editors/src"/>
+</listAttribute>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/AllTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.eclipse.project.editors.tests.AllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.eclipse.project.editors.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -Xms1024m -Xmx4086m"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="true"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+</launchConfiguration>
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/pom.xml b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/pom.xml
new file mode 100644
index 00000000000..1adc7c826d0
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/pom.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.tests.releng</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ <relativePath>../../../../../releng/main-tests</relativePath>
+ </parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.eclipse.project.editors.tests</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+</project>
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/feature_project/feature.xml b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/feature_project/feature.xml
new file mode 100644
index 00000000000..01d329d5fbd
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/feature_project/feature.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<feature id="org.eclipse.papyrus.extra.umlrt.feature" label="Papyrus RT" provider-name="Papyrus Project" version="1.2.0.qualifier">
+
+ <copyright url="http://www.eclipse.org/legal/epl-v10.html">
+ Copyright (c) 2013 CEA LIST
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License
+v1.0
+which accompanies this distribution, and is available at
+
+http://www.eclipse.org/legal/epl-v10.html
+ </copyright>
+
+ <license url="http://localhost/license.html">
+ %license
+ </license>
+
+ <description url="http://localhost/description.html">
+ The Papyrus implementation of UML for Real-Time and embedded systems.
+ </description>
+
+ <plugin download-size="0" id="org.eclipse.papyrus.umlrt" install-size="0" unpack="false" version="0.0.0"/>
+
+ <plugin download-size="0" id="org.eclipse.papyrus.umlrt.properties" install-size="0" unpack="false" version="0.0.0"/>
+
+ <plugin download-size="0" id="org.eclipse.papyrus.umlrt.validation" install-size="0" unpack="false" version="0.0.0"/>
+
+ <plugin download-size="0" id="org.eclipse.papyrus.umlrt.wizard" install-size="0" unpack="false" version="0.0.0"/>
+
+ <plugin download-size="0" id="org.eclipse.papyrus.umlrt.ui" install-size="0" unpack="false" version="0.0.0"/>
+
+</feature> \ No newline at end of file
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/manifest_project/META-INF/MANIFEST.MF b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/manifest_project/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..0ab3387c0db
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/manifest_project/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.junit.utils;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.eclipse.project.editors;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.ui;bundle-version="3.6.0";resolution:=optional,
+ com.google.guava;bundle-version="15.0.0",
+ org.eclipse.core.resources;visibility:=reexport
+Import-Package: com.ibm.icu.text;resolution:=optional,
+ org.eclipse.emf.ecore;version="2.10.0"
+Export-Package: org.eclipse.papyrus.eclipse.project.editors.tests;x-internal:=true,
+ org.eclipse.papyrus.foo.tests;version="2.0.0"
+Bundle-Vendor: Papyrus Project
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 2.0.0.qualifier
+Bundle-Name: Papyrus Test Bundle
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.foo
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+
+Name: author-info
+Full-Name: Christian W. Damus
+Company: independent
+Committer: true
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/platform_feature/feature.xml b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/platform_feature/feature.xml
new file mode 100644
index 00000000000..7f1a5ea2375
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/platform_feature/feature.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.papyrus.extra.umlrt.feature"
+ label="Papyrus RT"
+ version="1.2.0.qualifier"
+ provider-name="Papyrus Project"
+ os="macosx"
+ ws="cocoa,carbon"
+ nl="en_CA"
+ arch="x86_64,ppc">
+
+ <description url="http://localhost/description.html">
+ The Papyrus implementation of UML for Real-Time and embedded systems.
+ </description>
+
+ <copyright url="http://www.eclipse.org/legal/epl-v10.html">
+ Copyright (c) 2013 CEA LIST
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License
+v1.0
+which accompanies this distribution, and is available at
+
+http://www.eclipse.org/legal/epl-v10.html
+ </copyright>
+
+ <license url="http://localhost/license.html">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.papyrus.umlrt"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.umlrt.properties"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.umlrt.validation"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.umlrt.wizard"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.umlrt.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/simple_project/hello.txt b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/simple_project/hello.txt
new file mode 100644
index 00000000000..af5626b4a11
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/resources/simple_project/hello.txt
@@ -0,0 +1 @@
+Hello, world!
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/AllTests.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/AllTests.java
new file mode 100644
index 00000000000..a5c8780ff56
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/AllTests.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite;
+import org.eclipse.papyrus.junit.framework.runner.Headless;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+
+/**
+ * Project Editors plug-in test suite.
+ */
+@Headless
+@RunWith(ClassificationSuite.class)
+@SuiteClasses({
+ ProjectEditorTest.class,
+ PluginProjectEditorTest.class,
+ JavaProjectEditorTest.class,
+ ManifestEditorTest.class,
+ PluginEditorTest.class,
+ FeatureProjectEditorTest.class,
+})
+public class AllTests {
+ // Nothing more
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/CreatedProject.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/CreatedProject.java
new file mode 100644
index 00000000000..afe24674fed
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/CreatedProject.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor;
+
+/**
+ * Annotation for test cases that should be run on a project that is already
+ * {@link IProjectEditor#create() created}.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.METHOD, ElementType.TYPE })
+public @interface CreatedProject {
+ /**
+ * Whether the project should be created (default is {@code true}).
+ */
+ boolean value() default true;
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/FeatureProjectEditorTest.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/FeatureProjectEditorTest.java
new file mode 100644
index 00000000000..596abc8519b
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/FeatureProjectEditorTest.java
@@ -0,0 +1,373 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import static org.hamcrest.CoreMatchers.anything;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeThat;
+
+import java.util.Collections;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.function.BiConsumer;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IFeatureProjectEditor;
+import org.eclipse.papyrus.junit.framework.classification.ClassificationRunner;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * Test cases for the implementation of the {@link IFeatureProjectEditor} API.
+ */
+@RunWith(ClassificationRunner.class)
+public class FeatureProjectEditorTest {
+
+ @Rule
+ public final ProjectEditorFixture<? extends IFeatureProjectEditor> fixture = new ProjectEditorFixture<>(IFeatureProjectEditor.class);
+
+ @MissingFiles
+ @Test
+ public void getMissingFiles() {
+ assertThat(fixture.getEditor().getMissingFiles(), hasItem("feature.xml"));
+ }
+
+ @CreatedProject(false)
+ @Test
+ public void getMissingNature() {
+ assertThat(fixture.getEditor().getMissingNature(), hasItem("org.eclipse.pde.FeatureNature"));
+ fixture.getEditor().create();
+ fixture.getEditor().save();
+ assertThat(fixture.getEditor().getMissingNature(), not(hasItem(anything())));
+
+ // And it's in the file
+ assertThat(fixture.slurp(".project"), hasItem(containsString("org.eclipse.pde.FeatureNature")));
+ }
+
+ @CreatedProject(false)
+ @Test
+ public void getMissingBuildCommand() {
+ assertThat(fixture.getEditor().getMissingBuildCommand(), hasItem("org.eclipse.pde.FeatureBuilder"));
+ fixture.getEditor().create();
+ fixture.getEditor().save();
+ assertThat(fixture.getEditor().getMissingBuildCommand(), not(hasItem(anything())));
+
+ // And it's in the file
+ assertThat(fixture.slurp(".project"), hasItem(containsString("org.eclipse.pde.FeatureBuilder")));
+ }
+
+ @MissingFiles
+ @Test
+ public void createFiles() {
+ assumeThat(fixture.getProject().getFile("feature.xml").isAccessible(), is(false));
+ fixture.getEditor().createFiles(Collections.singleton("feature.xml"));
+
+ Element manifest = getManifest();
+ assertThat(manifest.getAttributes().getLength(), is(0));
+ assertThat(manifest.getTextContent().trim(), is(""));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void getId() {
+ assertThat(fixture.getEditor().getId(), is("org.eclipse.papyrus.extra.umlrt.feature"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void getLabel() {
+ assertThat(fixture.getEditor().getLabel(), is("Papyrus RT"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void getVersion() {
+ assertThat(fixture.getEditor().getVersion(), is("1.2.0.qualifier"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void getProviderName() {
+ assertThat(fixture.getEditor().getProviderName(), is("Papyrus Project"));
+ }
+
+ @WithResource("platform_feature/feature.xml")
+ @Test
+ public void getOS() {
+ assertThat(fixture.getEditor().getOS(), is("macosx"));
+ }
+
+ @WithResource("platform_feature/feature.xml")
+ @Test
+ public void getWS() {
+ assertThat(fixture.getEditor().getWS(), is("cocoa,carbon"));
+ }
+
+ @WithResource("platform_feature/feature.xml")
+ @Test
+ public void getNL() {
+ assertThat(fixture.getEditor().getNL(), is("en_CA"));
+ }
+
+ @WithResource("platform_feature/feature.xml")
+ @Test
+ public void getArch() {
+ assertThat(fixture.getEditor().getArch(), is("x86_64,ppc"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void getDescriptionText() {
+ assertThat(fixture.getEditor().getDescriptionText(), containsString("UML for Real-Time"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void getDescriptionURL() {
+ assertThat(fixture.getEditor().getDescriptionURL(), is("http://localhost/description.html"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void getCopyrightText() {
+ assertThat(fixture.getEditor().getCopyrightText(), containsString("2013 CEA LIST"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void getCopyrightURL() {
+ assertThat(fixture.getEditor().getCopyrightURL(), is("http://www.eclipse.org/legal/epl-v10.html"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void getLicenseText() {
+ assertThat(fixture.getEditor().getLicenseText(), containsString("%license"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void getLicenseURL() {
+ assertThat(fixture.getEditor().getLicenseURL(), is("http://localhost/license.html"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setId() {
+ testRootAttribute("id", IFeatureProjectEditor::setId, "org.eclipse.foo");
+ }
+
+ void testRootAttribute(String name, BiConsumer<IFeatureProjectEditor, String> setter, String value) {
+ setter.accept(fixture.getEditor(), value);
+ fixture.getEditor().save();
+
+ assertThat(getManifest().getAttribute(name), is(value));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setLabel() {
+ testRootAttribute("label", IFeatureProjectEditor::setLabel, "Foo Feature");
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setVersion() {
+ testRootAttribute("version", IFeatureProjectEditor::setVersion, "0.1.0.qualifier");
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setProviderName() {
+ testRootAttribute("provider-name", IFeatureProjectEditor::setProviderName, "Me, myself");
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setOS() {
+ testRootAttribute("os", IFeatureProjectEditor::setOS, "macosx");
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setWS() {
+ testRootAttribute("ws", IFeatureProjectEditor::setWS, "cocoa");
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setNL() {
+ testRootAttribute("nl", IFeatureProjectEditor::setNL, "en_CA");
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setArch() {
+ testRootAttribute("arch", IFeatureProjectEditor::setArch, "x86_64");
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setDescription() {
+ testDescriptionoid("description", IFeatureProjectEditor::setDescription,
+ "http:///newdescription.html", "New description");
+ }
+
+ void testDescriptionoid(String name, TriConsumer<IFeatureProjectEditor, String, String> setter, String url, String text) {
+ setter.accept(fixture.getEditor(), url, text);
+ fixture.getEditor().save();
+
+ Element description = findElement(getManifest(), name).get();
+ assertThat(description.getAttribute("url"), is(url));
+ assertThat(description.getTextContent(), is(text));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setCopyright() {
+ testDescriptionoid("copyright", IFeatureProjectEditor::setCopyright,
+ "http:///newcopy.html", "Copyright (c) 2016 Me");
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setLicense() {
+ testDescriptionoid("license", IFeatureProjectEditor::setLicense,
+ "http:///newlic.html", "Free for all!");
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void setUpdateURL() {
+ fixture.getEditor().setUpdateURL("Get stuff here", "http:///update");
+ fixture.getEditor().save();
+
+ Element url = findElement(getManifest(), "url").get();
+ Element discovery = findElement(url, "update").get();
+
+ assertThat(discovery.getAttribute("label"), is("Get stuff here"));
+ assertThat(discovery.getAttribute("url"), is("http:///update"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void addPlugin() {
+ fixture.getEditor().addPlugin("org.eclipse.foo");
+ fixture.getEditor().save();
+
+ Element plugin = oneElement(getManifest(), "plugin", "id", "org.eclipse.foo");
+ assertThat(plugin.getAttribute("version"), is("0.0.0"));
+ assertThat(plugin.getAttribute("download-size"), is("0"));
+ assertThat(plugin.getAttribute("install-size"), is("0"));
+ assertThat(plugin.getAttribute("unpack"), is("false"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void addRequiredFeature() {
+ fixture.getEditor().addRequiredFeature("org.eclipse.foo.feature", "0.7.0");
+ fixture.getEditor().save();
+
+ Element requires = findElement(getManifest(), "requires").get();
+ Element feature = oneElement(requires, "import", "feature", "org.eclipse.foo.feature");
+ assertThat(feature.getAttribute("version"), is("0.7.0"));
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void addRequiredPlugin() {
+ fixture.getEditor().addRequiredPlugin("org.eclipse.foo");
+ fixture.getEditor().save();
+
+ Element requires = findElement(getManifest(), "requires").get();
+ oneElement(requires, "import", "plugin", "org.eclipse.foo");
+ }
+
+ @WithResource("feature_project/feature.xml")
+ @Test
+ public void addInclude() {
+ fixture.getEditor().addInclude("org.eclipse.foo.feature", "0.7.0");
+ fixture.getEditor().addInclude("org.eclipse.bar.feature", null);
+ fixture.getEditor().save();
+
+ Element feature = oneElement(getManifest(), "includes", "id", "org.eclipse.bar.feature");
+ assertThat(feature.getAttribute("version"), is("0.0.0"));
+ }
+
+ //
+ // Test framework
+ //
+
+ Element getManifest() {
+ try {
+ DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ return builder.parse(fixture.getURI("feature.xml").toString()).getDocumentElement();
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Failed to parse feature.xml: " + e.getMessage());
+ return null; // unreachable
+ }
+ }
+
+ Optional<Element> findElement(Element root, String name) {
+ return allOf(root)
+ .filter(element -> element.getNodeName().equals(name))
+ .findFirst();
+ }
+
+ /**
+ * Obtains a stream over the depth-first element tree of the given {@code root}.
+ *
+ * @param root
+ * the root of a tree to traverse
+ *
+ * @return the elements of {@code root}, starting with it
+ */
+ Stream<Element> allOf(Element root) {
+ return Stream.concat(
+ Stream.of(root),
+ childrenOf(root).flatMap(this::allOf));
+ }
+
+ Stream<Element> childrenOf(Element element) {
+ NodeList children = element.getChildNodes();
+ return IntStream.range(0, children.getLength())
+ .mapToObj(children::item)
+ .filter(Element.class::isInstance)
+ .map(Element.class::cast);
+ }
+
+ Element oneElement(Element root, String name, String attribute, String value) {
+ int[] count = { 0 };
+ return allOf(root)
+ .filter(e -> e.getNodeName().equals(name))
+ .filter(e -> Objects.equals(e.getAttribute(attribute), value))
+ .peek(e -> assertThat("not exactly one " + name, ++count[0], is(1)))
+ .collect(Collectors.toList())
+ .get(0);
+ }
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/JavaProjectEditorTest.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/JavaProjectEditorTest.java
new file mode 100644
index 00000000000..d94dd03dec0
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/JavaProjectEditorTest.java
@@ -0,0 +1,239 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import static org.hamcrest.CoreMatchers.anything;
+import static org.hamcrest.CoreMatchers.both;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Properties;
+
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Test cases for the implementation of the {@link IJavaProjectEditor} API.
+ */
+public class JavaProjectEditorTest {
+
+ @Rule
+ public final ProjectEditorFixture<? extends IJavaProjectEditor> fixture;
+
+ public JavaProjectEditorTest() {
+ this(new ProjectEditorFixture<>(IJavaProjectEditor.class));
+ }
+
+ JavaProjectEditorTest(ProjectEditorFixture<? extends IJavaProjectEditor> fixture) {
+ super();
+
+ this.fixture = fixture;
+ }
+
+ @Test
+ @MissingFiles
+ public void getMissingFiles() {
+ // The .project file already exists
+ assertThat(fixture.getEditor().getMissingFiles(),
+ both(hasItem(".classpath")).and(hasItem("build.properties")));
+ }
+
+ @Test
+ @MissingFiles
+ public void createFiles() {
+ fixture.getEditor().createFiles(new HashSet<>(Arrays.asList(".classpath", "build.properties")));
+ assertThat(fixture.slurp(".classpath"), hasItem(anything()));
+ assertThat(fixture.getProject().getFile("build.properties").isAccessible(), is(true));
+ }
+
+ @Test
+ public void getMissingNature() {
+ assertThat(fixture.getEditor().getMissingNature(), hasItem(IJavaProjectEditor.JAVA_NATURE));
+ }
+
+ @Test
+ public void hasNature() {
+ assertThat(fixture.getEditor().hasNature(IJavaProjectEditor.JAVA_NATURE), is(false));
+ fixture.getEditor().create();
+ assertThat(fixture.getEditor().hasNature(IJavaProjectEditor.JAVA_NATURE), is(true));
+ fixture.getEditor().save();
+
+ // It's actually in the file
+ assertThat(fixture.slurp(".project"), hasItem(containsString(IJavaProjectEditor.JAVA_NATURE)));
+ }
+
+ @Test
+ public void getMissingBuildCommand() {
+ assertThat(fixture.getEditor().getMissingBuildCommand(), hasItem(IJavaProjectEditor.JAVA_BUILD_COMMAND));
+ }
+
+ @Test
+ public void addBuildCommands() {
+ fixture.getEditor().addBuildCommands(Collections.singleton("org.eclipse.papyrus.foo"));
+ fixture.getEditor().save();
+ assertThat(fixture.slurp(".project"), hasItem(containsString("org.eclipse.papyrus.foo")));
+ }
+
+ @Test
+ public void hasBuildCommand() {
+ assertThat(fixture.getEditor().hasBuildCommand(IJavaProjectEditor.JAVA_BUILD_COMMAND), is(false));
+ fixture.getEditor().create();
+ assertThat(fixture.getEditor().hasBuildCommand(IJavaProjectEditor.JAVA_BUILD_COMMAND), is(true));
+ fixture.getEditor().save();
+
+ // It's actually in the file
+ assertThat(fixture.slurp(".project"), hasItem(containsString(IJavaProjectEditor.JAVA_BUILD_COMMAND)));
+ }
+
+ @MissingFiles
+ @Test
+ public void exists() {
+ assertThat(fixture.getEditor().exists(), is(false));
+ fixture.getEditor().create();
+ fixture.getEditor().save();
+
+ assertThat(fixture.getEditor().exists(), is(true));
+ }
+
+ @Test
+ public void registerSourceFolder() {
+ fixture.getEditor().registerSourceFolder("src-gen");
+ fixture.getEditor().save();
+ assertThat(getBuildProperties().getProperty("source..", ""), containsString("src-gen"));
+ }
+
+ @Test
+ public void registerBinFolder() {
+ fixture.getEditor().registerBinFolder("classes");
+ fixture.getEditor().save();
+ assertThat(getBuildOutputProperty(), containsString("classes"));
+ }
+
+ @Test
+ public void addToBuild() {
+ fixture.getEditor().addToBuild("foo.xml");
+ fixture.getEditor().save();
+ assertThat(getBuildProperties().getProperty("bin.includes", ""), containsString("foo.xml"));
+ }
+
+ @Test
+ public void isRegisteredSourceFolder() {
+ fixture.getEditor().registerSourceFolder("src-gen");
+ fixture.getEditor().save();
+ assertThat(fixture.getEditor().isRegisteredSourceFolder("src-gen"), is(true));
+ }
+
+ @Test
+ public void isRegisteredBinFolder() {
+ fixture.getEditor().registerBinFolder("classes");
+ fixture.getEditor().save();
+ assertThat(fixture.getEditor().isRegisteredBinFolder("classes"), is(true));
+ }
+
+ @Test
+ public void getSourceFolders() {
+ fixture.getEditor().registerSourceFolder("src");
+ fixture.getEditor().registerSourceFolder("src-gen");
+ fixture.getEditor().save();
+
+ assertThat(Arrays.asList(fixture.getEditor().getSourceFolders()),
+ both(hasItem("src")).and(hasItem("src-gen")));
+ }
+
+ @CreatedProject
+ @Test
+ public void getBinFolders() {
+ fixture.getEditor().addSourceFolderToClasspath("src", "bin");
+ fixture.getEditor().addSourceFolderToClasspath("src-gen", "bin-gen");
+ fixture.getEditor().save();
+
+ assertThat(Arrays.asList(fixture.getEditor().getBinFolders()),
+ both(hasItem("bin")).and(hasItem("bin-gen")));
+ }
+
+ @Test
+ public void getElementsInBuild() {
+ fixture.getEditor().addToBuild("META-INF/MANIFEST.MF");
+ fixture.getEditor().addToBuild("plugin.xml");
+ fixture.getEditor().addToBuild("plugin.properties");
+ fixture.getEditor().save();
+
+ assertThat(Arrays.asList(fixture.getEditor().getElementsInBuild()),
+ both(hasItem("META-INF/MANIFEST.MF")).and(hasItem("plugin.xml")).and(hasItem("plugin.properties")));
+ }
+
+ @CreatedProject
+ @Test
+ public void addSourceFolderToClasspath() {
+ fixture.getEditor().addSourceFolderToClasspath("src-gen");
+ fixture.getEditor().save();
+
+ assertThat(fixture.slurp(".classpath"),
+ hasItem(both(containsString("\"src\"")).and(containsString("src-gen"))));
+ }
+
+ @CreatedProject
+ @Test
+ public void addJavaSourceFolder() {
+ fixture.getEditor().addJavaSourceFolder("src-gen");
+ fixture.getEditor().save();
+
+ assertThat(fixture.slurp(".classpath"),
+ hasItem(both(containsString("\"src\"")).and(containsString("src-gen"))));
+ assertThat(getBuildProperties().getProperty("source..", ""), containsString("src-gen"));
+ }
+
+ @CreatedProject
+ @Test
+ public void isSourceFolderRegistered() {
+ fixture.getEditor().addSourceFolderToClasspath("src-gen");
+ fixture.getEditor().save();
+
+ assertThat(fixture.getEditor().isSourceFolderRegistered("src-gen"), is(true));
+ }
+
+ //
+ // Test framework
+ //
+
+ Properties getBuildProperties() {
+ Properties result = new Properties();
+ try (InputStream input = fixture.getProject().getFile("build.properties").getContents()) {
+ result.load(input);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Failed to load build properties: " + e.getMessage());
+ }
+ return result;
+ }
+
+ // The build editor may or may not use the modern convention of "output.."
+ // instead of "bin.." for the output folder(s)
+ String getBuildOutputProperty() {
+ Properties build = getBuildProperties();
+ String result = build.getProperty("output..");
+ if (result == null) {
+ result = build.getProperty("bin..", "");
+ }
+ return result;
+ }
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ManifestEditorTest.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ManifestEditorTest.java
new file mode 100644
index 00000000000..abdc1281116
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ManifestEditorTest.java
@@ -0,0 +1,490 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import static org.eclipse.papyrus.junit.matchers.MoreMatchers.regexContains;
+import static org.hamcrest.CoreMatchers.both;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.either;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor;
+import org.eclipse.pde.core.project.IPackageImportDescription;
+import org.eclipse.pde.core.project.IRequiredBundleDescription;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Test cases for the implementation of the {@link IManifestEditor} API.
+ */
+@CreatedProject
+public class ManifestEditorTest {
+
+ @Rule
+ public final ProjectEditorFixture<? extends IManifestEditor> fixture;
+
+ public ManifestEditorTest() {
+ this(new ProjectEditorFixture<>(IManifestEditor.class));
+ }
+
+ ManifestEditorTest(ProjectEditorFixture<? extends IManifestEditor> fixture) {
+ super();
+
+ this.fixture = fixture;
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void addDependencyString() {
+ // Add a dependency that wasn't there before
+ fixture.getEditor().addDependency("org.eclipse.jface");
+
+ // And try to add one that was there before
+ fixture.getEditor().addDependency("com.google.guava");
+
+ fixture.getEditor().save();
+
+ List<String> manifest = getManifest();
+
+ // We have JFace without a version
+ assertThat(one(manifest, "org.eclipse.jface"), not(containsString(";")));
+
+ // And still just the one one Guava with its version
+ assertThat(one(manifest, "com.google.guava"), containsString(";bundle-version=\"15.0.0\""));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void addDependencyStringString() {
+ // Add a dependency that wasn't there before
+ fixture.getEditor().addDependency("org.eclipse.jface", "3.10.0");
+
+ // And set the version of an existing dependency
+ fixture.getEditor().addDependency("org.eclipse.core.resources", "3.6.0");
+
+ // And change the version of an existing dependency
+ fixture.getEditor().addDependency("org.eclipse.ui", "[3.2.0,4.0.0)");
+
+ fixture.getEditor().save();
+
+ List<String> manifest = getManifest();
+
+ // We have JFace with a version
+ assertThat(one(manifest, "org.eclipse.jface"), containsString(";bundle-version=\"3.10.0\""));
+
+ // And one Resources with a new version and the same other directives
+ assertThat(one(manifest, "org.eclipse.core.resources"),
+ both(containsString(";bundle-version=\"3.6.0\"")).and(
+ containsString(";visibility:=reexport")));
+
+ // And one UI with a new range (not an appended range)
+ assertThat(one(manifest, "org.eclipse.ui"),
+ both(containsString(";bundle-version=\"[3.2.0,4.0.0)\"")).and(
+ not(containsString(";bundle-version=\"3.6.0\""))));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void hasDependency() {
+ assertThat(fixture.getEditor().hasDependency("org.eclipse.jface"), is(false));
+ assertThat(fixture.getEditor().hasDependency("org.eclipse.ui"), is(true));
+ assertThat(fixture.getEditor().hasDependency("org.eclipse.core.resources"), is(true));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void setValueStringString() {
+ // One that doesn't yet exist
+ fixture.getEditor().setValue("Eclipse-LazyStart", "true");
+ // And one that does
+ fixture.getEditor().setValue("Bundle-Localization", "OSGI-INF/l10n/bundle");
+
+ fixture.getEditor().save();
+
+ List<String> manifest = getManifest();
+ assertThat(one(manifest, "Eclipse-LazyStart"), is("Eclipse-LazyStart: true"));
+ assertThat(one(manifest, "Bundle-Localization"), is("Bundle-Localization: OSGI-INF/l10n/bundle"));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void getValueString() {
+ assertThat(fixture.getEditor().getValue("Bundle-Vendor"), is("Papyrus Project"));
+ assertThat(fixture.getEditor().getValue("Eclipse-LazyStart"), nullValue());
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void getValueStringString() {
+ assertThat(fixture.getEditor().getValue("author-info", "Full-Name"), is("Christian W. Damus"));
+ assertThat(fixture.getEditor().getValue("author-info", "Disposition"), nullValue());
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void setValueStringStringString() {
+ // One that doesn't yet exist
+ fixture.getEditor().setValue("author-info", "Disposition", "happy");
+ // And one that does
+ fixture.getEditor().setValue("author-info", "Company", "self-employed");
+
+ fixture.getEditor().save();
+
+ List<String> manifest = getManifest();
+ assertThat(one(manifest, "Disposition"), is("Disposition: happy"));
+ assertThat(one(manifest, "Company"), is("Company: self-employed"));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void removeValueStringString() {
+ // Attempt to remove one that doesn't exist
+ fixture.getEditor().removeValue("author-info", "Disposition");
+ // And one that does
+ fixture.getEditor().removeValue("author-info", "Company");
+
+ fixture.getEditor().save();
+
+ assertThat(getManifest(), not(hasItem(containsString("Company:"))));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void removeValueString() {
+ // Attempt to remove one that doesn't exist
+ fixture.getEditor().removeValue("Eclipse-LazyStart");
+ // And one that does
+ fixture.getEditor().removeValue("Bundle-Localization");
+
+ fixture.getEditor().save();
+
+ assertThat(getManifest(), not(hasItem(containsString("Bundle-Localization:"))));
+ }
+
+ @Test
+ public void setSymbolicBundleName() {
+ fixture.getEditor().setSymbolicBundleName("org.eclipse.papyrus.something");
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "Bundle-SymbolicName:"), regexContains("\\sorg\\.eclipse\\.papyrus\\.something$"));
+
+ // And change the name
+ fixture.getEditor().setSymbolicBundleName("org.eclipse.papyrus.new.name");
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "Bundle-SymbolicName:"), regexContains("\\sorg\\.eclipse\\.papyrus\\.new\\.name$"));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void getSymbolicBundleName() {
+ assertThat(fixture.getEditor().getSymbolicBundleName(), is("org.eclipse.papyrus.foo"));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void getBundleName() {
+ assertThat(fixture.getEditor().getBundleName(), is("Papyrus Test Bundle"));
+ }
+
+ @Test
+ public void setBundleName() {
+ fixture.getEditor().setBundleName("My Bundle");
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "Bundle-Name:"), regexContains("\\sMy Bundle$"));
+
+ // And change the name
+ fixture.getEditor().setBundleName("A Better Name");
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "Bundle-Name:"), regexContains("\\sA Better Name$"));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void getBundleVersion() {
+ assertThat(fixture.getEditor().getBundleVersion(), is("2.0.0.qualifier"));
+ }
+
+ @Test
+ public void setBundleVersion() {
+ fixture.getEditor().setBundleVersion("0.1.0.qualifier");
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "Bundle-Version:"), regexContains("\\s0\\.1\\.0\\.qualifier$"));
+
+ // And change the name
+ fixture.getEditor().setBundleVersion("2.0.0");
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "Bundle-Version:"), regexContains("\\s2\\.0\\.0$"));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void getBundleVendor() {
+ assertThat(fixture.getEditor().getBundleVendor(), is("Papyrus Project"));
+ }
+
+ @Test
+ public void setBundleVendor() {
+ fixture.getEditor().setBundleVendor("Me");
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "Bundle-Vendor:"), regexContains("\\sMe$"));
+
+ // And change the name
+ fixture.getEditor().setBundleVendor("Eclipse Modeling Project");
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "Bundle-Vendor:"), regexContains("\\sEclipse Modeling Project$"));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void getBundleLocalization() {
+ assertThat(fixture.getEditor().getBundleLocalization(), is("plugin"));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void setSingleton() {
+ fixture.getEditor().setSingleton(true);
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "Bundle-SymbolicName:"), regexContains("\\.foo;singleton:=true$"));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void addImportPackageString() {
+ // Add a dependency that wasn't there before
+ fixture.getEditor().addImportPackage("org.eclipse.jface.viewers");
+
+ // And try to add one that was there before
+ fixture.getEditor().addImportPackage("org.eclipse.emf.ecore");
+
+ fixture.getEditor().save();
+
+ List<String> manifest = getManifest();
+
+ // We have viewers without a version
+ assertThat(one(manifest, "org.eclipse.jface.viewers"), not(containsString(";")));
+
+ // And still just the one one Ecore with its version
+ assertThat(one(manifest, "org.eclipse.emf.ecore"), containsString(";version=\"2.10.0\""));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void addImportPackageStringString() {
+ // Add a dependency that wasn't there before
+ fixture.getEditor().addImportPackage("org.eclipse.jface.viewers", "3.10.0");
+
+ // And set the version of an existing dependency
+ fixture.getEditor().addImportPackage("com.ibm.icu.text", "54.0.0");
+
+ // And change the version of an existing dependency
+ fixture.getEditor().addImportPackage("org.eclipse.emf.ecore", "[2.12.0,3.0.0)");
+
+ fixture.getEditor().save();
+
+ List<String> manifest = getManifest();
+
+ // We have viewers with a version
+ assertThat(one(manifest, "org.eclipse.jface.viewers"), containsString(";version=\"3.10.0\""));
+
+ // And one ICU with a new version and the same other directives
+ assertThat(one(manifest, "com.ibm.icu.text"),
+ both(containsString(";version=\"54.0.0\"")).and(
+ containsString(";resolution:=optional")));
+
+ // And one Ecore with a new range (not an appended range)
+ assertThat(one(manifest, "org.eclipse.emf.ecore"),
+ both(containsString(";version=\"[2.12.0,3.0.0)\"")).and(
+ not(containsString(";version=\"2.10.0\""))));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void addExportPackageString() {
+ // Add a package that wasn't there before
+ fixture.getEditor().addExportPackage("org.eclipse.papyrus.bar");
+
+ // And try to add one that was there before
+ fixture.getEditor().addExportPackage("org.eclipse.papyrus.foo.tests");
+
+ fixture.getEditor().save();
+
+ List<String> manifest = getManifest();
+
+ // We have bar without a version
+ assertThat(one(manifest, "org.eclipse.papyrus.bar"), not(containsString(";")));
+
+ // And still just the one one foo with its version
+ assertThat(one(manifest, "org.eclipse.papyrus.foo.tests"), containsString(";version=\"2.0.0\""));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void addExportPackageStringString() {
+ // Add a package that wasn't there before
+ fixture.getEditor().addExportPackage("org.eclipse.papyrus.bar", "1.2.0");
+
+ // And set the version of an existing package
+ fixture.getEditor().addExportPackage(
+ "org.eclipse.papyrus.eclipse.project.editors.tests", "2.0.0");
+
+ // And change the version of an existing dependency
+ fixture.getEditor().addExportPackage("org.eclipse.papyrus.foo.tests", "1.1.100");
+
+ fixture.getEditor().save();
+
+ List<String> manifest = getManifest();
+
+ // We have bar with a version
+ assertThat(one(manifest, "org.eclipse.papyrus.bar"), containsString(";version=\"1.2.0\""));
+
+ // And one tests with a new version and the same other directives
+ assertThat(one(manifest, "org.eclipse.papyrus.eclipse.project.editors.tests"),
+ both(containsString(";version=\"2.0.0\"")).and(
+ containsString(";x-internal:=true")));
+
+ // And one foo with a new range (not an appended range)
+ assertThat(one(manifest, "org.eclipse.papyrus.foo.tests"),
+ both(containsString(";version=\"1.1.100\"")).and(
+ not(containsString(";version=\"2.0.0\""))));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void getRequiredBundles() {
+ List<IRequiredBundleDescription> required = fixture.getEditor().getRequiredBundles();
+
+ assertThat(required.size(), is(5));
+ assertThat(required.get(0).getVersionRange(), is(VersionRange.valueOf("[1.2.0,2.0.0)")));
+ assertThat(required.get(1).getName(), is("org.eclipse.papyrus.eclipse.project.editors"));
+ assertThat(required.get(2).isOptional(), is(true));
+ assertThat(required.get(4).getName(), is("org.eclipse.core.resources"));
+ assertThat(required.get(4).getVersionRange(), either(nullValue()).or(is(VersionRange.emptyRange)));
+ assertThat(required.get(4).isExported(), is(true));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void getImportedPackages() {
+ List<IPackageImportDescription> imported = fixture.getEditor().getImportedPackages();
+
+ assertThat(imported.size(), is(2));
+ assertThat(imported.get(0).getName(), is("com.ibm.icu.text"));
+ assertThat(imported.get(0).getVersionRange(), either(nullValue()).or(is(VersionRange.emptyRange)));
+ assertThat(imported.get(0).isOptional(), is(true));
+ assertThat(imported.get(1).getName(), is("org.eclipse.emf.ecore"));
+ assertThat(imported.get(1).getVersionRange(), is(VersionRange.valueOf("2.10.0")));
+ assertThat(imported.get(1).isOptional(), is(false));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void setRequiredBundleExported() {
+ fixture.getEditor().setRequiredBundleExported("com.google.guava", true);
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "com.google.guava"), containsString(";visibility:=reexport"));
+
+ // And remove it
+ fixture.getEditor().setRequiredBundleExported("com.google.guava", false);
+ fixture.getEditor().save();
+
+ assertThat(one(getManifest(), "com.google.guava"), not(containsString("visibility:=reexport")));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void removeRequiredBundle() {
+ fixture.getEditor().removeRequiredBundle("org.eclipse.ui");
+ fixture.getEditor().removeRequiredBundle("org.eclipse.core.resources");
+ fixture.getEditor().save();
+
+ List<String> manifest = getManifest();
+
+ assertThat(manifest, hasItem(" org.eclipse.papyrus.eclipse.project.editors;bundle-version=\"[2.0.0,3.0.0)\","));
+
+ // This is now the last one (no trailing comma)
+ assertThat(manifest, hasItem(" com.google.guava;bundle-version=\"15.0.0\""));
+ }
+
+ @WithResource("manifest_project/META-INF/MANIFEST.MF")
+ @Test
+ public void removeImportedPackage() {
+ fixture.getEditor().removeImportedPackage("org.eclipse.emf.ecore");
+ fixture.getEditor().save();
+
+ List<String> manifest = getManifest();
+
+ // This is now the last one (no trailing comma)
+ assertThat(manifest, hasItem("Import-Package: com.ibm.icu.text;resolution:=optional"));
+ }
+
+ @MissingFiles
+ @Test
+ public void exists() {
+ assertThat(fixture.getEditor().exists(), is(false));
+ fixture.getEditor().create();
+ fixture.getEditor().save();
+
+ assertThat(fixture.getEditor().exists(), is(true));
+ }
+
+ @MissingFiles
+ @Test
+ public void getMissingFiles() {
+ // The .project file already exists
+ assertThat(fixture.getEditor().getMissingFiles(), hasItem("META-INF/MANIFEST.MF"));
+ }
+
+ @MissingFiles
+ @Test
+ public void createFiles() {
+ fixture.getEditor().createFiles(Collections.singleton("META-INF/MANIFEST.MF"));
+ assertThat(fixture.slurp("META-INF/MANIFEST.MF"), hasItem(containsString("Manifest-Version:")));
+ }
+
+ //
+ // Test framework
+ //
+
+ List<String> getManifest() {
+ return fixture.slurp("META-INF/MANIFEST.MF");
+ }
+
+ String one(List<String> list, String substring) {
+ int[] count = { 0 };
+ return list.stream()
+ .filter(s -> s.contains(substring))
+ .peek(s -> assertThat("not exactly one " + s, ++count[0], is(1)))
+ .collect(Collectors.toList())
+ .get(0);
+ }
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/MissingFiles.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/MissingFiles.java
new file mode 100644
index 00000000000..68284075e84
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/MissingFiles.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor;
+
+/**
+ * Annotation for the {@link IProjectEditor#getMissingFiles()} test case to indicate
+ * that the fixture should not create the files required by the project.
+ * The missing-files annotation implies {@link CreatedProject @CreatedProject(false)};
+ * the created-project annotation is ignored when the missing-files annotation
+ * is present with a {@code true} value.
+ *
+ * @see CreatedProject
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface MissingFiles {
+ /**
+ * Whether the project's missing files should not be created (default is {@code true}).
+ */
+ boolean value() default true;
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/PluginEditorTest.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/PluginEditorTest.java
new file mode 100644
index 00000000000..0e3e65f4118
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/PluginEditorTest.java
@@ -0,0 +1,483 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.Field;
+import java.util.stream.Stream;
+
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginProjectEditor;
+import org.eclipse.papyrus.junit.utils.rules.AnnotationRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TestRule;
+
+/**
+ * Test cases for the implementation of the {@link IPluginProjectEditor} API.
+ */
+public class PluginEditorTest {
+
+ private final AnnotationRule<String> delegateKey = AnnotationRule.create(Delegate.class);
+
+ private final ProjectEditorFixture<IPluginEditor> fixture = new ProjectEditorFixture<>(IPluginEditor.class, this::activeDelegate);
+
+ @Rule
+ public final TestRule rules = RuleChain.outerRule(delegateKey).around(fixture);
+
+ @Delegate("project")
+ private final ProjectEditorTest project = new ProjectEditorTest(fixture);
+
+ @Delegate("plugin")
+ private final PluginProjectEditorTest pluginProject = new PluginProjectEditorTest(fixture);
+
+ @Delegate("java")
+ private final JavaProjectEditorTest javaProject = new JavaProjectEditorTest(fixture);
+
+ @Delegate("manifest")
+ private final ManifestEditorTest manifest = new ManifestEditorTest(fixture);
+
+ //
+ // Tests for the IPluginEditor specific API
+ //
+
+ @Test
+ public void pluginManifestExists() {
+ assertThat(fixture.getEditor().pluginManifestExists(), is(false));
+ pluginProject.exists();
+ assertThat(fixture.getEditor().pluginManifestExists(), is(true));
+ }
+
+ //
+ // Tests for the IProjectEditor API
+ //
+
+ @Delegate("project")
+ @Test
+ public void getMissingFiles_project() {
+ delegate();
+ }
+
+ @Delegate("plugin")
+ @Test
+ public void getMissingFiles_plugin() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void getMissingFiles_java() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void getMissingFiles_manifest() {
+ delegate();
+ }
+
+ @Delegate("project")
+ @Test
+ public void addFile() {
+ delegate();
+ }
+
+ //
+ // Tests for the IPluginProjectEditor API
+ //
+
+ @Delegate("plugin")
+ @Test
+ public void addExtension() {
+ delegate();
+ }
+
+ @Delegate("plugin")
+ @Test
+ public void getExtensions() {
+ delegate();
+ }
+
+ @Delegate("plugin")
+ @Test
+ public void setAttribute() {
+ delegate();
+ }
+
+ @Delegate("plugin")
+ @Test
+ public void getMissingNature_plugin() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void getMissingNature_java() {
+ delegate();
+ }
+
+ @Delegate("plugin")
+ @Test
+ public void getMissingBuildCommand_plugin() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void getMissingBuildCommand_java() {
+ delegate();
+ }
+
+ //
+ // Tests for the IJavaProjectEditor API
+ //
+
+ @Delegate("java")
+ @Test
+ public void createFiles_java() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void createFiles_manifest() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void hasNature() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void addBuildCommands() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void hasBuildCommand() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void exists_java() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void exists_manifest() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void registerSourceFolder() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void registerBinFolder() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void addToBuild() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void isRegisteredSourceFolder() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void isRegisteredBinFolder() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void getSourceFolders() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void getBinFolders() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void getElementsInBuild() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void addSourceFolderToClasspath() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void addJavaSourceFolder() {
+ delegate();
+ }
+
+ @Delegate("java")
+ @Test
+ public void isSourceFolderRegistered() {
+ delegate();
+ }
+
+ //
+ // Tests for the IManifestEditor API
+ //
+
+ @Delegate("manifest")
+ @Test
+ public void addDependencyString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void addDependencyStringString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void hasDependency() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void setValueStringString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void getValueString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void getValueStringString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void setValueStringStringString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void removeValueStringString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void removeValueString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void setSymbolicBundleName() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void getSymbolicBundleName() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void getBundleName() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void setBundleName() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void getBundleVersion() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void setBundleVersion() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void getBundleVendor() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void setBundleVendor() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void getBundleLocalization() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void setSingleton() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void addImportPackageString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void addImportPackageStringString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void addExportPackageString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void addExportPackageStringString() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void getRequiredBundles() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void getImportedPackages() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void setRequiredBundleExported() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void removeRequiredBundle() {
+ delegate();
+ }
+
+ @Delegate("manifest")
+ @Test
+ public void removeImportedPackage() {
+ delegate();
+ }
+
+ //
+ // Test framework
+ //
+
+ private Object activeDelegate() {
+ String key = delegateKey.get();
+ Field field = (key == null) ? null : Stream.of(PluginEditorTest.class.getDeclaredFields())
+ .filter(f -> {
+ Delegate delegate = f.getAnnotation(Delegate.class);
+ return (delegate != null) && key.equals(delegate.value());
+ })
+ .findFirst().get();
+
+ try {
+ return (field == null) ? null : field.get(this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Reflection failed: " + e.getMessage());
+ return null; // unreachable
+ }
+ }
+
+ private void delegate() {
+ Object delegate = activeDelegate();
+ String methodName = fixture.getTestMethod();
+ int index = methodName.indexOf('_');
+ if (index >= 0) {
+ methodName = methodName.substring(0, index);
+ }
+
+ try {
+ MethodHandle testCase = MethodHandles.lookup().findVirtual(delegate.getClass(), methodName, MethodType.methodType(void.class));
+ testCase.bindTo(delegate).invoke();
+ } catch (Error e) {
+ throw e;
+ } catch (Throwable e) {
+ e.printStackTrace();
+ fail("Test reflection failed: " + e.getMessage());
+ }
+ }
+
+ @Target({ ElementType.METHOD, ElementType.FIELD })
+ @Retention(RetentionPolicy.RUNTIME)
+ public @interface Delegate {
+ String value();
+ }
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/PluginProjectEditorTest.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/PluginProjectEditorTest.java
new file mode 100644
index 00000000000..2e3fef63f28
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/PluginProjectEditorTest.java
@@ -0,0 +1,125 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import static org.hamcrest.CoreMatchers.anything;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginProjectEditor;
+import org.junit.Rule;
+import org.junit.Test;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Test cases for the implementation of the {@link IPluginProjectEditor} API.
+ */
+@CreatedProject
+public class PluginProjectEditorTest {
+
+ @Rule
+ public final ProjectEditorFixture<? extends IPluginProjectEditor> fixture;
+
+ public PluginProjectEditorTest() {
+ this(new ProjectEditorFixture<>(IPluginProjectEditor.class));
+ }
+
+ PluginProjectEditorTest(ProjectEditorFixture<? extends IPluginProjectEditor> fixture) {
+ super();
+
+ this.fixture = fixture;
+ }
+
+ @CreatedProject(false)
+ @Test
+ public void exists() {
+ assertThat(fixture.getEditor().exists(), is(false));
+ fixture.getEditor().create();
+ fixture.getEditor().save();
+
+ assertThat(fixture.getEditor().exists(), is(true));
+
+ assertThat(fixture.slurp("plugin.xml"), hasItem(containsString("<plugin>")));
+ }
+
+ @Test
+ public void addExtension() {
+ fixture.getEditor().addExtension("org.eclipse.foo");
+ fixture.getEditor().save();
+
+ assertThat(fixture.slurp("plugin.xml"), hasItem(containsString("point=\"org.eclipse.foo\"")));
+ }
+
+ @Test
+ public void getExtensions() {
+ fixture.getEditor().addExtension("org.eclipse.foo");
+ fixture.getEditor().save();
+
+ List<Node> extensions = fixture.getEditor().getExtensions("org.eclipse.foo");
+ Element extension = extensions.stream()
+ .filter(Element.class::isInstance)
+ .map(Element.class::cast)
+ .findAny().orElse(null);
+ assertThat(extension, notNullValue());
+ assertThat(extension.getNodeName(), is("extension"));
+ assertThat(extension.getAttribute("point"), is("org.eclipse.foo"));
+ }
+
+ @Test
+ public void setAttribute() {
+ Element extension = fixture.getEditor().addExtension("org.eclipse.foo");
+ fixture.getEditor().setAttribute(extension, "id", "org.eclipse.papyrus.foo.test");
+ fixture.getEditor().save();
+
+ assertThat(fixture.slurp("plugin.xml"), hasItem(containsString("id=\"org.eclipse.papyrus.foo.test\"")));
+ }
+
+ @MissingFiles
+ @Test
+ public void getMissingFiles() {
+ assertThat(fixture.getEditor().getMissingFiles(), hasItem("plugin.xml"));
+ }
+
+ @CreatedProject(false)
+ @Test
+ public void getMissingNature() {
+ assertThat(fixture.getEditor().getMissingNature(), hasItem(IPluginProjectEditor.PLUGIN_NATURE));
+ fixture.getEditor().create();
+ fixture.getEditor().save();
+ assertThat(fixture.getEditor().getMissingNature(), not(hasItem(anything())));
+
+ // And it's in the file
+ assertThat(fixture.slurp(".project"), hasItem(containsString(IPluginProjectEditor.PLUGIN_NATURE)));
+ }
+
+ @CreatedProject(false)
+ @Test
+ public void getMissingBuildCommand() {
+ assertThat(fixture.getEditor().getMissingBuildCommand(), hasItem(IPluginProjectEditor.PLUGIN_BUILD_COMMAND));
+ fixture.getEditor().create();
+ fixture.getEditor().save();
+ assertThat(fixture.getEditor().getMissingBuildCommand(), not(hasItem(anything())));
+
+ // And it's in the file
+ assertThat(fixture.slurp(".project"), hasItem(containsString(IPluginProjectEditor.PLUGIN_BUILD_COMMAND)));
+ }
+
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorFixture.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorFixture.java
new file mode 100644
index 00000000000..11a4acef20c
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorFixture.java
@@ -0,0 +1,248 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import static org.junit.Assert.fail;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Supplier;
+import java.util.function.UnaryOperator;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IClasspathEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IFeatureProjectEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IFileEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginProjectEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.ProjectEditors;
+import org.eclipse.papyrus.junit.utils.JUnitUtils;
+import org.eclipse.papyrus.junit.utils.rules.ProjectFixture;
+import org.junit.Test;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * Test fixture managing a project editor under test with utilities for
+ * manipulating and verifying its contents.
+ */
+public class ProjectEditorFixture<T extends IFileEditor> extends ProjectFixture {
+ private final Class<T> editorType;
+
+ private final UnaryOperator<Description> testTransform;
+
+ private T editor;
+
+ private Description test;
+ private boolean isMissingFilesTest;
+ private boolean isCreatedProjectTest;
+ private String[] testResources;
+
+ public ProjectEditorFixture(Class<T> editorType) {
+ this(editorType, UnaryOperator.identity());
+ }
+
+ public ProjectEditorFixture(Class<T> editorType, Supplier<?> testInstance) {
+ this(editorType, createTestTransform(testInstance));
+ }
+
+ public ProjectEditorFixture(Class<T> editorType, UnaryOperator<Description> testTransform) {
+ super();
+
+ this.editorType = editorType;
+ this.testTransform = testTransform;
+ }
+
+ private static UnaryOperator<Description> createTestTransform(Supplier<?> testInstance) {
+ return desc -> {
+ Description result = desc;
+
+ Object test = testInstance.get();
+ if (test != null) {
+ Class<?> testClass = test.getClass();
+ String testMethodName = upTo(desc.getMethodName(), '_');
+
+ Method testMethod = Stream.of(testClass.getMethods())
+ .filter(m -> m.isAnnotationPresent(Test.class))
+ .filter(m -> m.getParameterCount() == 0)
+ .filter(m -> m.getReturnType() == void.class)
+ .filter(m -> testMethodName.equals(m.getName()))
+ .findFirst().get();
+
+ result = Description.createTestDescription(testClass, testMethod.getName(), testMethod.getAnnotations());
+ }
+
+ return result;
+ };
+ }
+
+ private static String upTo(String s, char stop) {
+ int index = s.indexOf(stop);
+ return (index < 0) ? s : s.substring(0, index);
+ }
+
+ @Override
+ public Statement apply(Statement base, Description description) {
+ test = description;
+
+ return super.apply(base, description);
+ }
+
+ public String getTestMethod() {
+ return test.getMethodName();
+ }
+
+ private void initTest() {
+ Description test = testTransform.apply(this.test);
+
+ isMissingFilesTest = Optional.ofNullable(JUnitUtils.getAnnotation(test, MissingFiles.class))
+ .map(MissingFiles::value).orElse(false);
+
+ if (!isMissingFilesTest) {
+ isCreatedProjectTest = Optional.ofNullable(JUnitUtils.getAnnotation(test, CreatedProject.class))
+ .map(CreatedProject::value).orElse(false);
+ }
+
+ testResources = Optional.ofNullable(JUnitUtils.getAnnotation(test, WithResource.class))
+ .map(WithResource::value).orElseGet(() -> new String[0]);
+ }
+
+ @Override
+ protected void createProject(String name) throws CoreException {
+ initTest();
+
+ super.createProject(name);
+
+ IProject project = getProject();
+
+ // Create the required test resources in the project *before* initializing the editor
+ Stream.of(testResources).forEach(res -> {
+ try (InputStream input = getResource(res).openStream()) {
+ // Remove the first segment for the folder partition below resources/
+ IFile file = getProject().getFile(new Path(res).removeFirstSegments(1));
+ ensureContainer(file);
+ file.create(input, false, null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Failed to create test resource: " + e.getMessage());
+ }
+ });
+
+ if (editorType == IProjectEditor.class) {
+ editor = editorType.cast(ProjectEditors.getProjectEditor(project));
+ } else if (editorType == IPluginProjectEditor.class) {
+ editor = editorType.cast(ProjectEditors.getPluginProjectEditor(project));
+ } else if (editorType == IJavaProjectEditor.class) {
+ editor = editorType.cast(ProjectEditors.getJavaProjectEditor(project));
+ } else if (editorType == IManifestEditor.class) {
+ editor = editorType.cast(ProjectEditors.getManifestEditor(project));
+ } else if (editorType == IPluginEditor.class) {
+ editor = editorType.cast(ProjectEditors.getPluginEditor(project));
+ } else if (editorType == IFeatureProjectEditor.class) {
+ editor = editorType.cast(ProjectEditors.getFeatureProjectEditor(project));
+ } else {
+ fail("Unsupported editor type: " + editorType);
+ }
+
+ editor.init();
+
+ if (!isMissingFilesTest) {
+ editor.createFiles(getRequiredFiles());
+ }
+ if (isCreatedProjectTest) {
+ editor.create();
+ editor.save();
+ }
+ }
+
+ private void ensureContainer(IResource resource) throws CoreException {
+ IContainer container = resource.getParent();
+ if (!container.exists() && (container instanceof IFolder)) {
+ // Ultimately, the project exists
+ ensureContainer(container);
+ ((IFolder) container).create(false, true, null);
+ }
+ }
+
+ protected Set<String> getRequiredFiles() {
+ Set<String> result = new HashSet<>();
+
+ result.add(".project");
+ if (editor instanceof IManifestEditor) {
+ result.add("META-INF/MANIFEST.MF");
+ }
+ if (editor instanceof IBuildEditor) {
+ result.add("build.properties");
+ }
+ if (editor instanceof IClasspathEditor) {
+ result.add(".classpath");
+ }
+ if (editor instanceof IPluginProjectEditor) {
+ result.add("plugin.xml");
+ }
+ if (editor instanceof IFeatureProjectEditor) {
+ result.add("feature.xml");
+ }
+
+ return result;
+ }
+
+ @Override
+ protected void deleteProject() {
+ editor = null;
+
+ super.deleteProject();
+ }
+
+ public T getEditor() {
+ return editor;
+ }
+
+ public URL getResource(String resourcePath) {
+ IPath fullPath = new Path("resources").append(resourcePath).removeTrailingSeparator();
+ return FrameworkUtil.getBundle(getClass()).getEntry(fullPath.toString());
+ }
+
+ public List<String> slurp(String filePath) {
+ IFile file = getProject().getFile(filePath);
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents(), file.getCharset()))) {
+ return reader.lines().collect(Collectors.toList());
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Failed to load test project file: " + e.getMessage());
+ return null; // Unreachable
+ }
+ }
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorTest.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorTest.java
new file mode 100644
index 00000000000..062f5e0ebbe
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/ProjectEditorTest.java
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * Test cases for the implementation of the {@link IProjectEditor} API.
+ */
+public class ProjectEditorTest {
+
+ @Rule
+ public final ProjectEditorFixture<? extends IProjectEditor> fixture;
+
+ public ProjectEditorTest() {
+ this(new ProjectEditorFixture<>(IProjectEditor.class));
+ }
+
+ ProjectEditorTest(ProjectEditorFixture<? extends IProjectEditor> fixture) {
+ super();
+
+ this.fixture = fixture;
+ }
+
+ @Test
+ @MissingFiles
+ public void getMissingFiles() {
+ // The .project file already exists (cannot be avoided)
+ assertThat(fixture.getEditor().getMissingFiles(), not(hasItem(".project")));
+ }
+
+ @Test
+ public void addFile() {
+ fixture.getEditor().addFile(fixture.getResource("simple_project/hello.txt"), "hello.txt", true);
+ List<String> lines = fixture.slurp("hello.txt");
+ assertThat(lines, hasItem("Hello, world!"));
+ }
+
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/TriConsumer.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/TriConsumer.java
new file mode 100644
index 00000000000..564060af9f7
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/TriConsumer.java
@@ -0,0 +1,24 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import java.util.function.BiConsumer;
+
+/**
+ * Like a {@link BiConsumer}, only &hellip; guess.
+ */
+@FunctionalInterface
+public interface TriConsumer<A, B, C> {
+ void accept(A a, B b, C c);
+}
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/WithResource.java b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/WithResource.java
new file mode 100644
index 00000000000..f92789fab7c
--- /dev/null
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.eclipse.project.editors.tests/src/org/eclipse/papyrus/eclipse/project/editors/tests/WithResource.java
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * Copyright (c) 2016 Christian W. Damus and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christian W. Damus - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.tests;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for test cases that need one or more resources created in the
+ * test project.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.METHOD, ElementType.TYPE })
+public @interface WithResource {
+ String[] value();
+}

Back to the top