Author: pete.muir(a)jboss.org
Date: 2008-09-11 07:24:52 -0400 (Thu, 11 Sep 2008)
New Revision: 104
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventBus.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverMethod.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EventComponentModel.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentDeploymentTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentLifecycleTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java
ri/trunk/webbeans-ri/testng.xml
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionComponentTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java
Modified:
ri/trunk/examples/webbeans-pizzashack/pom.xml
ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs
ri/trunk/webbeans-ri/pom.xml
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ContainerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContainerTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EjbMetaDataTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
Log:
switch to testng, add David's event bus stuff
Modified: ri/trunk/examples/webbeans-pizzashack/pom.xml
===================================================================
--- ri/trunk/examples/webbeans-pizzashack/pom.xml 2008-09-11 11:23:58 UTC (rev 103)
+++ ri/trunk/examples/webbeans-pizzashack/pom.xml 2008-09-11 11:24:52 UTC (rev 104)
@@ -17,10 +17,11 @@
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
</dependencies>
</project>
Modified: ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs 2008-09-11 11:23:58 UTC (rev
103)
+++ ri/trunk/webbeans-ri/.settings/org.eclipse.jdt.core.prefs 2008-09-11 11:24:52 UTC (rev
104)
@@ -1,266 +1,5 @@
-#Tue Jun 24 10:21:10 BST 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+#Thu Sep 11 11:33:04 BST 2008
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_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=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=3
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do
not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not
insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do
not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not
insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not
insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not
insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do
not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do
not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=80
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=3
-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.compiler.compliance=1.5
Modified: ri/trunk/webbeans-ri/pom.xml
===================================================================
--- ri/trunk/webbeans-ri/pom.xml 2008-09-11 11:23:58 UTC (rev 103)
+++ ri/trunk/webbeans-ri/pom.xml 2008-09-11 11:24:52 UTC (rev 104)
@@ -19,10 +19,11 @@
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
<scope>test</scope>
- </dependency>
+ <classifier>jdk15</classifier>
+ </dependency>
<dependency>
<groupId>javax.servlet</groupId>
@@ -46,5 +47,20 @@
</dependency>
</dependencies>
-
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.2</version>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>testng.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ContainerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ContainerImpl.java 2008-09-11
11:23:58 UTC (rev 103)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ContainerImpl.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -19,6 +19,7 @@
import org.jboss.webbeans.bindings.ProductionBinding;
import org.jboss.webbeans.bindings.StandardBinding;
import org.jboss.webbeans.ejb.EjbManager;
+import org.jboss.webbeans.event.EventBus;
public class ContainerImpl implements Container
{
@@ -26,6 +27,8 @@
private List<Annotation> enabledDeploymentTypes;
private ModelManager modelManager;
private EjbManager ejbLookupManager;
+ private EventBus eventBus;
+
private ThreadLocal<Map<Class<Annotation>, Context>> contexts =
new ThreadLocal<Map<Class<Annotation>, Context>>();
@@ -38,6 +41,7 @@
this.modelManager = new ModelManager();
this.ejbLookupManager = new EjbManager();
this.components = new HashSet<ComponentInstance>();
+ this.eventBus = new EventBus();
}
private void initEnabledDeploymentTypes(List<Annotation>
enabledDeploymentTypes)
@@ -72,8 +76,7 @@
public void addObserver(Observer observer)
{
- // TODO Auto-generated method stub
-
+ eventBus.addObserver(observer);
}
public void fireEvent(Object event, Annotation... bindings)
@@ -118,8 +121,7 @@
public void removeObserver(Observer observer)
{
- // TODO Auto-generated method stub
-
+ eventBus.removeObserver(observer);
}
public Set<ComponentInstance> resolveByName(String name)
@@ -148,8 +150,7 @@
public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
bindings)
{
- // TODO Auto-generated method stub
- return null;
+ return (Set<Observer<T>>) eventBus.getObservers(event, bindings);
}
public List<Annotation> getEnabledDeploymentTypes()
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,46 @@
+package org.jboss.webbeans.event;
+
+import javax.transaction.Synchronization;
+import javax.webbeans.Container;
+import javax.webbeans.Observer;
+
+/**
+ * A synchronization object which will deliver the event to the observer
+ * after the JTA transaction currently in effect is committed.
+ *
+ * @author David Allen
+ *
+ */
+public class DeferredEventNotification implements Synchronization
+{
+ private Container container;
+ private Observer<Object> observer;
+ private Object event;
+
+ /**
+ * Creates a new deferred event notifier.
+ *
+ * @param container The Web Beans container
+ * @param observer The observer to be notified
+ * @param event The event being fired
+ */
+ @SuppressWarnings("unchecked")
+ public DeferredEventNotification(Container container, Object event, Observer
observer)
+ {
+ this.container = container;
+ this.observer = observer;
+ this.event = event;
+ }
+
+ public void afterCompletion(int arg0)
+ {
+ // The event is already delivered before completion
+ }
+
+ public void beforeCompletion()
+ {
+ // Execute the observer method on the event
+ observer.notify(container, event);
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventBus.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventBus.java
(rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventBus.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,120 @@
+package org.jboss.webbeans.event;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.webbeans.Container;
+import javax.webbeans.Observer;
+
+import org.jboss.webbeans.util.JNDI;
+
+/**
+ * The event bus is where observers are registered and events are fired.
+ *
+ * @author David Allen
+ *
+ */
+public class EventBus
+{
+ private final Map<Integer, Set<Observer>> registeredObservers;
+ private final TransactionManager tm;
+ private String tmName =
"java:/TransactionManager";
+
+ /**
+ * Initializes a new instance of the EventBus. This includes looking up the
+ * transaction manager which is needed to defer events till the end of a
+ * transaction.
+ * TODO Should be able to configure JNDI name of transaction manager
+ *
+ */
+ public EventBus()
+ {
+ registeredObservers = new HashMap<Integer, Set<Observer>>();
+ tm = JNDI.lookup(tmName, TransactionManager.class);
+ }
+
+ /**
+ * Adds an observer to the event bus so that it receives event notifications. The
+ * event information is already encapsulated as part of the observer.
+ * @param o The observer that should receive events
+ */
+ public void addObserver(Observer o)
+ {
+ int key = generateKey(o.getEventType(), o.getEventBindingTypes());
+ Set<Observer> l = registeredObservers.get(key);
+ if (l == null)
+ l = new HashSet<Observer>();
+ l.add(o);
+ registeredObservers.put(key, l);
+ }
+
+ /**
+ * Defers delivery of an event till the end of the currently active transaction.
+ *
+ * @param container The WebBeans container
+ * @param event The event object to deliver
+ * @param o The observer to receive the event
+ * @throws SystemException
+ * @throws IllegalStateException
+ * @throws RollbackException
+ */
+ public void deferEvent(Container container, Object event, Observer o) throws
SystemException, IllegalStateException, RollbackException
+ {
+ if (tm != null) {
+ // Get the current transaction associated with the thread
+ Transaction t = tm.getTransaction();
+ if (t != null)
+ t.registerSynchronization(new DeferredEventNotification(container, event,
o));
+ }
+ }
+
+ /**
+ * Resolves the list of observers to be notified for a given event and
+ * optional event bindings.
+ * @param event The event object
+ * @param bindings Optional event bindings
+ * @return A set of Observers
+ */
+ public Set getObservers(Object event, Annotation... bindings)
+ {
+ return registeredObservers.get(generateKey(event.getClass(),
Arrays.asList(bindings)));
+ }
+
+ /**
+ * Removes an observer from the event bus.
+ * @param o The observer to remove
+ */
+ public void removeObserver(Observer o)
+ {
+ Set<Observer> l = registeredObservers.get(generateKey(o.getEventType(),
o.getEventBindingTypes()));
+ if (l != null) {
+ l.remove(o);
+ }
+ }
+
+ /**
+ * Creates a key that can be used in a map for an observer that is notified of
+ * events of a specific type with optional event bindings.
+ * @param eventType The class of the event being observed
+ * @param eventBindings An optional set of event bindings
+ * @return
+ */
+ public int generateKey(Class<?> eventType, Collection eventBindings)
+ {
+ // Produce the sum of the hash codes for the event type and the set of
+ // event bindings.
+ int key = eventType.hashCode();
+ if (eventBindings != null)
+ key += eventBindings.hashCode();
+ return key;
+ }
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventBus.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
(rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,47 @@
+package org.jboss.webbeans.event;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.HashSet;
+
+import javax.webbeans.Event;
+
+import org.jboss.webbeans.ComponentInstanceImpl;
+import org.jboss.webbeans.model.EventComponentModel;
+
+/**
+ * Implementation of an event as a simple component.
+ *
+ * @author David Allen
+ *
+ */
+public class EventImpl<T> extends ComponentInstanceImpl<T> implements
Event<T>
+{
+ private EventComponentModel<T> componentModel;
+
+ /**
+ * Creates a simple implementation of {@link Event} with no default
+ * event bindings.
+ */
+ public EventImpl(EventComponentModel<T> componentMetaModel) {
+ super(componentMetaModel);
+ this.componentModel = componentMetaModel;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.webbeans.Event#fire(java.lang.Object,
java.lang.annotation.Annotation[])
+ */
+ public void fire(T event, Annotation... bindings)
+ {
+ // Combine the annotations passed here with the annotations (event bindings)
+ // specified on the @Observable object.
+ Set<Annotation> eventBindings = new HashSet<Annotation>();
+ eventBindings.addAll(this.getBindingTypes());
+ eventBindings.addAll(Arrays.asList(bindings));
+
+ // Invoke the container method to fire the event per 7.2
+ componentModel.getContainer().fireEvent(event, eventBindings.toArray(new
Annotation[0]));
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,108 @@
+package org.jboss.webbeans.event;
+
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.webbeans.Container;
+import javax.webbeans.Observer;
+
+import org.jboss.webbeans.injectable.Parameter;
+import org.jboss.webbeans.model.AbstractComponentModel;
+
+/**
+ * <p>
+ * Reference implementation for the Observer interface, which represents an
+ * observer method. Each observer method has an event type, the class of the
+ * event object being observed, and event binding types, annotations applied to
+ * the event parameter to narrow the event notifications delivered.
+ * </p>
+ *
+ * <p>
+ * The hash code for each observer method includes all the information
+ * contained. The data structure used to lookup observers must account for an
+ * arbitrary number of observers of the same event.
+ * </p>
+ *
+ * @author David Allen
+ *
+ */
+public class ObserverImpl<T> implements Observer<T>
+{
+
+ private final AbstractComponentModel<?, ?> compModel;
+ private final ObserverMethod observerMethod;
+ private final Set<Annotation> eventBindings;
+ private final Class<T> eventType;
+
+ /**
+ * Creates an Observer which describes an observer method (7.3).
+ *
+ * @param componentModel
+ * The model for the component which defines the observer method
+ * @param observer
+ * The observer method to notify
+ * @param eventType
+ * The type of event being observed
+ */
+ @SuppressWarnings("unchecked")
+ public ObserverImpl(AbstractComponentModel<?, ?> componentModel,
+ ObserverMethod observer, Class<T> eventType)
+ {
+ this.compModel = componentModel;
+ this.observerMethod = observer;
+ this.eventType = eventType;
+ List<Parameter> parms = observer.getParameters();
+ eventBindings = new HashSet<Annotation>();
+ for (Parameter p : parms)
+ {
+ if (p.getType().equals(eventType))
+ {
+ if ((p.getBindingTypes() != null)
+ && (p.getBindingTypes().length > 0))
+ {
+ eventBindings.addAll(Arrays.asList(p.getBindingTypes()));
+ break;
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.webbeans.Observer#getEventBindingTypes()
+ */
+ public Set<Annotation> getEventBindingTypes()
+ {
+ return Collections.unmodifiableSet(this.eventBindings);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.webbeans.Observer#getEventType()
+ */
+ public Class<T> getEventType()
+ {
+ return eventType;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.webbeans.Observer#notify(javax.webbeans.Container,
+ * java.lang.Object)
+ */
+ public void notify(Container container, T event)
+ {
+ // Get the most specialized instance of the component
+ Object instance = container.getInstanceByType(compModel.getType(),
+ compModel.getBindingTypes().toArray(new Annotation[0]));
+ if (instance != null)
+ this.observerMethod.invoke(container, instance, event);
+ }
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverMethod.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverMethod.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,74 @@
+package org.jboss.webbeans.event;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import javax.webbeans.Container;
+
+import org.jboss.webbeans.injectable.InjectableMethod;
+import org.jboss.webbeans.injectable.Parameter;
+
+/**
+ * A specialized injectable method where one of the injected parameters is an
+ * event object.
+ *
+ * @author David Allen
+ *
+ */
+public class ObserverMethod extends InjectableMethod
+{
+
+ public ObserverMethod(Method method)
+ {
+ super(method);
+ }
+
+ /**
+ * Invokes the method on the given component instance and uses the specified
+ * event object for parameter injection.
+ *
+ * @param container The WebBeans container
+ * @param instance The component instance to invoke the observer method on
+ * @param event The event object being fired
+ */
+ public void invoke(Container container, Object instance, Object event)
+ {
+ try
+ {
+ getMethod().invoke(instance, getParameterValues(container, event));
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to invoke " + getMethod() + "
on " + instance, e);
+ }
+ }
+
+ /**
+ * Creates a list of parameter values to inject and uses the specified event object
+ * to inject the observed event.
+ *
+ * @param container The WebBeans container
+ * @param event The event being fired
+ * @return an array of objects that serve as arguments for the invocation of the
method
+ */
+ @SuppressWarnings("unchecked")
+ public Object[] getParameterValues(Container container, Object event)
+ {
+ // Let the super class get the parameter values, but substitute the event
+ // object so that we know for certain it is the correct one.
+ Object[] parameterValues = super.getParameterValues(container);
+ List<Parameter> parms = this.getParameters();
+ int i = 0;
+ for (Parameter p : parms)
+ {
+ if (p.getType().isAssignableFrom(event.getClass()))
+ {
+ parameterValues[i] = event;
+ break;
+ }
+ i++;
+ }
+ return parameterValues;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverMethod.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -59,7 +59,7 @@
checkRequiredTypesImplemented();
checkScopeAllowed();
// TODO This is too high
- checkComponentImplementation(getType());
+ checkComponentImplementation();
// TODO Interceptors
}
@@ -161,9 +161,9 @@
- protected static void checkComponentImplementation(Class<?> type)
+ protected void checkComponentImplementation()
{
- if (Reflections.isAbstract(type))
+ if (Reflections.isAbstract(getType()))
{
throw new RuntimeException("Web Bean implementation class " + type +
" cannot be declared abstract");
}
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EventComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EventComponentModel.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EventComponentModel.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,71 @@
+package org.jboss.webbeans.model;
+
+import java.lang.annotation.Annotation;
+
+import javax.webbeans.Container;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.bindings.DependentBinding;
+import org.jboss.webbeans.bindings.StandardBinding;
+import org.jboss.webbeans.introspector.AnnotatedType;
+
+/**
+ * Web Beans component meta model for the container instantiated, injectable,
+ * observable events (Section 7.2).
+ *
+ * @author David Allen
+ *
+ */
+public class EventComponentModel<T> extends SimpleComponentModel<T>
+{
+
+ private StandardBinding deploymentType = new StandardBinding();
+ private DependentBinding scopeType = new DependentBinding();
+ private ContainerImpl container;
+
+ /**
+ * Creates a new component model for an injectable, observable event object.
+ * @see org.jboss.webbeans.event.EventImpl
+ *
+ * @param annotatedItem The injectable variable declared in Java
+ * @param xmlAnnotatedItem The injectable variable defined in XML
+ * @param container The Web Beans container
+ */
+ public EventComponentModel(AnnotatedType annotatedItem, AnnotatedType
xmlAnnotatedItem, ContainerImpl container)
+ {
+ super(annotatedItem, xmlAnnotatedItem, container);
+ // This is needed later for the impl of Event to fire events with the container
+ this.container = container;
+ }
+
+ /**
+ * The implementation of the container used to create this model.
+ * @return the container
+ */
+ public Container getContainer()
+ {
+ return container;
+ }
+
+ @Override
+ public Annotation getDeploymentType()
+ {
+ // This is always @Standard per 7.2
+ return deploymentType;
+ }
+
+ @Override
+ public String getName()
+ {
+ // No name per 7.2
+ return "";
+ }
+
+ @Override
+ public Annotation getScopeType()
+ {
+ // This is always @Dependent per 7.2
+ return scopeType;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EventComponentModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -29,6 +29,13 @@
initBoundTo();
}
+ @Override
+ protected void checkComponentImplementation()
+ {
+ // No - op for remote components
+ // TODO THis is wrong probably
+ }
+
protected void initBoundTo()
{
if (getXmlAnnotatedItem().isAnnotationPresent(BoundTo.class))
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -13,7 +13,7 @@
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.test.components.Antelope;
import org.jboss.webbeans.test.components.Order;
-import org.junit.Test;
+import org.testng.annotations.Test;
public class ClassAnnotatedItemTest
{
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentDeploymentTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentDeploymentTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentDeploymentTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,39 @@
+package org.jboss.webbeans.test;
+
+import org.testng.annotations.Test;
+
+public class ComponentDeploymentTest
+{
+
+
+ @Test(groups="specialization") @SpecAssertion(section="3.1.4")
+ public void testOnlySpecializedSimpleComponentDeployed()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups="specialization") @SpecAssertion(section="3.1.4")
+ public void testSpecializedSimpleComponentExtends()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups="specialization") @SpecAssertion(section="3.1.4")
+ public void testSpecializedSimpleComponentHasSameBindingAnnotations()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+ @Test(groups="specialization") @SpecAssertion(section="3.1.4")
+ public void testSpecializedSimpleComponentHasSameName()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentDeploymentTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -1,161 +0,0 @@
-package org.jboss.webbeans.test;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-
-import javax.webbeans.Current;
-
-import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.injectable.SimpleConstructor;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.SimpleComponentModel;
-import org.jboss.webbeans.test.annotations.Synchronous;
-import org.jboss.webbeans.test.components.Chicken;
-import org.jboss.webbeans.test.components.Donkey;
-import org.jboss.webbeans.test.components.Duck;
-import org.jboss.webbeans.test.components.Goat;
-import org.jboss.webbeans.test.components.Goose;
-import org.jboss.webbeans.test.components.Order;
-import org.jboss.webbeans.test.components.Sheep;
-import org.jboss.webbeans.test.components.Turkey;
-import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ConstructorMetaModelTest
-{
-
- private ContainerImpl container;
-
- private AnnotatedType emptyAnnotatedItem;
-
- @Before
- public void before()
- {
- emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
- container = new MockContainerImpl(null);
-
- }
-
- @Test
- public void testImplicitConstructor()
- {
- SimpleConstructor<Order> constructor = new
SimpleComponentModel<Order>(new SimpleAnnotatedType<Order>(Order.class),
emptyAnnotatedItem, container).getConstructor();
- assert constructor.getConstructor().getDeclaringClass().equals(Order.class);
- assert constructor.getConstructor().getParameterTypes().length == 0;
- assert constructor.getParameters().size() == 0;
- }
-
- @Test
- public void testSingleConstructor()
- {
- SimpleConstructor<Donkey> constructor = new
SimpleComponentModel<Donkey>(new SimpleAnnotatedType(Donkey.class),
emptyAnnotatedItem, container).getConstructor();
- assert constructor.getConstructor().getDeclaringClass().equals(Donkey.class);
- assert constructor.getConstructor().getParameterTypes().length == 1;
- assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
- assert constructor.getParameters().size() == 1;
- assert constructor.getParameters().get(0).getType().equals(String.class);
- assert constructor.getParameters().get(0).getBindingTypes().length == 1;
- assert
constructor.getParameters().get(0).getBindingTypes()[0].annotationType().equals(Current.class);
- }
-
- @Test
- public void testInitializerAnnotatedConstructor()
- {
- SimpleConstructor<Sheep> constructor = new
SimpleComponentModel<Sheep>(new SimpleAnnotatedType(Sheep.class),
emptyAnnotatedItem, container).getConstructor();
- assert constructor.getConstructor().getDeclaringClass().equals(Sheep.class);
- assert constructor.getConstructor().getParameterTypes().length == 2;
- assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
- assert constructor.getConstructor().getParameterTypes()[1].equals(Double.class);
- assert constructor.getParameters().size() == 2;
- assert constructor.getParameters().get(0).getType().equals(String.class);
- assert constructor.getParameters().get(1).getType().equals(Double.class);
- assert constructor.getParameters().get(0).getBindingTypes().length == 1;
- assert
constructor.getParameters().get(0).getBindingTypes()[0].annotationType().equals(Current.class);
- assert constructor.getParameters().get(1).getBindingTypes().length == 1;
- assert
constructor.getParameters().get(1).getBindingTypes()[0].annotationType().equals(Current.class);
- }
-
- @Test
- public void testBindingTypeAnnotatedConstructor()
- {
- SimpleConstructor<Duck> constructor = new
SimpleComponentModel<Duck>(new SimpleAnnotatedType(Duck.class), emptyAnnotatedItem,
container).getConstructor();
- assert constructor.getConstructor().getDeclaringClass().equals(Duck.class);
- assert constructor.getConstructor().getParameterTypes().length == 2;
- assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
- assert constructor.getConstructor().getParameterTypes()[1].equals(Integer.class);
- assert constructor.getParameters().size() == 2;
- assert constructor.getParameters().get(0).getType().equals(String.class);
- assert constructor.getParameters().get(1).getType().equals(Integer.class);
- assert constructor.getParameters().get(0).getBindingTypes().length == 1;
- assert
constructor.getParameters().get(0).getBindingTypes()[0].annotationType().equals(Current.class);
- assert constructor.getParameters().get(1).getBindingTypes().length == 1;
- assert
constructor.getParameters().get(1).getBindingTypes()[0].annotationType().equals(Synchronous.class);
- }
-
- @Test
- public void testTooManyInitializerAnnotatedConstructor()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Chicken>(new SimpleAnnotatedType(Chicken.class),
emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
-
- }
-
- @Test
- public void testTooManyConstructors()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Turkey>(new SimpleAnnotatedType(Turkey.class),
emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
-
- }
-
- @Test
- public void testTooManyBindingTypeAnnotatedConstructor()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Goat>(new SimpleAnnotatedType(Goat.class),
emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
-
- }
-
- @Test
- public void testBindingTypeAndInitializerAnnotatedConstructor()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Goose>(new SimpleAnnotatedType(Goose.class),
emptyAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
-
- }
-
-}
Copied:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java (from
rev 98,
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,161 @@
+package org.jboss.webbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+
+import javax.webbeans.Current;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.injectable.SimpleConstructor;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.test.annotations.Synchronous;
+import org.jboss.webbeans.test.components.Chicken;
+import org.jboss.webbeans.test.components.Donkey;
+import org.jboss.webbeans.test.components.Duck;
+import org.jboss.webbeans.test.components.Goat;
+import org.jboss.webbeans.test.components.Goose;
+import org.jboss.webbeans.test.components.Order;
+import org.jboss.webbeans.test.components.Sheep;
+import org.jboss.webbeans.test.components.Turkey;
+import org.jboss.webbeans.test.mock.MockContainerImpl;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class ConstructorModelTest
+{
+
+ private ContainerImpl container;
+
+ private AnnotatedType emptyAnnotatedItem;
+
+ @BeforeMethod
+ public void before()
+ {
+ emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
+ container = new MockContainerImpl(null);
+
+ }
+
+ @Test
+ public void testImplicitConstructor()
+ {
+ SimpleConstructor<Order> constructor = new
SimpleComponentModel<Order>(new SimpleAnnotatedType<Order>(Order.class),
emptyAnnotatedItem, container).getConstructor();
+ assert constructor.getConstructor().getDeclaringClass().equals(Order.class);
+ assert constructor.getConstructor().getParameterTypes().length == 0;
+ assert constructor.getParameters().size() == 0;
+ }
+
+ @Test
+ public void testSingleConstructor()
+ {
+ SimpleConstructor<Donkey> constructor = new
SimpleComponentModel<Donkey>(new SimpleAnnotatedType(Donkey.class),
emptyAnnotatedItem, container).getConstructor();
+ assert constructor.getConstructor().getDeclaringClass().equals(Donkey.class);
+ assert constructor.getConstructor().getParameterTypes().length == 1;
+ assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
+ assert constructor.getParameters().size() == 1;
+ assert constructor.getParameters().get(0).getType().equals(String.class);
+ assert constructor.getParameters().get(0).getBindingTypes().length == 1;
+ assert
constructor.getParameters().get(0).getBindingTypes()[0].annotationType().equals(Current.class);
+ }
+
+ @Test
+ public void testInitializerAnnotatedConstructor()
+ {
+ SimpleConstructor<Sheep> constructor = new
SimpleComponentModel<Sheep>(new SimpleAnnotatedType(Sheep.class),
emptyAnnotatedItem, container).getConstructor();
+ assert constructor.getConstructor().getDeclaringClass().equals(Sheep.class);
+ assert constructor.getConstructor().getParameterTypes().length == 2;
+ assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
+ assert constructor.getConstructor().getParameterTypes()[1].equals(Double.class);
+ assert constructor.getParameters().size() == 2;
+ assert constructor.getParameters().get(0).getType().equals(String.class);
+ assert constructor.getParameters().get(1).getType().equals(Double.class);
+ assert constructor.getParameters().get(0).getBindingTypes().length == 1;
+ assert
constructor.getParameters().get(0).getBindingTypes()[0].annotationType().equals(Current.class);
+ assert constructor.getParameters().get(1).getBindingTypes().length == 1;
+ assert
constructor.getParameters().get(1).getBindingTypes()[0].annotationType().equals(Current.class);
+ }
+
+ @Test
+ public void testBindingTypeAnnotatedConstructor()
+ {
+ SimpleConstructor<Duck> constructor = new
SimpleComponentModel<Duck>(new SimpleAnnotatedType(Duck.class), emptyAnnotatedItem,
container).getConstructor();
+ assert constructor.getConstructor().getDeclaringClass().equals(Duck.class);
+ assert constructor.getConstructor().getParameterTypes().length == 2;
+ assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
+ assert constructor.getConstructor().getParameterTypes()[1].equals(Integer.class);
+ assert constructor.getParameters().size() == 2;
+ assert constructor.getParameters().get(0).getType().equals(String.class);
+ assert constructor.getParameters().get(1).getType().equals(Integer.class);
+ assert constructor.getParameters().get(0).getBindingTypes().length == 1;
+ assert
constructor.getParameters().get(0).getBindingTypes()[0].annotationType().equals(Current.class);
+ assert constructor.getParameters().get(1).getBindingTypes().length == 1;
+ assert
constructor.getParameters().get(1).getBindingTypes()[0].annotationType().equals(Synchronous.class);
+ }
+
+ @Test
+ public void testTooManyInitializerAnnotatedConstructor()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Chicken>(new SimpleAnnotatedType(Chicken.class),
emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+
+ }
+
+ @Test
+ public void testTooManyConstructors()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Turkey>(new SimpleAnnotatedType(Turkey.class),
emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+
+ }
+
+ @Test
+ public void testTooManyBindingTypeAnnotatedConstructor()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Goat>(new SimpleAnnotatedType(Goat.class),
emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+
+ }
+
+ @Test
+ public void testBindingTypeAndInitializerAnnotatedConstructor()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Goose>(new SimpleAnnotatedType(Goose.class),
emptyAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContainerTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContainerTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContainerTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -14,7 +14,7 @@
import org.jboss.webbeans.test.bindings.AnotherDeploymentTypeBinding;
import org.jboss.webbeans.test.bindings.HornedAnimalDeploymentTypeBinding;
import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.junit.Test;
+import org.testng.annotations.Test;
public class ContainerTest
{
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,29 @@
+/**
+ *
+ */
+package org.jboss.webbeans.test;
+
+import org.testng.annotations.Test;
+
+/**
+ * Unit tests for the deferred event notification object used to delay
+ * notification till the end of a transaction.
+ *
+ * @author David Allen
+ *
+ */
+public class DeferredEventNotificationTest
+{
+
+ /**
+ * Test method for {@link
org.jboss.webbeans.event.DeferredEventNotification#beforeCompletion()}.
+ */
+ @Test
+ public final void testBeforeCompletion()
+ {
+ // When the transaction is committed, the beforeCompletion() method is
+ // invoked which in turn invokes the observer. Here the mock observer
+ // is used to keep track of the event being fired.
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentStrategyTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -5,7 +5,7 @@
import org.jboss.webbeans.ContainerImpl;
import org.jboss.webbeans.deployment.DeploymentStrategy;
import org.jboss.webbeans.scannotation.ClasspathUrlFinder;
-import org.junit.Test;
+import org.testng.annotations.Test;
public class DeploymentStrategyTest
{
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EjbMetaDataTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EjbMetaDataTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EjbMetaDataTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -4,7 +4,7 @@
import org.jboss.webbeans.test.components.Leopard;
import org.jboss.webbeans.test.components.Lion;
import org.jboss.webbeans.test.components.Tiger;
-import org.junit.Test;
+import org.testng.annotations.Test;
public class EjbMetaDataTest
{
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -25,8 +25,8 @@
import org.jboss.webbeans.test.components.Tiger;
import org.jboss.webbeans.test.mock.MockContainerImpl;
import org.jboss.webbeans.util.Reflections;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
public class EnterpriseComponentModelTest
{
@@ -35,7 +35,7 @@
private AnnotatedType emptyAnnotatedItem;
- @Before
+ @BeforeMethod
public void before()
{
emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializationTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializationTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializationTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -1,6 +1,6 @@
package org.jboss.webbeans.test;
-import org.junit.Test;
+import org.testng.annotations.Test;
public class InitializationTest
{
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,119 @@
+/**
+ *
+ */
+package org.jboss.webbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.webbeans.Observer;
+import javax.webbeans.Observes;
+import javax.webbeans.Production;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.bindings.StandardBinding;
+import org.jboss.webbeans.event.ObserverImpl;
+import org.jboss.webbeans.event.ObserverMethod;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.model.StereotypeModel;
+import org.jboss.webbeans.test.annotations.AnimalStereotype;
+import org.jboss.webbeans.test.annotations.Asynchronous;
+import org.jboss.webbeans.test.annotations.FishStereotype;
+import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
+import org.jboss.webbeans.test.annotations.RiverFishStereotype;
+import org.jboss.webbeans.test.bindings.AnotherDeploymentTypeBinding;
+import org.jboss.webbeans.test.bindings.AsynchronousBinding;
+import org.jboss.webbeans.test.components.Tuna;
+import org.jboss.webbeans.test.mock.MockContainerImpl;
+import org.jboss.webbeans.util.Reflections;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Unit tests for the implementation of Observer.
+ *
+ * @author David Allen
+ *
+ */
+public class ObserverTest
+{
+ private ContainerImpl container;
+
+ public class Event
+ {
+ // Simple class used for testing
+ }
+
+ public class AnObserver
+ {
+ public void observe(@Observes Event e)
+ {
+ // An observer method
+ }
+ }
+
+ @BeforeMethod
+ public void before()
+ {
+ List<Annotation> enabledDeploymentTypes = new ArrayList<Annotation>();
+ enabledDeploymentTypes.add(new StandardBinding());
+ enabledDeploymentTypes.add(new AnotherDeploymentTypeBinding());
+ container = new MockContainerImpl(enabledDeploymentTypes);
+
+ initStereotypes(container);
+ }
+
+ private void initStereotypes(ContainerImpl container)
+ {
+ container.getModelManager().addStereotype(new StereotypeModel(new
SimpleAnnotatedType(AnimalStereotype.class)));
+ container.getModelManager().addStereotype(new StereotypeModel(new
SimpleAnnotatedType(FishStereotype.class)));
+ container.getModelManager().addStereotype(new StereotypeModel(new
SimpleAnnotatedType(RiverFishStereotype.class)));
+ container.getModelManager().addStereotype(new StereotypeModel(new
SimpleAnnotatedType(RequestScopedAnimalStereotype.class)));
+ }
+
+
+ /**
+ * Test method for {@link
org.jboss.webbeans.event.ObserverImpl#getEventBindingTypes()}.
+ */
+ @SuppressWarnings("unchecked")
+ @Test(groups="eventbus")
+ public final void testGetEventBindingTypes() throws Exception
+ {
+ // Create an observer with known binding types
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Asynchronous.class, new AsynchronousBinding());
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Tuna.class, annotations);
+ SimpleComponentModel<Tuna> tuna = new SimpleComponentModel<Tuna>(new
SimpleAnnotatedType(Tuna.class), annotatedItem, container);
+ assert tuna.getDeploymentType().annotationType().equals(Production.class);
+ ObserverMethod om = new
ObserverMethod(AnObserver.class.getMethod("observe", new
Class[]{Event.class}));
+
+ Observer<Event> o = new ObserverImpl<Event>(tuna, om, Event.class);
+ assert o.getEventBindingTypes().size() == 1;
+ assert Reflections.annotationSetMatches(o.getEventBindingTypes(),
Asynchronous.class);
+ assert o.getEventType().equals(Event.class);
+ }
+
+ /**
+ * Test method for {@link org.jboss.webbeans.event.ObserverImpl#getEventType()}.
+ */
+ @Test(groups="eventbus")
+ public final void testGetEventType()
+ {
+ //TODO Implement
+ }
+
+ /**
+ * Test method for {@link
org.jboss.webbeans.event.ObserverImpl#notify(javax.webbeans.Container,
java.lang.Object)}.
+ */
+ @Test(groups="eventbus")
+ public final void testNotify()
+ {
+ //TODO Implement
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionComponentModelTest.java
(from rev 99,
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionComponentTest.java)
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionComponentModelTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionComponentModelTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,32 @@
+package org.jboss.webbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.test.mock.MockContainerImpl;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class ProducerExpressionComponentModelTest
+{
+
+ private ContainerImpl container;
+ private AnnotatedType<?> emptyAnnotatedItem;
+
+ @BeforeMethod
+ public void before()
+ {
+ emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
+ container = new MockContainerImpl(null);
+ }
+
+ @Test
+ public void testApiTypes()
+ {
+
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionComponentModelTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionComponentTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionComponentTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionComponentTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -1,32 +0,0 @@
-package org.jboss.webbeans.test;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-
-import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ProducerExpressionComponentTest
-{
-
- private ContainerImpl container;
- private AnnotatedType<?> emptyAnnotatedItem;
-
- @Before
- public void before()
- {
- emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
- container = new MockContainerImpl(null);
- }
-
- @Test
- public void testApiTypes()
- {
-
- }
-
-}
Copied:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java
(from rev 99,
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentTest.java)
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,159 @@
+package org.jboss.webbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+
+import javax.webbeans.Current;
+import javax.webbeans.Dependent;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedMethod;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.model.ProducerMethodComponentModel;
+import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.test.annotations.Tame;
+import org.jboss.webbeans.test.components.Animal;
+import org.jboss.webbeans.test.components.BlackWidow;
+import org.jboss.webbeans.test.components.DaddyLongLegs;
+import org.jboss.webbeans.test.components.DeadlyAnimal;
+import org.jboss.webbeans.test.components.DeadlySpider;
+import org.jboss.webbeans.test.components.LadybirdSpider;
+import org.jboss.webbeans.test.components.Spider;
+import org.jboss.webbeans.test.components.SpiderProducer;
+import org.jboss.webbeans.test.components.Tarantula;
+import org.jboss.webbeans.test.components.TrapdoorSpider;
+import org.jboss.webbeans.test.components.broken.ComponentWithFinalProducerMethod;
+import org.jboss.webbeans.test.components.broken.ComponentWithStaticProducerMethod;
+import org.jboss.webbeans.test.mock.MockContainerImpl;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class ProducerMethodComponentModelTest
+{
+
+ private ContainerImpl container;
+ private AnnotatedType<?> emptyAnnotatedItem;
+
+ @BeforeMethod
+ public void before()
+ {
+ emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
+ container = new MockContainerImpl(null);
+ }
+
+ @Test @SpecAssertion(section="3.3")
+ public void testStaticMethod() throws SecurityException, NoSuchMethodException
+ {
+ SimpleComponentModel<ComponentWithStaticProducerMethod> componentModel = new
SimpleComponentModel<ComponentWithStaticProducerMethod>(new
SimpleAnnotatedType<ComponentWithStaticProducerMethod>(ComponentWithStaticProducerMethod.class),
emptyAnnotatedItem, container);
+ container.getModelManager().addComponentModel(componentModel);
+ Method method =
ComponentWithStaticProducerMethod.class.getMethod("getString");
+ boolean exception = false;
+ try
+ {
+ new ProducerMethodComponentModel<String>(new
SimpleAnnotatedMethod(method), container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test @SpecAssertion(section="3.3")
+ public void testApiTypes() throws SecurityException, NoSuchMethodException
+ {
+ SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
+ container.getModelManager().addComponentModel(componentModel);
+ Method method = SpiderProducer.class.getMethod("produceTarantula");
+ ProducerMethodComponentModel<Tarantula> tarantulaModel = new
ProducerMethodComponentModel<Tarantula>(new SimpleAnnotatedMethod(method),
container);
+ assert tarantulaModel.getApiTypes().contains(Tarantula.class);
+ assert tarantulaModel.getApiTypes().contains(DeadlySpider.class);
+ assert tarantulaModel.getApiTypes().contains(Spider.class);
+ assert tarantulaModel.getApiTypes().contains(Animal.class);
+ assert tarantulaModel.getApiTypes().contains(DeadlyAnimal.class);
+ assert !tarantulaModel.getApiTypes().contains(Object.class);
+ }
+
+ @Test @SpecAssertion(section="3.3.1")
+ public void testDefaultBindingType() throws SecurityException, NoSuchMethodException
+ {
+ SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
+ container.getModelManager().addComponentModel(componentModel);
+ Method method = SpiderProducer.class.getMethod("produceTarantula");
+ ProducerMethodComponentModel<Tarantula> tarantulaModel = new
ProducerMethodComponentModel<Tarantula>(new SimpleAnnotatedMethod(method),
container);
+ assert tarantulaModel.getBindingTypes().size() == 1;
+ assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
+ }
+
+ @Test
+ public void testBindingType() throws SecurityException, NoSuchMethodException
+ {
+ SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
+ container.getModelManager().addComponentModel(componentModel);
+ Method method = SpiderProducer.class.getMethod("produceTameTarantula");
+ ProducerMethodComponentModel<Tarantula> tarantulaModel = new
ProducerMethodComponentModel<Tarantula>(new SimpleAnnotatedMethod(method),
container);
+ assert tarantulaModel.getBindingTypes().size() == 1;
+ assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
+ }
+
+ @Test @SpecAssertion(section="3.3")
+ public void testFinalMethod() throws SecurityException, NoSuchMethodException
+ {
+ SimpleComponentModel<ComponentWithFinalProducerMethod> componentModel = new
SimpleComponentModel<ComponentWithFinalProducerMethod>(new
SimpleAnnotatedType<ComponentWithFinalProducerMethod>(ComponentWithFinalProducerMethod.class),
emptyAnnotatedItem, container);
+ container.getModelManager().addComponentModel(componentModel);
+ Method method =
ComponentWithFinalProducerMethod.class.getMethod("getString");
+ boolean exception = false;
+ try
+ {
+ new ProducerMethodComponentModel<String>(new
SimpleAnnotatedMethod(method), container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test @SpecAssertion(section="3.3")
+ public void testFinalMethodWithDependentScope() throws SecurityException,
NoSuchMethodException
+ {
+ SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
+ container.getModelManager().addComponentModel(componentModel);
+ Method method = SpiderProducer.class.getMethod("produceTrapdoorSpider");
+ ProducerMethodComponentModel<TrapdoorSpider> trapdoorSpiderModel = new
ProducerMethodComponentModel<TrapdoorSpider>(new SimpleAnnotatedMethod(method),
container);
+ assert
trapdoorSpiderModel.getScopeType().annotationType().equals(Dependent.class);
+ }
+
+ @Test @SpecAssertion(section="3.3.6")
+ public void testNamedMethod() throws SecurityException, NoSuchMethodException
+ {
+ SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
+ container.getModelManager().addComponentModel(componentModel);
+ Method method = SpiderProducer.class.getMethod("produceBlackWidow");
+ ProducerMethodComponentModel<BlackWidow> blackWidowSpiderModel = new
ProducerMethodComponentModel<BlackWidow>(new SimpleAnnotatedMethod(method),
container);
+ assert blackWidowSpiderModel.getName().equals("blackWidow");
+ }
+
+ @Test @SpecAssertion(section="3.3.6")
+ public void testDefaultNamedMethod() throws SecurityException, NoSuchMethodException
+ {
+ SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
+ container.getModelManager().addComponentModel(componentModel);
+ Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
+ ProducerMethodComponentModel<DaddyLongLegs> daddyLongLegsSpiderModel = new
ProducerMethodComponentModel<DaddyLongLegs>(new SimpleAnnotatedMethod(method),
container);
+ assert
daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
+ }
+
+ @Test @SpecAssertion(section="3.3.6")
+ public void testDefaultNamedJavaBeanMethod() throws SecurityException,
NoSuchMethodException
+ {
+ SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
+ container.getModelManager().addComponentModel(componentModel);
+ Method method = SpiderProducer.class.getMethod("getLadybirdSpider");
+ ProducerMethodComponentModel<LadybirdSpider> ladybirdSpiderModel = new
ProducerMethodComponentModel<LadybirdSpider>(new SimpleAnnotatedMethod(method),
container);
+ assert ladybirdSpiderModel.getName().equals("ladybirdSpider");
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -1,159 +0,0 @@
-package org.jboss.webbeans.test;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-
-import javax.webbeans.Current;
-import javax.webbeans.Dependent;
-
-import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedMethod;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.ProducerMethodComponentModel;
-import org.jboss.webbeans.model.SimpleComponentModel;
-import org.jboss.webbeans.test.annotations.Tame;
-import org.jboss.webbeans.test.components.Animal;
-import org.jboss.webbeans.test.components.BlackWidow;
-import org.jboss.webbeans.test.components.DaddyLongLegs;
-import org.jboss.webbeans.test.components.DeadlyAnimal;
-import org.jboss.webbeans.test.components.DeadlySpider;
-import org.jboss.webbeans.test.components.LadybirdSpider;
-import org.jboss.webbeans.test.components.Spider;
-import org.jboss.webbeans.test.components.SpiderProducer;
-import org.jboss.webbeans.test.components.Tarantula;
-import org.jboss.webbeans.test.components.TrapdoorSpider;
-import org.jboss.webbeans.test.components.broken.ComponentWithFinalProducerMethod;
-import org.jboss.webbeans.test.components.broken.ComponentWithStaticProducerMethod;
-import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ProducerMethodComponentTest
-{
-
- private ContainerImpl container;
- private AnnotatedType<?> emptyAnnotatedItem;
-
- @Before
- public void before()
- {
- emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
- container = new MockContainerImpl(null);
- }
-
- @Test @SpecAssertion(section="3.3")
- public void testStaticMethod() throws SecurityException, NoSuchMethodException
- {
- SimpleComponentModel<ComponentWithStaticProducerMethod> componentModel = new
SimpleComponentModel<ComponentWithStaticProducerMethod>(new
SimpleAnnotatedType<ComponentWithStaticProducerMethod>(ComponentWithStaticProducerMethod.class),
emptyAnnotatedItem, container);
- container.getModelManager().addComponentModel(componentModel);
- Method method =
ComponentWithStaticProducerMethod.class.getMethod("getString");
- boolean exception = false;
- try
- {
- new ProducerMethodComponentModel<String>(new
SimpleAnnotatedMethod(method), container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test @SpecAssertion(section="3.3")
- public void testApiTypes() throws SecurityException, NoSuchMethodException
- {
- SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
- container.getModelManager().addComponentModel(componentModel);
- Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodComponentModel<Tarantula> tarantulaModel = new
ProducerMethodComponentModel<Tarantula>(new SimpleAnnotatedMethod(method),
container);
- assert tarantulaModel.getApiTypes().contains(Tarantula.class);
- assert tarantulaModel.getApiTypes().contains(DeadlySpider.class);
- assert tarantulaModel.getApiTypes().contains(Spider.class);
- assert tarantulaModel.getApiTypes().contains(Animal.class);
- assert tarantulaModel.getApiTypes().contains(DeadlyAnimal.class);
- assert !tarantulaModel.getApiTypes().contains(Object.class);
- }
-
- @Test @SpecAssertion(section="3.3.1")
- public void testDefaultBindingType() throws SecurityException, NoSuchMethodException
- {
- SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
- container.getModelManager().addComponentModel(componentModel);
- Method method = SpiderProducer.class.getMethod("produceTarantula");
- ProducerMethodComponentModel<Tarantula> tarantulaModel = new
ProducerMethodComponentModel<Tarantula>(new SimpleAnnotatedMethod(method),
container);
- assert tarantulaModel.getBindingTypes().size() == 1;
- assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
- }
-
- @Test
- public void testBindingType() throws SecurityException, NoSuchMethodException
- {
- SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
- container.getModelManager().addComponentModel(componentModel);
- Method method = SpiderProducer.class.getMethod("produceTameTarantula");
- ProducerMethodComponentModel<Tarantula> tarantulaModel = new
ProducerMethodComponentModel<Tarantula>(new SimpleAnnotatedMethod(method),
container);
- assert tarantulaModel.getBindingTypes().size() == 1;
- assert
tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
- }
-
- @Test @SpecAssertion(section="3.3")
- public void testFinalMethod() throws SecurityException, NoSuchMethodException
- {
- SimpleComponentModel<ComponentWithFinalProducerMethod> componentModel = new
SimpleComponentModel<ComponentWithFinalProducerMethod>(new
SimpleAnnotatedType<ComponentWithFinalProducerMethod>(ComponentWithFinalProducerMethod.class),
emptyAnnotatedItem, container);
- container.getModelManager().addComponentModel(componentModel);
- Method method =
ComponentWithFinalProducerMethod.class.getMethod("getString");
- boolean exception = false;
- try
- {
- new ProducerMethodComponentModel<String>(new
SimpleAnnotatedMethod(method), container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test @SpecAssertion(section="3.3")
- public void testFinalMethodWithDependentScope() throws SecurityException,
NoSuchMethodException
- {
- SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
- container.getModelManager().addComponentModel(componentModel);
- Method method = SpiderProducer.class.getMethod("produceTrapdoorSpider");
- ProducerMethodComponentModel<TrapdoorSpider> trapdoorSpiderModel = new
ProducerMethodComponentModel<TrapdoorSpider>(new SimpleAnnotatedMethod(method),
container);
- assert
trapdoorSpiderModel.getScopeType().annotationType().equals(Dependent.class);
- }
-
- @Test @SpecAssertion(section="3.3.6")
- public void testNamedMethod() throws SecurityException, NoSuchMethodException
- {
- SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
- container.getModelManager().addComponentModel(componentModel);
- Method method = SpiderProducer.class.getMethod("produceBlackWidow");
- ProducerMethodComponentModel<BlackWidow> blackWidowSpiderModel = new
ProducerMethodComponentModel<BlackWidow>(new SimpleAnnotatedMethod(method),
container);
- assert blackWidowSpiderModel.getName().equals("blackWidow");
- }
-
- @Test @SpecAssertion(section="3.3.6")
- public void testDefaultNamedMethod() throws SecurityException, NoSuchMethodException
- {
- SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
- container.getModelManager().addComponentModel(componentModel);
- Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
- ProducerMethodComponentModel<DaddyLongLegs> daddyLongLegsSpiderModel = new
ProducerMethodComponentModel<DaddyLongLegs>(new SimpleAnnotatedMethod(method),
container);
- assert
daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
- }
-
- @Test @SpecAssertion(section="3.3.6")
- public void testDefaultNamedJavaBeanMethod() throws SecurityException,
NoSuchMethodException
- {
- SimpleComponentModel<SpiderProducer> componentModel = new
SimpleComponentModel<SpiderProducer>(new
SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), emptyAnnotatedItem,
container);
- container.getModelManager().addComponentModel(componentModel);
- Method method = SpiderProducer.class.getMethod("getLadybirdSpider");
- ProducerMethodComponentModel<LadybirdSpider> ladybirdSpiderModel = new
ProducerMethodComponentModel<LadybirdSpider>(new SimpleAnnotatedMethod(method),
container);
- assert ladybirdSpiderModel.getName().equals("ladybirdSpider");
- }
-
-}
Copied:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentModelTest.java
(from rev 99,
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentTest.java)
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentModelTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentModelTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,64 @@
+package org.jboss.webbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+
+import javax.webbeans.Current;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.model.RemoteComponentModel;
+import org.jboss.webbeans.test.annotations.Tame;
+import org.jboss.webbeans.test.components.Animal;
+import org.jboss.webbeans.test.components.Baboon;
+import org.jboss.webbeans.test.components.TameApe;
+import org.jboss.webbeans.test.mock.MockContainerImpl;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class RemoteComponentModelTest
+{
+
+ private ContainerImpl container;
+ private AnnotatedType<?> emptyAnnotatedItem;
+
+ @BeforeMethod
+ public void before()
+ {
+ emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
+ container = new MockContainerImpl(null);
+ }
+
+ @Test @SpecAssertion(section="3.5")
+ public void testApiTypes() throws SecurityException, NoSuchMethodException
+ {
+ RemoteComponentModel<Baboon> baboonModel = new
RemoteComponentModel<Baboon>(new SimpleAnnotatedType<Baboon>(Baboon.class),
emptyAnnotatedItem, container);
+ assert baboonModel.getApiTypes().contains(Baboon.class);
+ assert baboonModel.getApiTypes().contains(Animal.class);
+ }
+
+ @Test @SpecAssertion(section="3.5.4")
+ public void testDefaultName() throws SecurityException, NoSuchMethodException
+ {
+ RemoteComponentModel<TameApe> tameApeModel = new
RemoteComponentModel<TameApe>(new SimpleAnnotatedType<TameApe>(TameApe.class),
emptyAnnotatedItem, container);
+ assert tameApeModel.getName().equals("tameApe");
+ }
+
+ @Test @SpecAssertion(section="3.5.1")
+ public void testDefaultBindingType() throws SecurityException, NoSuchMethodException
+ {
+ RemoteComponentModel<Baboon> baboonModel = new
RemoteComponentModel<Baboon>(new SimpleAnnotatedType<Baboon>(Baboon.class),
emptyAnnotatedItem, container);
+ assert baboonModel.getBindingTypes().size() == 1;
+ assert
baboonModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
+ }
+
+ @Test
+ public void testBindingType() throws SecurityException, NoSuchMethodException
+ {
+ RemoteComponentModel<TameApe> tameApeModel = new
RemoteComponentModel<TameApe>(new SimpleAnnotatedType<TameApe>(TameApe.class),
emptyAnnotatedItem, container);
+ assert tameApeModel.getBindingTypes().size() == 1;
+ assert
tameApeModel.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentModelTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -1,64 +0,0 @@
-package org.jboss.webbeans.test;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-
-import javax.webbeans.Current;
-
-import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.RemoteComponentModel;
-import org.jboss.webbeans.test.annotations.Tame;
-import org.jboss.webbeans.test.components.Animal;
-import org.jboss.webbeans.test.components.Baboon;
-import org.jboss.webbeans.test.components.TameApe;
-import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.junit.Before;
-import org.junit.Test;
-
-public class RemoteComponentTest
-{
-
- private ContainerImpl container;
- private AnnotatedType<?> emptyAnnotatedItem;
-
- @Before
- public void before()
- {
- emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
- container = new MockContainerImpl(null);
- }
-
- @Test @SpecAssertion(section="3.5")
- public void testApiTypes() throws SecurityException, NoSuchMethodException
- {
- RemoteComponentModel<Baboon> baboonModel = new
RemoteComponentModel<Baboon>(new SimpleAnnotatedType<Baboon>(Baboon.class),
emptyAnnotatedItem, container);
- assert baboonModel.getApiTypes().contains(Baboon.class);
- assert baboonModel.getApiTypes().contains(Animal.class);
- }
-
- @Test @SpecAssertion(section="3.5.4")
- public void testDefaultName() throws SecurityException, NoSuchMethodException
- {
- RemoteComponentModel<TameApe> tameApeModel = new
RemoteComponentModel<TameApe>(new SimpleAnnotatedType<TameApe>(TameApe.class),
emptyAnnotatedItem, container);
- assert tameApeModel.getName().equals("tameApe");
- }
-
- @Test @SpecAssertion(section="3.5.1")
- public void testDefaultBindingType() throws SecurityException, NoSuchMethodException
- {
- RemoteComponentModel<Baboon> baboonModel = new
RemoteComponentModel<Baboon>(new SimpleAnnotatedType<Baboon>(Baboon.class),
emptyAnnotatedItem, container);
- assert baboonModel.getBindingTypes().size() == 1;
- assert
baboonModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
- }
-
- @Test
- public void testBindingType() throws SecurityException, NoSuchMethodException
- {
- RemoteComponentModel<TameApe> tameApeModel = new
RemoteComponentModel<TameApe>(new SimpleAnnotatedType<TameApe>(TameApe.class),
emptyAnnotatedItem, container);
- assert tameApeModel.getBindingTypes().size() == 1;
- assert
tameApeModel.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
- }
-
-}
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentLifecycleTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentLifecycleTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentLifecycleTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.test;
+
+import org.testng.annotations.Test;
+
+public class SimpleComponentLifecycleTest
+{
+
+ @Test(groups="componentLifecycle") @SpecAssertion(section="3.1.3")
+ public void testInjectionOfParametersIntoComponentConstructor()
+ {
+ // TODO Placeholder
+ assert false;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentLifecycleTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -63,8 +63,8 @@
import org.jboss.webbeans.test.components.broken.OuterComponent.InnerComponent;
import org.jboss.webbeans.test.mock.MockContainerImpl;
import org.jboss.webbeans.util.Reflections;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
public class SimpleComponentModelTest
{
@@ -73,7 +73,7 @@
private AnnotatedType emptyAnnotatedItem;
- @Before
+ @BeforeMethod
public void before()
{
emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
@@ -578,4 +578,5 @@
}
}
+
}
Deleted:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java 2008-09-11
11:23:58 UTC (rev 103)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -1,152 +0,0 @@
-package org.jboss.webbeans.test;
-
-import java.util.Arrays;
-
-import javax.webbeans.Component;
-import javax.webbeans.Model;
-import javax.webbeans.Production;
-import javax.webbeans.RequestScoped;
-
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
-import org.jboss.webbeans.model.StereotypeModel;
-import org.jboss.webbeans.test.annotations.AnimalOrderStereotype;
-import org.jboss.webbeans.test.annotations.AnimalStereotype;
-import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
-import org.jboss.webbeans.test.annotations.broken.StereotypeWithBindingTypes;
-import org.jboss.webbeans.test.annotations.broken.StereotypeWithNonEmptyNamed;
-import org.jboss.webbeans.test.annotations.broken.StereotypeWithTooManyDeploymentTypes;
-import org.jboss.webbeans.test.annotations.broken.StereotypeWithTooManyScopeTypes;
-import org.jboss.webbeans.test.components.Animal;
-import org.jboss.webbeans.test.components.Order;
-import org.junit.Test;
-
-public class StereotypeMetaModelTest
-{
-
- @Test
- public void testComponentStereotype()
- {
- StereotypeModel componentStereotype = new StereotypeModel(new
SimpleAnnotatedType(Component.class));
-
- assert
Production.class.equals(componentStereotype.getDefaultDeploymentType().annotationType());
- assert componentStereotype.getDefaultScopeType() == null;
- assert componentStereotype.getInterceptorBindings().size() == 0;
- assert componentStereotype.getRequiredTypes().size() == 0;
- assert componentStereotype.getSupportedScopes().size() == 0;
- assert !componentStereotype.isComponentNameDefaulted();
- }
-
- @Test
- public void testModelStereotype()
- {
- StereotypeModel modelStereotype = new StereotypeModel(new
SimpleAnnotatedType(Model.class));
- assert
Production.class.equals(modelStereotype.getDefaultDeploymentType().annotationType());
- assert
RequestScoped.class.equals(modelStereotype.getDefaultScopeType().annotationType());
- assert modelStereotype.isComponentNameDefaulted();
- assert modelStereotype.getInterceptorBindings().size() == 0;
- assert modelStereotype.getRequiredTypes().size() == 0;
- assert modelStereotype.getSupportedScopes().size() == 0;
- }
-
- @Test
- public void testAnimalStereotype()
- {
- StereotypeModel animalStereotype = new StereotypeModel(new
SimpleAnnotatedType(AnimalStereotype.class));
- assert
animalStereotype.getDefaultScopeType().annotationType().equals(RequestScoped.class);
- assert animalStereotype.getInterceptorBindings().size() == 0;
- assert animalStereotype.getRequiredTypes().size() == 1;
- assert animalStereotype.getRequiredTypes().contains(Animal.class);
- assert animalStereotype.getSupportedScopes().size() == 0;
- assert !animalStereotype.isComponentNameDefaulted();
- assert animalStereotype.getDefaultDeploymentType() == null;
- }
-
- @Test
- public void testAnimalOrderStereotype()
- {
- StereotypeModel animalStereotype = new StereotypeModel(new
SimpleAnnotatedType(AnimalOrderStereotype.class));
- assert animalStereotype.getDefaultScopeType() == null;
- assert animalStereotype.getInterceptorBindings().size() == 0;
- assert animalStereotype.getRequiredTypes().size() == 2;
- Class<?> [] requiredTypes = {Animal.class, Order.class};
- assert
animalStereotype.getRequiredTypes().containsAll(Arrays.asList(requiredTypes));
- assert animalStereotype.getSupportedScopes().size() == 0;
- assert !animalStereotype.isComponentNameDefaulted();
- assert animalStereotype.getDefaultDeploymentType() == null;
- }
-
- @Test
- public void testRequestScopedAnimalStereotype()
- {
- StereotypeModel animalStereotype = new StereotypeModel(new
SimpleAnnotatedType(RequestScopedAnimalStereotype.class));
- assert animalStereotype.getDefaultScopeType() == null;
- assert animalStereotype.getInterceptorBindings().size() == 0;
- assert animalStereotype.getRequiredTypes().size() == 1;
- assert Animal.class.equals(animalStereotype.getRequiredTypes().iterator().next());
- assert animalStereotype.getSupportedScopes().size() == 1;
- assert animalStereotype.getSupportedScopes().contains(RequestScoped.class);
- assert !animalStereotype.isComponentNameDefaulted();
- assert animalStereotype.getDefaultDeploymentType() == null;
- }
-
- @Test
- public void testStereotypeWithTooManyScopeTypes()
- {
- boolean exception = false;
- try
- {
- new StereotypeModel(new
SimpleAnnotatedType(StereotypeWithTooManyScopeTypes.class));
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test
- public void testStereotypeWithTooManyDeploymentTypes()
- {
- boolean exception = false;
- try
- {
- new StereotypeModel(new
SimpleAnnotatedType(StereotypeWithTooManyDeploymentTypes.class));
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test
- public void testStereotypeWithNonEmptyNamed()
- {
- boolean exception = false;
- try
- {
- new StereotypeModel(new
SimpleAnnotatedType(StereotypeWithNonEmptyNamed.class));
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test
- public void testStereotypeWithBindingTypes()
- {
- boolean exception = false;
- try
- {
- new StereotypeModel(new SimpleAnnotatedType(StereotypeWithBindingTypes.class));
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
-}
Copied:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java (from
rev 95,
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java 2008-09-11
11:24:52 UTC (rev 104)
@@ -0,0 +1,152 @@
+package org.jboss.webbeans.test;
+
+import java.util.Arrays;
+
+import javax.webbeans.Component;
+import javax.webbeans.Model;
+import javax.webbeans.Production;
+import javax.webbeans.RequestScoped;
+
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.model.StereotypeModel;
+import org.jboss.webbeans.test.annotations.AnimalOrderStereotype;
+import org.jboss.webbeans.test.annotations.AnimalStereotype;
+import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
+import org.jboss.webbeans.test.annotations.broken.StereotypeWithBindingTypes;
+import org.jboss.webbeans.test.annotations.broken.StereotypeWithNonEmptyNamed;
+import org.jboss.webbeans.test.annotations.broken.StereotypeWithTooManyDeploymentTypes;
+import org.jboss.webbeans.test.annotations.broken.StereotypeWithTooManyScopeTypes;
+import org.jboss.webbeans.test.components.Animal;
+import org.jboss.webbeans.test.components.Order;
+import org.testng.annotations.Test;
+
+public class StereotypeModelTest
+{
+
+ @Test
+ public void testComponentStereotype()
+ {
+ StereotypeModel componentStereotype = new StereotypeModel(new
SimpleAnnotatedType(Component.class));
+
+ assert
Production.class.equals(componentStereotype.getDefaultDeploymentType().annotationType());
+ assert componentStereotype.getDefaultScopeType() == null;
+ assert componentStereotype.getInterceptorBindings().size() == 0;
+ assert componentStereotype.getRequiredTypes().size() == 0;
+ assert componentStereotype.getSupportedScopes().size() == 0;
+ assert !componentStereotype.isComponentNameDefaulted();
+ }
+
+ @Test
+ public void testModelStereotype()
+ {
+ StereotypeModel modelStereotype = new StereotypeModel(new
SimpleAnnotatedType(Model.class));
+ assert
Production.class.equals(modelStereotype.getDefaultDeploymentType().annotationType());
+ assert
RequestScoped.class.equals(modelStereotype.getDefaultScopeType().annotationType());
+ assert modelStereotype.isComponentNameDefaulted();
+ assert modelStereotype.getInterceptorBindings().size() == 0;
+ assert modelStereotype.getRequiredTypes().size() == 0;
+ assert modelStereotype.getSupportedScopes().size() == 0;
+ }
+
+ @Test
+ public void testAnimalStereotype()
+ {
+ StereotypeModel animalStereotype = new StereotypeModel(new
SimpleAnnotatedType(AnimalStereotype.class));
+ assert
animalStereotype.getDefaultScopeType().annotationType().equals(RequestScoped.class);
+ assert animalStereotype.getInterceptorBindings().size() == 0;
+ assert animalStereotype.getRequiredTypes().size() == 1;
+ assert animalStereotype.getRequiredTypes().contains(Animal.class);
+ assert animalStereotype.getSupportedScopes().size() == 0;
+ assert !animalStereotype.isComponentNameDefaulted();
+ assert animalStereotype.getDefaultDeploymentType() == null;
+ }
+
+ @Test
+ public void testAnimalOrderStereotype()
+ {
+ StereotypeModel animalStereotype = new StereotypeModel(new
SimpleAnnotatedType(AnimalOrderStereotype.class));
+ assert animalStereotype.getDefaultScopeType() == null;
+ assert animalStereotype.getInterceptorBindings().size() == 0;
+ assert animalStereotype.getRequiredTypes().size() == 2;
+ Class<?> [] requiredTypes = {Animal.class, Order.class};
+ assert
animalStereotype.getRequiredTypes().containsAll(Arrays.asList(requiredTypes));
+ assert animalStereotype.getSupportedScopes().size() == 0;
+ assert !animalStereotype.isComponentNameDefaulted();
+ assert animalStereotype.getDefaultDeploymentType() == null;
+ }
+
+ @Test
+ public void testRequestScopedAnimalStereotype()
+ {
+ StereotypeModel animalStereotype = new StereotypeModel(new
SimpleAnnotatedType(RequestScopedAnimalStereotype.class));
+ assert animalStereotype.getDefaultScopeType() == null;
+ assert animalStereotype.getInterceptorBindings().size() == 0;
+ assert animalStereotype.getRequiredTypes().size() == 1;
+ assert Animal.class.equals(animalStereotype.getRequiredTypes().iterator().next());
+ assert animalStereotype.getSupportedScopes().size() == 1;
+ assert animalStereotype.getSupportedScopes().contains(RequestScoped.class);
+ assert !animalStereotype.isComponentNameDefaulted();
+ assert animalStereotype.getDefaultDeploymentType() == null;
+ }
+
+ @Test
+ public void testStereotypeWithTooManyScopeTypes()
+ {
+ boolean exception = false;
+ try
+ {
+ new StereotypeModel(new
SimpleAnnotatedType(StereotypeWithTooManyScopeTypes.class));
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test
+ public void testStereotypeWithTooManyDeploymentTypes()
+ {
+ boolean exception = false;
+ try
+ {
+ new StereotypeModel(new
SimpleAnnotatedType(StereotypeWithTooManyDeploymentTypes.class));
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test
+ public void testStereotypeWithNonEmptyNamed()
+ {
+ boolean exception = false;
+ try
+ {
+ new StereotypeModel(new
SimpleAnnotatedType(StereotypeWithNonEmptyNamed.class));
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test
+ public void testStereotypeWithBindingTypes()
+ {
+ boolean exception = false;
+ try
+ {
+ new StereotypeModel(new SimpleAnnotatedType(StereotypeWithBindingTypes.class));
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/testng.xml
===================================================================
--- ri/trunk/webbeans-ri/testng.xml (rev 0)
+++ ri/trunk/webbeans-ri/testng.xml 2008-09-11 11:24:52 UTC (rev 104)
@@ -0,0 +1,71 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="WebBeans RI" verbose="1">
+
+ <test name="Reflection Support">
+ <classes>
+ <class name="org.jboss.webbeans.test.ClassAnnotatedItemTest" />
+ <class name="org.jboss.webbeans.test.ConstructorModelTest" />
+ </classes>
+ </test>
+
+ <test name="Deployment">
+ <groups>
+ <run>
+ <exclude name="specialization" />
+ <exclude name="componentLifecycle" />
+ </run>
+ </groups>
+ <classes>
+ <class name="org.jboss.webbeans.test.ComponentDeploymentTest"
/>
+ <class name="org.jboss.webbeans.test.DeploymentStrategyTest" />
+ </classes>
+ </test>
+
+ <test name="Component Model">
+ <classes>
+ <class name="org.jboss.webbeans.test.SimpleComponentModelTest"
/>
+ <class name="org.jboss.webbeans.test.EnterpriseComponentModelTest"
/>
+ <class
name="org.jboss.webbeans.test.ProducerExpressionComponentModelTest" />
+ <class
name="org.jboss.webbeans.test.ProducerMethodComponentModelTest" />
+ <class name="org.jboss.webbeans.test.RemoteComponentModelTest"
/>
+ <class name="org.jboss.webbeans.test.StereotypeModelTest" />
+ </classes>
+ </test>
+
+ <test name="Component Lifecycle">
+ <groups>
+ <run>
+ <exclude name="componentLifecycle" />
+ </run>
+ </groups>
+ <classes>
+ <class name="org.jboss.webbeans.test.SimpleComponentLifecycleTest"
/>
+ </classes>
+ </test>
+
+ <test name="Container">
+ <classes>
+ <class name="org.jboss.webbeans.test.ContainerTest" />
+ </classes>
+ </test>
+
+ <test name="EJB">
+ <classes>
+ <class name="org.jboss.webbeans.test.EjbMetaDataTest" />
+ </classes>
+ </test>
+
+ <test name="Event Bus">
+ <groups>
+ <run>
+ <exclude name="eventbus" />
+ </run>
+ </groups>
+ <classes>
+ <class name="org.jboss.webbeans.test.DeferredEventNotificationTest"
/>
+ <class name="org.jboss.webbeans.test.ObserverTest" />
+ </classes>
+ </test>
+
+</suite>
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/testng.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain