From: Alexandre Montplaisir Date: Fri, 31 Jul 2015 20:07:52 +0000 (-0400) Subject: Split the lttng-tools wrapper in a separate artifact X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=b01fe762dfbc92f8d908f1a295cde9997195df51;p=lttng-ust-java-tests.git Split the lttng-tools wrapper in a separate artifact This will better isolate dependencies of each component. In the future it could be moved to a separate git repository, but for now it's easier to have all the LTTng Java stuff in the same place. Signed-off-by: Alexandre Montplaisir --- diff --git a/.classpath b/.classpath deleted file mode 100644 index af1430b..0000000 --- a/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.project b/.project deleted file mode 100644 index a7601a3..0000000 --- a/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - lttng-ust-agent-tests - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 8dd9b1d..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/test/java=UTF-8 -encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 3ef0c30..0000000 --- a/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,392 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=warning -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning -org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=warning -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.8 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=120 -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=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=false -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true -org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index b883c15..0000000 --- a/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,62 +0,0 @@ -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_Spaces -formatter_settings_version=12 -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_functional_interfaces=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.insert_inferred_type_arguments=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=false -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_redundant_type_arguments=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_anonymous_class_creation=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_lambda=true -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true -sp_cleanup.use_type_arguments=false diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/lttng-tools-java/.classpath b/lttng-tools-java/.classpath new file mode 100644 index 0000000..af1430b --- /dev/null +++ b/lttng-tools-java/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lttng-tools-java/.project b/lttng-tools-java/.project new file mode 100644 index 0000000..7a7ec6b --- /dev/null +++ b/lttng-tools-java/.project @@ -0,0 +1,23 @@ + + + lttng-tools-java + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/lttng-tools-java/.settings/org.eclipse.core.resources.prefs b/lttng-tools-java/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..e9441bb --- /dev/null +++ b/lttng-tools-java/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding/=UTF-8 diff --git a/lttng-tools-java/.settings/org.eclipse.jdt.core.prefs b/lttng-tools-java/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3ef0c30 --- /dev/null +++ b/lttng-tools-java/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,392 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +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=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/lttng-tools-java/.settings/org.eclipse.jdt.ui.prefs b/lttng-tools-java/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..b883c15 --- /dev/null +++ b/lttng-tools-java/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spaces +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=false +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_type_arguments=false diff --git a/lttng-tools-java/.settings/org.eclipse.m2e.core.prefs b/lttng-tools-java/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/lttng-tools-java/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/lttng-tools-java/pom.xml b/lttng-tools-java/pom.xml new file mode 100644 index 0000000..8bbf7a8 --- /dev/null +++ b/lttng-tools-java/pom.xml @@ -0,0 +1,37 @@ + + + + + 4.0.0 + + + org.lttng.ust + lttng-ust-java-parent + 1.0.0 + + + org.lttng.tools + lttng-tools-java + jar + + LTTng-Tools Java Utilities + + diff --git a/lttng-tools-java/src/main/java/org/lttng/tools/ILttngSession.java b/lttng-tools-java/src/main/java/org/lttng/tools/ILttngSession.java new file mode 100644 index 0000000..e7d65a0 --- /dev/null +++ b/lttng-tools-java/src/main/java/org/lttng/tools/ILttngSession.java @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.tools; + +import java.util.List; + +/** + * Java representation of a LTTng tracing session. + * + * @author Alexandre Montplaisir + */ +public interface ILttngSession extends AutoCloseable { + + /** + * Tracing domains as they are defined by lttng-tools + */ + enum Domain { + /** The JUL (java.util.logging) domain */ + JUL("-j"), /** The log4j (org.apache.log4j) domain */ + LOG4J("-l"); + + private final String flag; + + private Domain(String flag) { + this.flag = flag; + } + + /** + * @return The corresponding command-line flag to pass to options like + * "lttng enable-event" + */ + public String flag() { + return flag; + } + } + + // ------------------------------------------------------------------------ + // Factory methods + // ------------------------------------------------------------------------ + + /** + * Create a new LTTng tracing session using the default backend. + * + * @param sessionName + * The name of the session to use. It can be null, in which case + * we will provide a unique random name. + * @param domain + * The tracing domain of this session + * @return The new session object + */ + static ILttngSession createSession(String sessionName, Domain domain) { + return createCommandLineSession(sessionName, domain); + } + + /** + * Create a new LTTng tracing session, which will use the command-line + * "lttng" utility. + * + * @param sessionName + * The name of the session to use. It can be null, in which case + * we will provide a unique random name. + * @param domain + * The tracing domain of this session + * @return The new session object + */ + static ILttngSession createCommandLineSession(String sessionName, Domain domain) { + return new LttngCommandLineSession(sessionName, domain); + } + + // ------------------------------------------------------------------------ + // AutoCloseable + // ------------------------------------------------------------------------ + + /** + * Should be used to destroy the LTTng session. + */ + @Override + void close(); + + // ------------------------------------------------------------------------ + // Session management + // ------------------------------------------------------------------------ + + /** + * Enable all events in the session (as with "enable-event -a"). + * + * @return If the command executed successfully (return code = 0). + */ + boolean enableAllEvents(); + + /** + * Enable individual event(s). + * + * @param enabledEvents + * The list of events to enable. Should not be null or empty + * @return If the command executed successfully (return code = 0). + */ + boolean enableEvents(String... enabledEvents); + + /** + * Send a disable-event command. Used to disable events that were previously + * enabled. + * + * @param disabledEvents + * The list of disabled events. Should not be null or empty + * @return If the command executed successfully (return code = 0). + */ + boolean disableEvents(String... disabledEvents); + + /** + * Start tracing + * + * @return If the command executed successfully (return code = 0). + */ + boolean start(); + + /** + * Stop the tracing session + * + * @return If the command executed successfully (return code = 0). + */ + boolean stop(); + + /** + * Issue a "lttng view" command on the session, and returns its output. This + * effectively returns the current content of the trace in text form. + * + * @return The output of Babeltrace on the session's current trace + */ + List view(); +} diff --git a/lttng-tools-java/src/main/java/org/lttng/tools/LttngCommandLineSession.java b/lttng-tools-java/src/main/java/org/lttng/tools/LttngCommandLineSession.java new file mode 100644 index 0000000..0cd26cc --- /dev/null +++ b/lttng-tools-java/src/main/java/org/lttng/tools/LttngCommandLineSession.java @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.tools; + +import static org.lttng.tools.utils.ShellUtils.executeCommand; + +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +import org.lttng.tools.utils.ShellUtils; + +/** + * Implementation of {@link ILttngSession} which uses the command-line "lttng" + * tool to manipulate the session. Creating an instance will run "lttng create", + * close()'ing it will run "lttng destroy". + * + * @author Alexandre Montplaisir + */ +class LttngCommandLineSession implements ILttngSession { + + private final String sessionName; + private final Domain domain; + + private volatile boolean channelCreated = false; + + /** + * Constructor to create a new LTTng tracing session. + * + * @param sessionName + * The name of the session to use. It can be null, in which case + * we will provide a unique random name. + * @param domain + * The tracing domain of this session + */ + public LttngCommandLineSession(String sessionName, Domain domain) { + if (sessionName != null) { + this.sessionName = sessionName; + } else { + this.sessionName = UUID.randomUUID().toString(); + } + this.domain = domain; + + /* Create the session in LTTng */ + executeCommand(Arrays.asList("lttng", "create", this.sessionName)); + } + + @Override + public void close() { + /* Destroy the session */ + executeCommand(Arrays.asList("lttng", "destroy", sessionName)); + // FIXME also delete the trace we generated ? + } + + @Override + public boolean enableAllEvents() { + channelCreated = true; + return executeCommand(Arrays.asList( + "lttng", "enable-event", domain.flag(), "-a", "-s", sessionName)); + } + + @Override + public boolean enableEvents(String... enabledEvents) { + if (enabledEvents == null || enabledEvents.length == 0) { + throw new IllegalArgumentException(); + } + channelCreated = true; + return executeCommand(Arrays.asList( + "lttng", "enable-event", domain.flag(), + Arrays.stream(enabledEvents).collect(Collectors.joining(",")), + "-s", sessionName)); + } + + @Override + public boolean disableEvents(String... disabledEvents) { + if (disabledEvents == null || disabledEvents.length == 0) { + throw new IllegalArgumentException(); + } + return executeCommand(Arrays.asList( + "lttng", "disable-event", domain.flag(), + Arrays.stream(disabledEvents).collect(Collectors.joining(",")), + "-s", sessionName)); + } + + @Override + public boolean start() { + /* + * We have to enable a channel for 'lttng start' to work. However, we + * cannot enable a channel directly, see + * https://bugs.lttng.org/issues/894 . Instead we will enable an event + * we know does not exist + */ + if (!channelCreated) { + enableEvents("non-event"); + } + return executeCommand(Arrays.asList("lttng", "start", sessionName)); + } + + @Override + public boolean stop() { + return executeCommand(Arrays.asList("lttng", "stop", sessionName)); + } + + @Override + public List view() { + return ShellUtils.getOutputFromCommand(true, Arrays.asList("lttng", "view", sessionName)); + } +} diff --git a/lttng-tools-java/src/main/java/org/lttng/tools/LttngToolsHelper.java b/lttng-tools-java/src/main/java/org/lttng/tools/LttngToolsHelper.java new file mode 100644 index 0000000..a38661e --- /dev/null +++ b/lttng-tools-java/src/main/java/org/lttng/tools/LttngToolsHelper.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.tools; + +import static org.lttng.tools.utils.ShellUtils.executeCommand; + +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.Arrays; + +/** + * Helper class to issue LTTng commands that do not affect a single session, and + * as such, do not fit into the scope of one {@link ILttngSession}. + * + * @author Alexandre Montplaisir + */ +public final class LttngToolsHelper { + + private LttngToolsHelper() {} + + /** + * Utility method to destroy all existing sessions. Useful when first + * setting up a test to make sure no existing session interferes. + * + * @return If the command completed successfully + */ + public static boolean destroyAllSessions() { + return executeCommand(Arrays.asList("lttng", "destroy", "-a")); + } + + /** + * Outside of the scope of lttng-tools, but this utility method can be used + * to delete all traces currently under ~/lttng-traces/. This can be used by + * tests to cleanup a trace they have created. + * + * @return True if the command completes successfully, false if there was an + * error. + */ + public static boolean deleteAllTraces() { + String tracesDir = new String(System.getProperty("user.home") + "/lttng-traces/"); + return deleteDirectory(Paths.get(tracesDir)); + } + + // ------------------------------------------------------------------------ + // Private helper methods + // ------------------------------------------------------------------------ + + private static boolean deleteDirectory(Path directory) { + try { + Files.walkFileTree(directory, new SimpleFileVisitor() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Files.delete(file); + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + Files.delete(dir); + return FileVisitResult.CONTINUE; + } + }); + } catch (IOException e) { + /* At least we tried... */ + return false; + } + return true; + } +} diff --git a/lttng-tools-java/src/main/java/org/lttng/tools/utils/ShellUtils.java b/lttng-tools-java/src/main/java/org/lttng/tools/utils/ShellUtils.java new file mode 100644 index 0000000..eb94c20 --- /dev/null +++ b/lttng-tools-java/src/main/java/org/lttng/tools/utils/ShellUtils.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.tools.utils; + +import java.io.IOException; +import java.lang.ProcessBuilder.Redirect; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.List; +import java.util.StringJoiner; + +/** + * Utility methods to execute commands on the command line. + * + * @author Alexandre Montplaisir + */ +public final class ShellUtils { + + private ShellUtils() {} + + /** + * Simple command to test that the environment / stdout are working + * correctly. + * + * @param args + * Command-line arguments + */ + public static void main(String[] args) { + List command = Arrays.asList("ls", "-l"); + executeCommand(command); + } + + /** + * Execute a shell command and retrieve its return value. + * + * @param command + * The command to execute, as a list of individual arguments (do + * not use spaces) + * @return If the command returned successfully (ret code = 0) + */ + public static boolean executeCommand(List command) { + try { + /* "echo" the command to stdout */ + StringJoiner sj = new StringJoiner(" ", "$ ", ""); + command.stream().forEach(sj::add); + System.out.println(sj.toString()); + + ProcessBuilder builder = new ProcessBuilder(command); + builder.redirectErrorStream(true); + builder.redirectOutput(Redirect.INHERIT); + + Process p = builder.start(); + int ret = p.waitFor(); + + System.out.println("(returned from command)"); + + return (ret == 0); + + } catch (IOException | InterruptedException e) { + return false; + } + } + + /** + * Execute a shell command and retrieve its output. + * + * @param print + * Should the output also be printed to stdout as usual + * @param command + * The command to execute, as a list of individual arguments (do + * not use spaces) + * @return The output of the command, as one list element per line + */ + public static List getOutputFromCommand(boolean print, List command) { + try { + /* "echo" the command to stdout */ + StringJoiner sj = new StringJoiner(" ", "$ ", ""); + command.stream().forEach(sj::add); + System.out.println(sj.toString()); + + Path tempFile = Files.createTempFile("test-output", null); + + ProcessBuilder builder = new ProcessBuilder(command); + builder.redirectErrorStream(true); + builder.redirectOutput(Redirect.to(tempFile.toFile())); + + Process p = builder.start(); + p.waitFor(); + + List lines = Files.readAllLines(tempFile); + Files.delete(tempFile); + + if (print) { + /* Also print the output to the console */ + lines.stream().forEach(System.out::println); + } else { + System.out.println("(output silenced)"); + } + + System.out.println("(returned from command)"); + return lines; + + } catch (IOException | InterruptedException e) { + return null; + } + } +} diff --git a/lttng-ust-java-tests/.classpath b/lttng-ust-java-tests/.classpath new file mode 100644 index 0000000..af1430b --- /dev/null +++ b/lttng-ust-java-tests/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lttng-ust-java-tests/.project b/lttng-ust-java-tests/.project new file mode 100644 index 0000000..a7601a3 --- /dev/null +++ b/lttng-ust-java-tests/.project @@ -0,0 +1,23 @@ + + + lttng-ust-agent-tests + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/lttng-ust-java-tests/.settings/org.eclipse.core.resources.prefs b/lttng-ust-java-tests/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..8dd9b1d --- /dev/null +++ b/lttng-ust-java-tests/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/lttng-ust-java-tests/.settings/org.eclipse.jdt.core.prefs b/lttng-ust-java-tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3ef0c30 --- /dev/null +++ b/lttng-ust-java-tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,392 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +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=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/lttng-ust-java-tests/.settings/org.eclipse.jdt.ui.prefs b/lttng-ust-java-tests/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..b883c15 --- /dev/null +++ b/lttng-ust-java-tests/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spaces +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=false +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_type_arguments=false diff --git a/lttng-ust-java-tests/.settings/org.eclipse.m2e.core.prefs b/lttng-ust-java-tests/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/lttng-ust-java-tests/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/lttng-ust-java-tests/pom.xml b/lttng-ust-java-tests/pom.xml new file mode 100644 index 0000000..f706c56 --- /dev/null +++ b/lttng-ust-java-tests/pom.xml @@ -0,0 +1,109 @@ + + + + + 4.0.0 + + + org.lttng.ust + lttng-ust-java-parent + 1.0.0 + + + lttng-ust-java-tests + jar + + LTTng-UST Java Agent Integration Tests + + + UTF-8 + + /usr/local/share/java/lttng-ust-agent-common-1.0.0.jar + /usr/local/share/java/lttng-ust-agent-jul-1.0.0.jar + /usr/local/share/java/lttng-ust-agent-log4j-1.0.0.jar + -Djava.library.path=/usr/local/lib + + + + + + org.lttng.ust.agent + lttng-ust-agent-common + 1.0.0 + system + ${common-jar-location} + + + org.lttng.ust.agent + lttng-ust-agent-jul + 1.0.0 + system + ${jul-jar-location} + + + org.lttng.ust.agent + lttng-ust-agent-log4j + 1.0.0 + system + ${log4j-jar-location} + + + + + org.lttng.tools + lttng-tools-java + 1.0.0 + + + log4j + log4j + 1.2.17 + + + junit + junit + 4.12 + test + + + + + + benchmark + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.18.1 + + + **/*Benchmark.java + + + + + + + + + diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/JulHandlerBenchmarkBase.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/JulHandlerBenchmarkBase.java new file mode 100644 index 0000000..9ac3df5 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/JulHandlerBenchmarkBase.java @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.benchmarks.jul.handler; + +import java.util.LinkedList; +import java.util.List; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Base abstract class for JUL benchmarks. Sub-classes can setup parameters to + * test different types of log handlers. + */ +public abstract class JulHandlerBenchmarkBase { + + // ------------------------------------------------------------------------ + // Configurable test parameters + // ------------------------------------------------------------------------ + + /** Nb of runs per test, result will be averaged */ + private static final int NB_RUNS = 10; + + /** Trace/log events per run */ + private static final int NB_ITER = 100000; + + /** Which tests to run (for different number of threads) */ + private static final int[] NB_THREADS = {1, 1, 2, 3, 4, 5, 6, 7, 8}; + + // ------------------------------------------------------------------------ + // Attributes + // ------------------------------------------------------------------------ + + protected Logger logger; + protected Handler handler; + + // ------------------------------------------------------------------------ + // Maintenance methods + // ------------------------------------------------------------------------ + + /** + * Base test setup + */ + @Before + public void setup() { + /* Set up the logger */ + logger = Logger.getLogger("Test logger"); + logger.setUseParentHandlers(false); + logger.setLevel(Level.ALL); + + /* Sub-classes' @Before will setup the Handler */ + } + + /** + * Base test teardown + */ + @After + public void teardown() { + if (handler != null) { + logger.removeHandler(handler); + handler.close(); + } + handler = null; + logger = null; + } + + // ------------------------------------------------------------------------ + // Test methods + // ------------------------------------------------------------------------ + + /** + * Main test class for running the benchmark + */ + @Test + public void runBenchmark() { + if (handler != null) { + logger.addHandler(handler); + } + + System.out.println(); + System.out.println("Running benchmark: " + this.getClass().getCanonicalName()); + for (int i : NB_THREADS) { + runTest(logger, i); + } + } + + private static void runTest(Logger log, int nbThreads) { + long start, end, average, total = 0; + for (int i = 0; i < NB_RUNS; i++) { + Runner runner = new Runner(nbThreads, NB_ITER, log); + + start = System.nanoTime(); + runner.run(); + end = System.nanoTime(); + + total += (end - start); + } + average = total / NB_RUNS; + System.out.println(nbThreads + " threads, average = " + average / NB_ITER + " ns/event"); + } + + // ------------------------------------------------------------------------ + // Helper classes + // ------------------------------------------------------------------------ + + private static class Runner implements Runnable { + + private final List workers = new LinkedList<>(); + private final List workerThreads = new LinkedList<>(); + + public Runner(int nbThreads, int nbIter, Logger log) { + + for (int id = 0; id < nbThreads; id++) { + Worker curWorker = new Worker(id, nbIter, log); + workers.add(curWorker); + workerThreads.add(new Thread(curWorker, "worker " + id)); + } + } + + @Override + public void run() { + for (Thread curThread : workerThreads) { + curThread.start(); + } + + for (Thread curThread : workerThreads) { + try { + curThread.join(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + private static class Worker implements Runnable { + + private final Logger log; + private final int threadId; + private final int nbIter; + + public Worker(int threadId, int nbIter, Logger log) { + this.log = log; + this.threadId = threadId; + this.nbIter = nbIter; + } + + @Override + public void run() { + for (int i = 0; i < nbIter; i++) { + log.info("Thread " + threadId + ", iteration " + i); + } + } + + } + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/DummyHandlerBenchmark.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/DummyHandlerBenchmark.java new file mode 100644 index 0000000..44a5290 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/DummyHandlerBenchmark.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.benchmarks.jul.handler.builtin; + +import java.util.logging.Handler; +import java.util.logging.LogRecord; + +import org.junit.Before; +import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; + +/** + * Test suite of using a "dummy" handler, which means a handler that does + * exactly nothing. + */ +public class DummyHandlerBenchmark extends JulHandlerBenchmarkBase { + + /** + * Test setup + */ + @Before + public void testSetup() { + handler = new DummyHandler(); + } + + private static class DummyHandler extends Handler { + + public DummyHandler() { + super(); + } + + @Override + public void close() throws SecurityException {} + + @Override + public void flush() {} + + @Override + public void publish(LogRecord record) {} + + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/FileHandlerBenchmark.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/FileHandlerBenchmark.java new file mode 100644 index 0000000..af4ab7c --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/FileHandlerBenchmark.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.benchmarks.jul.handler.builtin; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.logging.FileHandler; +import java.util.logging.SimpleFormatter; + +import org.junit.After; +import org.junit.Before; +import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; + +/** + * Test class using a {@link FileHandler}, which a {@link SimpleFormatter}. + */ +public class FileHandlerBenchmark extends JulHandlerBenchmarkBase { + + private Path outputFile; + + /** + * Test setup + * + * @throws SecurityException + * If there is problem setting up the handler + * @throws IOException + * If there is problem setting up the handler + */ + @Before + public void testSetup() throws SecurityException, IOException { + outputFile = Files.createTempFile(this.getClass().getSimpleName(), null); + + handler = new FileHandler(outputFile.toString(), false); + handler.setFormatter(new SimpleFormatter()); + } + + /** + * Test cleanup + * + * @throws IOException + * If we could not delete the test file + */ + @After + public void testTeardown() throws IOException { + Files.deleteIfExists(outputFile); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/NoHandlerBenchmark.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/NoHandlerBenchmark.java new file mode 100644 index 0000000..09457d2 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/NoHandlerBenchmark.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.benchmarks.jul.handler.builtin; + +import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; + +/** + * Benchmark that will attach no {@link java.util.logging.Handler} to the + * {@link java.util.logging.Logger} object. + */ +public class NoHandlerBenchmark extends JulHandlerBenchmarkBase { + + /* Do not setup any handler */ +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingDisabledBenchmark.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingDisabledBenchmark.java new file mode 100644 index 0000000..d0e514c --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingDisabledBenchmark.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.benchmarks.jul.handler.lttng; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; + +import org.junit.After; +import org.junit.Before; +import org.lttng.tools.ILttngSession; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; +import org.lttng.ust.agent.jul.LttngLogHandler; + +/** + * Benchmark the LTTng-JUL handler, but with tracing disabled in the tracing + * session. + */ +public class LttngJulHandlerTracingDisabledBenchmark extends JulHandlerBenchmarkBase { + + private ILttngSession session; + + /** + * Test setup + * + * @throws IOException + */ + @Before + public void testSetup() throws IOException { + handler = new LttngLogHandler(); + + session = ILttngSession.createSession(null, Domain.JUL); + assertTrue(session.enableEvents("non-event")); + assertTrue(session.start()); + } + + /** + * Test cleanup + */ + @After + public void testTeardown() { + assertTrue(session.stop()); + session.close(); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingEnabledBenchmark.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingEnabledBenchmark.java new file mode 100644 index 0000000..c594de4 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingEnabledBenchmark.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.benchmarks.jul.handler.lttng; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; + +import org.junit.After; +import org.junit.Before; +import org.lttng.tools.ILttngSession; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; +import org.lttng.ust.agent.jul.LttngLogHandler; + +/** + * Test the LTTng-JUL handler, with it actually sending events to the tracer. + */ +public class LttngJulHandlerTracingEnabledBenchmark extends JulHandlerBenchmarkBase { + + private ILttngSession session; + + /** + * Test setup + * + * @throws IOException + */ + @Before + public void testSetup() throws IOException { + handler = new LttngLogHandler(); + + session = ILttngSession.createSession(null, Domain.JUL); + assertTrue(session.enableAllEvents()); + assertTrue(session.start()); + } + + /** + * Test cleanup + */ + @After + public void testTeardown() { + assertTrue(session.stop()); + session.close(); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingDisabledBenchmark.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingDisabledBenchmark.java new file mode 100644 index 0000000..112b0f0 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingDisabledBenchmark.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.benchmarks.jul.handler.lttng.old; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Before; +import org.lttng.tools.ILttngSession; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.LTTngAgent; +import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; + +/** + * Benchmark for the LTTng-UST handler, using the legacy API. Tracing is + * disabled in the tracing session. + */ +@SuppressWarnings("deprecation") +public class OldLttngJulHandlerTracingDisabledBenchmark extends JulHandlerBenchmarkBase { + + private ILttngSession session; + + /** + * Test setup + */ + @Before + public void testSetup() { + LTTngAgent.getLTTngAgent(); + + session = ILttngSession.createSession(null, Domain.JUL); + assertTrue(session.enableEvents("non-event")); + assertTrue(session.start()); + } + + /** + * Test cleanup + */ + @After + public void testTeardown() { + assertTrue(session.stop()); + session.close(); + + LTTngAgent.dispose(); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java new file mode 100644 index 0000000..a36578b --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.benchmarks.jul.handler.lttng.old; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.lang.reflect.Field; + +import org.junit.After; +import org.junit.Before; +import org.lttng.tools.ILttngSession; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.LTTngAgent; +import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; +import org.lttng.ust.agent.jul.LttngLogHandler; + +/** + * Benchmark for the LTTng-UST handler, using the legacy API. Tracing is + * enabled in the tracing session. + */ +@SuppressWarnings("deprecation") +public class OldLttngJulHandlerTracingEnabledBenchmark extends JulHandlerBenchmarkBase { + + private ILttngSession session; + private LttngLogHandler agentHandler; + + + /** + * Test setup + */ + @Before + public void testSetup() { + LTTngAgent agentInstance = LTTngAgent.getLTTngAgent(); + + /* + * The "old API" works by attaching a handler managed by the agent to + * the root JUL logger. This causes problems here, because we use + * logger.setUserParentHandler(false), which does not trigger the + * handler as would be expected. + * + * Instead we will retrieve this handler through reflection, and attach + * it to our own logger here for the duration of the test. + */ + try { + Field julHandlerField = LTTngAgent.class.getDeclaredField("julHandler"); + julHandlerField.setAccessible(true); + agentHandler = (LttngLogHandler) julHandlerField.get(agentInstance); + + logger.addHandler(agentHandler); + + } catch (ReflectiveOperationException e) { + fail(); + } + + session = ILttngSession.createSession(null, Domain.JUL); + assertTrue(session.enableAllEvents()); + assertTrue(session.start()); + } + + /** + * Test cleanup + */ + @After + public void testTeardown() { + assertTrue(session.stop()); + session.close(); + + logger.removeHandler(agentHandler); + LTTngAgent.dispose(); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/EnabledEventsTestBase.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/EnabledEventsTestBase.java new file mode 100644 index 0000000..fd72279 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/EnabledEventsTestBase.java @@ -0,0 +1,264 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.lttng.tools.ILttngSession; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.ILttngHandler; +import org.lttng.ust.agent.utils.TestPrintRunner; + +/** + * Base abstract class to implement all sorts of integration tests verifying the + * presence of enabled events in resulting traces. + */ +@RunWith(TestPrintRunner.class) +public abstract class EnabledEventsTestBase { + + protected static final String EVENT_NAME_A = "EventA"; + protected static final String EVENT_NAME_B = "EventAB"; + protected static final String EVENT_NAME_C = "EventABC"; + protected static final String EVENT_NAME_D = "EventABCD"; + + private ILttngSession session; + + /* Fields defined by the sub-class */ + protected ILttngHandler handlerA; + protected ILttngHandler handlerB; + protected ILttngHandler handlerC; + + protected abstract Domain getDomain(); + + protected abstract void sendEventsToLoggers(); + + /** + * Base test setup + */ + @Before + public void testSetup() { + session = ILttngSession.createSession(null, getDomain()); + } + + /** + * Base test teardown + */ + @After + public void testTeardown() { + session.close(); + + handlerA.close(); + handlerB.close(); + handlerC.close(); + + handlerA = null; + handlerB = null; + handlerC = null; + } + + /** + * Test sending events on the Java side, but no events enabled in the + * tracing session. There should be nothing in the resulting trace, and + * handlers should not have logged anything. + */ + @Test + public void testNoEvents() { + assertTrue(session.start()); + + sendEventsToLoggers(); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertTrue(output.isEmpty()); + + assertEquals(0, handlerA.getEventCount()); + assertEquals(0, handlerB.getEventCount()); + assertEquals(0, handlerC.getEventCount()); + } + + /** + * Test sending events on the Java side, and all events enabled in the + * tracing session. All handlers should have sent their events. + */ + @Test + public void testAllEvents() { + assertTrue(session.enableAllEvents()); + assertTrue(session.start()); + + sendEventsToLoggers(); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(30, output.size()); // loggerD has no handler attached + + assertEquals(10, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + } + + /** + * Test sending events on the Java side, with only some of them enabled in + * the tracing session. Only the subset that is enabled should be received. + */ + @Test + public void testSomeEvents() { + assertTrue(session.enableEvents(EVENT_NAME_A, EVENT_NAME_C, EVENT_NAME_D)); + assertTrue(session.start()); + + sendEventsToLoggers(); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(20, output.size()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(0, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + } + + /** + * Test with all events enabled (-a), plus some other events added manually. + * Events should still be retained, but there should be no duplicates. + */ + @Test + public void testAllEventsAndSome() { + assertTrue(session.enableAllEvents()); + assertTrue(session.enableEvents(EVENT_NAME_A, EVENT_NAME_B)); + assertTrue(session.start()); + + sendEventsToLoggers(); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(30, output.size()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + } + + /** + * Same as {@link #testSomeEvents()}, but some events were enabled first, + * then disabled. Makes sure the enabled-event refcounting works properly. + */ + @Test + public void testSomeEventsAfterDisabling() { + assertTrue(session.enableEvents(EVENT_NAME_A, EVENT_NAME_C, EVENT_NAME_D)); + assertTrue(session.disableEvents(EVENT_NAME_C)); + assertTrue(session.start()); + + sendEventsToLoggers(); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(10, output.size()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(0, handlerB.getEventCount()); + assertEquals(0, handlerC.getEventCount()); + } + + /** + * Test enabling an event prefix, which means an event name ending with a *, + * to match all events starting with this name. + */ + @Test + public void testEventPrefix() { + // should match event/loggers B and C, but not A. + assertTrue(session.enableEvents("EventAB*")); + assertTrue(session.start()); + + sendEventsToLoggers(); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(20, output.size()); + + assertEquals(0, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + } + + /** + * Same as {@link #testEventPrefix()}, but with multiple prefixes that + * overlap. There should not be any duplicate events in the trace or in the + * handlers. + */ + @Test + public void testEventPrefixOverlapping() { + // should still match B and C + assertTrue(session.enableEvents("EventAB*", "EventABC*")); + assertTrue(session.start()); + + sendEventsToLoggers(); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(20, output.size()); + + assertEquals(0, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + } + + /** + * Test with all events enabled (-a), plus an event prefix. Once again, + * there should be no duplicates. + */ + @Test + public void testAllEventsAndPrefix() { + assertTrue(session.enableAllEvents()); + assertTrue(session.enableEvents("EventAB*")); + assertTrue(session.start()); + + sendEventsToLoggers(); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(30, output.size()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/MultiSessionTestBase.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/MultiSessionTestBase.java new file mode 100644 index 0000000..1efa3a6 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/MultiSessionTestBase.java @@ -0,0 +1,363 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.lttng.tools.ILttngSession; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.ust.agent.ILttngHandler; +import org.lttng.ust.agent.utils.TestPrintRunner; + +/** + * Base abstract class for tests with multiple concurrent tracing sessions + */ +@RunWith(TestPrintRunner.class) +public abstract class MultiSessionTestBase { + + protected static final String EVENT_NAME_A = "EventA"; + protected static final String EVENT_NAME_B = "EventAB"; + protected static final String EVENT_NAME_C = "EventABC"; + protected static final String EVENT_NAME_D = "EventABCD"; + + private ILttngSession session1; + private ILttngSession session2; + private ILttngSession session3; + + /* Fields defined by the sub-class */ + protected ILttngHandler handlerA; + protected ILttngHandler handlerB; + protected ILttngHandler handlerC; + protected ILttngHandler handlerD; + + protected abstract Domain getDomain(); + + protected abstract void sendEventsToLoggers(); + + /** + * Base test setup + */ + @Before + public void testSetup() { + session1 = ILttngSession.createSession(null, getDomain()); + session2 = ILttngSession.createSession(null, getDomain()); + session3 = ILttngSession.createSession(null, getDomain()); + } + + /** + * Base test teardown + */ + @After + public void testTeardown() { + session1.close(); + session2.close(); + session3.close(); + + handlerA.close(); + handlerB.close(); + handlerC.close(); + handlerD.close(); + + handlerA = null; + handlerB = null; + handlerC = null; + handlerD = null; + } + + /** + * Test with no events in any session. + */ + @Test + public void testNoEvents() { + assertTrue(session1.start()); + assertTrue(session2.start()); + assertTrue(session3.start()); + + sendEventsToLoggers(); + + assertTrue(session1.stop()); + assertTrue(session2.stop()); + assertTrue(session3.stop()); + + List output1 = session1.view(); + List output2 = session2.view(); + List output3 = session3.view(); + assertNotNull(output1); + assertNotNull(output2); + assertNotNull(output3); + assertTrue(output1.isEmpty()); + assertTrue(output2.isEmpty()); + assertTrue(output3.isEmpty()); + + assertEquals(0, handlerA.getEventCount()); + assertEquals(0, handlerB.getEventCount()); + assertEquals(0, handlerC.getEventCount()); + assertEquals(0, handlerD.getEventCount()); + } + + /** + * Test with all events enabled in one session only. Everything should be + * sent through JNI, but only that session should keep the trace events. + */ + @Test + public void testAllEventsOneSession() { + assertTrue(session1.enableAllEvents()); + assertTrue(session1.start()); + assertTrue(session2.start()); + assertTrue(session3.start()); + + sendEventsToLoggers(); + + assertTrue(session1.stop()); + assertTrue(session2.stop()); + assertTrue(session3.stop()); + + List output1 = session1.view(); + List output2 = session2.view(); + List output3 = session3.view(); + assertNotNull(output1); + assertNotNull(output2); + assertNotNull(output3); + assertEquals(40, output1.size()); + assertTrue(output2.isEmpty()); + assertTrue(output3.isEmpty()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + assertEquals(10, handlerD.getEventCount()); + } + + /** + * Test with all events enabled in all sessions. All traces and handlers + * should see every event that was logged. + */ + @Test + public void testAllEventsAllSessions() { + assertTrue(session1.enableAllEvents()); + assertTrue(session2.enableAllEvents()); + assertTrue(session3.enableAllEvents()); + assertTrue(session1.start()); + assertTrue(session2.start()); + assertTrue(session3.start()); + + sendEventsToLoggers(); + + assertTrue(session1.stop()); + assertTrue(session2.stop()); + assertTrue(session3.stop()); + + List output1 = session1.view(); + List output2 = session2.view(); + List output3 = session3.view(); + assertNotNull(output1); + assertNotNull(output2); + assertNotNull(output3); + assertEquals(40, output1.size()); + assertEquals(40, output2.size()); + assertEquals(40, output3.size()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + assertEquals(10, handlerD.getEventCount()); + } + + /** + * Test enabling some events in some sessions only. + */ + @Test + public void testSomeEvents() { + assertTrue(session1.enableEvents(EVENT_NAME_A)); + assertTrue(session2.enableEvents(EVENT_NAME_B)); + assertTrue(session1.start()); + assertTrue(session2.start()); + assertTrue(session3.start()); + + sendEventsToLoggers(); + + assertTrue(session1.stop()); + assertTrue(session2.stop()); + assertTrue(session3.stop()); + + List output1 = session1.view(); + List output2 = session2.view(); + List output3 = session3.view(); + assertNotNull(output1); + assertNotNull(output2); + assertNotNull(output3); + assertEquals(10, output1.size()); + assertEquals(10, output2.size()); + assertEquals(0, output3.size()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(0, handlerC.getEventCount()); + assertEquals(0, handlerD.getEventCount()); + } + + /** + * Test with all events enabled in one session, and some others in another. + * All events should arrive where expected, with no duplicates. + */ + @Test + public void testAllEventsAndSome() { + assertTrue(session1.enableAllEvents()); + assertTrue(session2.enableEvents(EVENT_NAME_D)); + assertTrue(session1.start()); + assertTrue(session2.start()); + assertTrue(session3.start()); + + sendEventsToLoggers(); + + assertTrue(session1.stop()); + assertTrue(session2.stop()); + assertTrue(session3.stop()); + + List output1 = session1.view(); + List output2 = session2.view(); + List output3 = session3.view(); + assertNotNull(output1); + assertNotNull(output2); + assertNotNull(output3); + assertEquals(40, output1.size()); + assertEquals(10, output2.size()); + assertEquals(0, output3.size()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + assertEquals(10, handlerD.getEventCount()); + } + + /** + * Test with enabling then disabling some events. Makes sure the refcounting + * works properly. + */ + @Test + public void testSomeEventsAfterDisabling() { + assertTrue(session1.enableEvents(EVENT_NAME_A, EVENT_NAME_B, EVENT_NAME_C)); + assertTrue(session2.enableEvents(EVENT_NAME_B, EVENT_NAME_C, EVENT_NAME_D)); + assertTrue(session3.enableEvents(EVENT_NAME_A)); + + assertTrue(session1.disableEvents(EVENT_NAME_C)); + assertTrue(session2.disableEvents(EVENT_NAME_B, EVENT_NAME_C)); + assertTrue(session3.disableEvents(EVENT_NAME_A)); + + assertTrue(session1.start()); + assertTrue(session2.start()); + assertTrue(session3.start()); + + sendEventsToLoggers(); + + assertTrue(session1.stop()); + assertTrue(session2.stop()); + assertTrue(session3.stop()); + + List output1 = session1.view(); + List output2 = session2.view(); + List output3 = session3.view(); + assertNotNull(output1); + assertNotNull(output2); + assertNotNull(output3); + assertEquals(20, output1.size()); + assertEquals(10, output2.size()); + assertEquals(0, output3.size()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(0, handlerC.getEventCount()); + assertEquals(10, handlerD.getEventCount()); + } + + /** + * Test with a prefix in one session and a standard event in another. + */ + @Test + public void testPrefixAndEvent() { + assertTrue(session1.enableEvents("EventAB*")); + assertTrue(session3.enableEvents(EVENT_NAME_A)); + assertTrue(session1.start()); + assertTrue(session2.start()); + assertTrue(session3.start()); + + sendEventsToLoggers(); + + assertTrue(session1.stop()); + assertTrue(session2.stop()); + assertTrue(session3.stop()); + + List output1 = session1.view(); + List output2 = session2.view(); + List output3 = session3.view(); + assertNotNull(output1); + assertNotNull(output2); + assertNotNull(output3); + assertEquals(30, output1.size()); + assertEquals(0, output2.size()); + assertEquals(10, output3.size()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + assertEquals(10, handlerD.getEventCount()); + } + + /** + * Test with all events enabled in one session, and an event prefix in + * another. Once again, there should be no duplicates. + */ + @Test + public void testAllEventsAndPrefix() { + assertTrue(session1.enableAllEvents()); + assertTrue(session2.enableEvents("EventABC*")); + assertTrue(session1.start()); + assertTrue(session2.start()); + assertTrue(session3.start()); + + sendEventsToLoggers(); + + assertTrue(session1.stop()); + assertTrue(session2.stop()); + assertTrue(session3.stop()); + + List output1 = session1.view(); + List output2 = session2.view(); + List output3 = session3.view(); + assertNotNull(output1); + assertNotNull(output2); + assertNotNull(output3); + assertEquals(40, output1.size()); + assertEquals(20, output2.size()); + assertEquals(0, output3.size()); + + assertEquals(10, handlerA.getEventCount()); + assertEquals(10, handlerB.getEventCount()); + assertEquals(10, handlerC.getEventCount()); + assertEquals(10, handlerD.getEventCount()); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulEnabledEventsTest.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulEnabledEventsTest.java new file mode 100644 index 0000000..1e9a07f --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulEnabledEventsTest.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.jul; + +import static org.junit.Assume.assumeTrue; + +import java.io.IOException; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.tools.LttngToolsHelper; +import org.lttng.ust.agent.integration.EnabledEventsTestBase; +import org.lttng.ust.agent.jul.LttngLogHandler; +import org.lttng.ust.agent.utils.LttngUtils; + +/** + * Enabled events test for the LTTng-UST JUL log handler. + */ +public class JulEnabledEventsTest extends EnabledEventsTestBase { + + private static final Domain DOMAIN = Domain.JUL; + + private Logger loggerA; + private Logger loggerB; + private Logger loggerC; + private Logger loggerD; + + /** + * Class setup + */ + @BeforeClass + public static void julClassSetup() { + /* Skip tests if we can't find the JNI library or lttng-tools */ + assumeTrue(LttngUtils.checkForJulLibrary()); + assumeTrue(LttngUtils.checkForLttngTools(Domain.JUL)); + + LttngToolsHelper.destroyAllSessions(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void julClassCleanup() { + LttngToolsHelper.deleteAllTraces(); + } + + /** + * Test setup + * + * @throws SecurityException + * @throws IOException + */ + @Before + public void julSetup() throws SecurityException, IOException { + loggerA = Logger.getLogger(EVENT_NAME_A); + loggerB = Logger.getLogger(EVENT_NAME_B); + loggerC = Logger.getLogger(EVENT_NAME_C); + loggerD = Logger.getLogger(EVENT_NAME_D); + + loggerA.setLevel(Level.ALL); + loggerB.setLevel(Level.ALL); + loggerC.setLevel(Level.ALL); + loggerD.setLevel(Level.ALL); + + handlerA = new LttngLogHandler(); + handlerB = new LttngLogHandler(); + handlerC = new LttngLogHandler(); + + loggerA.addHandler((Handler) handlerA); + loggerB.addHandler((Handler) handlerB); + loggerC.addHandler((Handler) handlerC); + } + + /** + * Test teardown + */ + @After + public void julTeardown() { + loggerA.removeHandler((Handler) handlerA); + loggerB.removeHandler((Handler) handlerB); + loggerC.removeHandler((Handler) handlerC); + + loggerA = null; + loggerB = null; + loggerC = null; + loggerD = null; + } + + @Override + protected Domain getDomain() { + return DOMAIN; + } + + @Override + protected void sendEventsToLoggers() { + JulTestUtils.send10EventsTo(loggerA); + JulTestUtils.send10EventsTo(loggerB); + JulTestUtils.send10EventsTo(loggerC); + JulTestUtils.send10EventsTo(loggerD); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulLegacyApiTest.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulLegacyApiTest.java new file mode 100644 index 0000000..d053d58 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulLegacyApiTest.java @@ -0,0 +1,191 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.jul; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; + +import java.lang.reflect.Field; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.lttng.tools.ILttngSession; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.tools.LttngToolsHelper; +import org.lttng.ust.agent.ILttngHandler; +import org.lttng.ust.agent.LTTngAgent; +import org.lttng.ust.agent.utils.LttngUtils; +import org.lttng.ust.agent.utils.TestPrintRunner; + +/** + * Enabled events test for the LTTng-UST JUL log handler, using the legacy API. + */ +@RunWith(TestPrintRunner.class) +@SuppressWarnings("deprecation") +public class JulLegacyApiTest { + + private static final Domain DOMAIN = Domain.JUL; + + private static final String EVENT_NAME_A = "EventA"; + private static final String EVENT_NAME_B = "EventB"; + + private ILttngSession session; + + private Logger loggerA; + private Logger loggerB; + + /** + * Class setup + */ + @BeforeClass + public static void julClassSetup() { + /* Skip tests if we can't find the JNI library or lttng-tools */ + assumeTrue(LttngUtils.checkForJulLibrary()); + assumeTrue(LttngUtils.checkForLttngTools(Domain.JUL)); + + LttngToolsHelper.destroyAllSessions(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void julClassCleanup() { + LttngToolsHelper.deleteAllTraces(); + } + + /** + * Test setup + */ + @Before + public void setup() { + loggerA = Logger.getLogger(EVENT_NAME_A); + LTTngAgent.getLTTngAgent(); + loggerB = Logger.getLogger(EVENT_NAME_B); + + loggerA.setLevel(Level.ALL); + loggerB.setLevel(Level.ALL); + + session = ILttngSession.createSession(null, DOMAIN); + } + + /** + * Test cleanup + */ + @After + public void tearDown() { + session.close(); + + LTTngAgent.dispose(); + + loggerA = null; + loggerB = null; + } + + /** + * Test tracing with no events enabled in the tracing session. + */ + @Test + public void testNoEvents() { + assertTrue(session.start()); + + JulTestUtils.send10EventsTo(loggerA); + JulTestUtils.send10EventsTo(loggerB); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertTrue(output.isEmpty()); + + ILttngHandler handler = getAgentHandler(); + assertEquals(0, handler.getEventCount()); + } + + /** + * Test tracing with all events enabled (-j -a) in the tracing session. + */ + @Test + public void testAllEvents() { + assertTrue(session.enableAllEvents()); + assertTrue(session.start()); + + JulTestUtils.send10EventsTo(loggerA); + JulTestUtils.send10EventsTo(loggerB); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(20, output.size()); + + ILttngHandler handler = getAgentHandler(); + assertEquals(20, handler.getEventCount()); + } + + /** + * Test tracing with a subset of events enabled in the tracing session. + */ + @Test + public void testSomeEvents() { + assertTrue(session.enableEvents(EVENT_NAME_A)); + assertTrue(session.start()); + + JulTestUtils.send10EventsTo(loggerA); + JulTestUtils.send10EventsTo(loggerB); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(10, output.size()); + + ILttngHandler handler = getAgentHandler(); + assertEquals(10, handler.getEventCount()); + } + + /** + * Get the singleton JUL Handler currently managed by the LTTngAgent. It is + * not public, so we need reflection to access it. + * + * @return The agent's JUL handler + */ + private static ILttngHandler getAgentHandler() { + try { + Field julHandlerField = LTTngAgent.class.getDeclaredField("julHandler"); + julHandlerField.setAccessible(true); + return (ILttngHandler) julHandlerField.get(LTTngAgent.getLTTngAgent()); + } catch (ReflectiveOperationException | SecurityException e) { + fail(); + return null; + } + } + +} + diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulMultiSessionTest.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulMultiSessionTest.java new file mode 100644 index 0000000..f377d91 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulMultiSessionTest.java @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.jul; + +import static org.junit.Assume.assumeTrue; + +import java.io.IOException; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.tools.LttngToolsHelper; +import org.lttng.ust.agent.integration.MultiSessionTestBase; +import org.lttng.ust.agent.jul.LttngLogHandler; +import org.lttng.ust.agent.utils.LttngUtils; + +/** + * JUL tests for multiple concurrent tracing sessions + */ +public class JulMultiSessionTest extends MultiSessionTestBase { + + private static final Domain DOMAIN = Domain.JUL; + + private Logger loggerA; + private Logger loggerB; + private Logger loggerC; + private Logger loggerD; + + /** + * Class setup + */ + @BeforeClass + public static void julClassSetup() { + /* Skip tests if we can't find the JNI library or lttng-tools */ + assumeTrue(LttngUtils.checkForJulLibrary()); + assumeTrue(LttngUtils.checkForLttngTools(Domain.JUL)); + + LttngToolsHelper.destroyAllSessions(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void julClassCleanup() { + LttngToolsHelper.deleteAllTraces(); + } + + /** + * Test setup + * + * @throws SecurityException + * @throws IOException + */ + @Before + public void julSetup() throws SecurityException, IOException { + loggerA = Logger.getLogger(EVENT_NAME_A); + loggerB = Logger.getLogger(EVENT_NAME_B); + loggerC = Logger.getLogger(EVENT_NAME_C); + loggerD = Logger.getLogger(EVENT_NAME_D); + + loggerA.setLevel(Level.ALL); + loggerB.setLevel(Level.ALL); + loggerC.setLevel(Level.ALL); + loggerD.setLevel(Level.ALL); + + handlerA = new LttngLogHandler(); + handlerB = new LttngLogHandler(); + handlerC = new LttngLogHandler(); + handlerD = new LttngLogHandler(); + + loggerA.addHandler((Handler) handlerA); + loggerB.addHandler((Handler) handlerB); + loggerC.addHandler((Handler) handlerC); + loggerD.addHandler((Handler) handlerD); + } + + /** + * Test teardown + */ + @After + public void julTeardown() { + loggerA.removeHandler((Handler) handlerA); + loggerB.removeHandler((Handler) handlerB); + loggerC.removeHandler((Handler) handlerC); + loggerD.removeHandler((Handler) handlerD); + + loggerA = null; + loggerB = null; + loggerC = null; + loggerD = null; + } + + @Override + protected Domain getDomain() { + return DOMAIN; + } + + @Override + protected void sendEventsToLoggers() { + JulTestUtils.send10EventsTo(loggerA); + JulTestUtils.send10EventsTo(loggerB); + JulTestUtils.send10EventsTo(loggerC); + JulTestUtils.send10EventsTo(loggerD); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulTestUtils.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulTestUtils.java new file mode 100644 index 0000000..0a3e13c --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/jul/JulTestUtils.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.jul; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Utility methods for JUL tests + */ +final class JulTestUtils { + + JulTestUtils() { + } + + static void send10EventsTo(Logger logger) { + String a = new String("a"); + Object[] params = { a, new String("b"), new Object() }; + + // Levels are FINE, FINER, FINEST, INFO, SEVERE, WARNING + logger.fine("A fine level message"); + logger.finer("A finer level message"); + logger.finest("A finest level message"); + logger.info("A info level message"); + logger.severe("A severe level message"); + logger.warning("A warning level message"); + logger.warning("Another warning level message"); + logger.log(Level.WARNING, "A warning message using Logger.log()"); + logger.log(Level.INFO, "A message with one parameter", a); + logger.log(Level.INFO, "A message with parameters", params); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jEnabledEventsTest.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jEnabledEventsTest.java new file mode 100644 index 0000000..0a18b17 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jEnabledEventsTest.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.log4j; + +import static org.junit.Assume.assumeTrue; + +import java.io.IOException; + +import org.apache.log4j.Appender; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.tools.LttngToolsHelper; +import org.lttng.ust.agent.integration.EnabledEventsTestBase; +import org.lttng.ust.agent.log4j.LttngLogAppender; +import org.lttng.ust.agent.utils.LttngUtils; + +/** + * Enabled events test for the LTTng-UST Log4j log handler. + */ +public class Log4jEnabledEventsTest extends EnabledEventsTestBase { + + private static final Domain DOMAIN = Domain.LOG4J; + + private Logger loggerA; + private Logger loggerB; + private Logger loggerC; + private Logger loggerD; + + /** + * Class setup + */ + @BeforeClass + public static void log4jClassSetup() { + /* Skip tests if we can't find the JNI library or lttng-tools */ + assumeTrue(LttngUtils.checkForLog4jLibrary()); + assumeTrue(LttngUtils.checkForLttngTools(Domain.LOG4J)); + + LttngToolsHelper.destroyAllSessions(); + } + + /** + * Class teardown + */ + @AfterClass + public static void log4jClassCleanup() { + LttngToolsHelper.deleteAllTraces(); + } + + /** + * Test setup + * + * @throws SecurityException + * @throws IOException + */ + @Before + public void log4jSetup() throws SecurityException, IOException { + loggerA = Logger.getLogger(EVENT_NAME_A); + loggerB = Logger.getLogger(EVENT_NAME_B); + loggerC = Logger.getLogger(EVENT_NAME_C); + loggerD = Logger.getLogger(EVENT_NAME_D); + + loggerA.setLevel(Level.ALL); + loggerB.setLevel(Level.ALL); + loggerC.setLevel(Level.ALL); + loggerD.setLevel(Level.ALL); + + handlerA = new LttngLogAppender(); + handlerB = new LttngLogAppender(); + handlerC = new LttngLogAppender(); + + loggerA.addAppender((Appender) handlerA); + loggerB.addAppender((Appender) handlerB); + loggerC.addAppender((Appender) handlerC); + } + + /** + * Test teardown + */ + @After + public void log4jTeardown() { + loggerA.removeAppender((Appender) handlerA); + loggerB.removeAppender((Appender) handlerB); + loggerC.removeAppender((Appender) handlerC); + + loggerA = null; + loggerB = null; + loggerC = null; + loggerD = null; + } + + @Override + protected Domain getDomain() { + return DOMAIN; + } + + @Override + protected void sendEventsToLoggers() { + Log4jTestUtils.send10Events(loggerA); + Log4jTestUtils.send10Events(loggerB); + Log4jTestUtils.send10Events(loggerC); + Log4jTestUtils.send10Events(loggerD); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jLegacyApiTest.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jLegacyApiTest.java new file mode 100644 index 0000000..b0784ce --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jLegacyApiTest.java @@ -0,0 +1,192 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.log4j; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; + +import java.lang.reflect.Field; +import java.util.List; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.lttng.tools.ILttngSession; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.tools.LttngToolsHelper; +import org.lttng.ust.agent.ILttngHandler; +import org.lttng.ust.agent.LTTngAgent; +import org.lttng.ust.agent.utils.LttngUtils; +import org.lttng.ust.agent.utils.TestPrintRunner; + +/** + * Enabled events test for the LTTng-UST Log4j log handler, using the legacy + * API. + */ +@RunWith(TestPrintRunner.class) +@SuppressWarnings("deprecation") +public class Log4jLegacyApiTest { + + private static final Domain DOMAIN = Domain.LOG4J; + + private static final String EVENT_NAME_A = "EventA"; + private static final String EVENT_NAME_B = "EventB"; + + private ILttngSession session; + + private Logger loggerA; + private Logger loggerB; + + /** + * Class setup + */ + @BeforeClass + public static void classSetup() { + /* Skip tests if we can't find the JNI library or lttng-tools */ + assumeTrue(LttngUtils.checkForLog4jLibrary()); + assumeTrue(LttngUtils.checkForLttngTools(Domain.LOG4J)); + + LttngToolsHelper.destroyAllSessions(); + } + + /** + * Class cleanup + */ + @AfterClass + public static void classCleanup() { + LttngToolsHelper.deleteAllTraces(); + } + + /** + * Test setup + */ + @Before + public void setup() { + loggerA = Logger.getLogger(EVENT_NAME_A); + LTTngAgent.getLTTngAgent(); + loggerB = Logger.getLogger(EVENT_NAME_B); + + loggerA.setLevel(Level.ALL); + loggerB.setLevel(Level.ALL); + + session = ILttngSession.createSession(null, DOMAIN); + } + + /** + * Test cleanup + */ + @After + public void tearDown() { + session.close(); + + LTTngAgent.dispose(); + + loggerA = null; + loggerB = null; + } + + /** + * Test tracing with no events enabled in the tracing session. + */ + @Test + public void testNoEvents() { + assertTrue(session.start()); + + Log4jTestUtils.send10Events(loggerA); + Log4jTestUtils.send10Events(loggerB); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertTrue(output.isEmpty()); + + ILttngHandler handler = getAgentHandler(); + assertEquals(0, handler.getEventCount()); + } + + /** + * Test tracing with all events enabled (-l -a) in the tracing session. + */ + @Test + public void testAllEvents() { + assertTrue(session.enableAllEvents()); + assertTrue(session.start()); + + Log4jTestUtils.send10Events(loggerA); + Log4jTestUtils.send10Events(loggerB); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(20, output.size()); + + ILttngHandler handler = getAgentHandler(); + assertEquals(20, handler.getEventCount()); + } + + /** + * Test tracing with a subset of events enabled in the tracing session. + */ + @Test + public void testSomeEvents() { + assertTrue(session.enableEvents(EVENT_NAME_A)); + assertTrue(session.start()); + + Log4jTestUtils.send10Events(loggerA); + Log4jTestUtils.send10Events(loggerB); + + assertTrue(session.stop()); + + List output = session.view(); + assertNotNull(output); + assertEquals(10, output.size()); + + ILttngHandler handler = getAgentHandler(); + assertEquals(10, handler.getEventCount()); + } + + /** + * Get the singleton Log4j Handler currently managed by the LTTngAgent. It + * is not public, so we need reflection to access it. + * + * @return The agent's Log4j handler + */ + private static ILttngHandler getAgentHandler() { + try { + Field log4jAppenderField = LTTngAgent.class.getDeclaredField("log4jAppender"); + log4jAppenderField.setAccessible(true); + return (ILttngHandler) log4jAppenderField.get(LTTngAgent.getLTTngAgent()); + } catch (ReflectiveOperationException | SecurityException e) { + fail(); + return null; + } + } + +} + diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jMultiSessionTest.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jMultiSessionTest.java new file mode 100644 index 0000000..d573ba1 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jMultiSessionTest.java @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.log4j; + +import static org.junit.Assume.assumeTrue; + +import java.io.IOException; + +import org.apache.log4j.Appender; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.tools.LttngToolsHelper; +import org.lttng.ust.agent.integration.MultiSessionTestBase; +import org.lttng.ust.agent.log4j.LttngLogAppender; +import org.lttng.ust.agent.utils.LttngUtils; + +/** + * Log4j tests for multiple concurrent tracing sessions + */ +public class Log4jMultiSessionTest extends MultiSessionTestBase { + + private static final Domain DOMAIN = Domain.LOG4J; + + private Logger loggerA; + private Logger loggerB; + private Logger loggerC; + private Logger loggerD; + + /** + * Class setup + */ + @BeforeClass + public static void log4jClassSetup() { + /* Skip tests if we can't find the JNI library or lttng-tools */ + assumeTrue(LttngUtils.checkForLog4jLibrary()); + assumeTrue(LttngUtils.checkForLttngTools(Domain.LOG4J)); + + LttngToolsHelper.destroyAllSessions(); + } + + /** + * Class teardown + */ + @AfterClass + public static void log4jClassCleanup() { + LttngToolsHelper.deleteAllTraces(); + } + + /** + * Test setup + * + * @throws SecurityException + * @throws IOException + */ + @Before + public void log4jSetup() throws SecurityException, IOException { + // TODO Wipe all existing LTTng sessions? + + loggerA = Logger.getLogger(EVENT_NAME_A); + loggerB = Logger.getLogger(EVENT_NAME_B); + loggerC = Logger.getLogger(EVENT_NAME_C); + loggerD = Logger.getLogger(EVENT_NAME_D); + + loggerA.setLevel(Level.ALL); + loggerB.setLevel(Level.ALL); + loggerC.setLevel(Level.ALL); + loggerD.setLevel(Level.ALL); + + handlerA = new LttngLogAppender(); + handlerB = new LttngLogAppender(); + handlerC = new LttngLogAppender(); + handlerD = new LttngLogAppender(); + + loggerA.addAppender((Appender) handlerA); + loggerB.addAppender((Appender) handlerB); + loggerC.addAppender((Appender) handlerC); + loggerD.addAppender((Appender) handlerD); + } + + /** + * Test teardown + */ + @After + public void log4jTeardown() { + loggerA.removeAppender((Appender) handlerA); + loggerB.removeAppender((Appender) handlerB); + loggerC.removeAppender((Appender) handlerC); + loggerD.removeAppender((Appender) handlerD); + + loggerA = null; + loggerB = null; + loggerC = null; + loggerD = null; + } + + @Override + protected Domain getDomain() { + return DOMAIN; + } + + @Override + protected void sendEventsToLoggers() { + Log4jTestUtils.send10Events(loggerA); + Log4jTestUtils.send10Events(loggerB); + Log4jTestUtils.send10Events(loggerC); + Log4jTestUtils.send10Events(loggerD); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jTestUtils.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jTestUtils.java new file mode 100644 index 0000000..c69f7bc --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jTestUtils.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.integration.log4j; + +import java.io.IOException; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; + +/** + * Utility methods for log4j tests + */ +final class Log4jTestUtils { + + private Log4jTestUtils() { + } + + static void send10Events(Logger logger) { + // Levels/priorities are DEBUG, ERROR, FATAL, INFO, TRACE, WARN + logger.debug("Debug message. Lost among so many."); + logger.debug("Debug message with a throwable", new IOException()); + logger.error("Error messsage. This might be bad."); + logger.error("Error message with a throwable", new IOException()); + logger.fatal("A fatal message. You are already dead."); + logger.info("A info message. Lol, who cares."); + logger.trace("A trace message. No, no *that* trace"); + logger.warn("A warn message. Yellow underline."); + logger.log(Level.DEBUG, "A debug message using .log()"); + logger.log(Level.ERROR, "A error message using .log()"); + } +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/utils/LttngUtils.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/utils/LttngUtils.java new file mode 100644 index 0000000..b68d979 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/utils/LttngUtils.java @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.utils; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +import org.lttng.tools.ILttngSession; +import org.lttng.tools.ILttngSession.Domain; +import org.lttng.tools.utils.ShellUtils; +import org.lttng.ust.agent.jul.LttngLogHandler; +import org.lttng.ust.agent.log4j.LttngLogAppender; + +/** + * Utility methods to test the presence of certain LTTng tools or libraries in + * the runtime environment. + */ +public final class LttngUtils { + + private LttngUtils() {} + + /** + * Check the the JUL native library is available, effectively allowing LTTng + * JUL handlers to be used. + * + * @return True if JUL works fine, false if it does not. + */ + public static boolean checkForJulLibrary() { + try { + LttngLogHandler testHandler = new LttngLogHandler(); + testHandler.close(); + } catch (SecurityException | IOException e) { + return false; + } + return true; + } + + /** + * Check the the Log4j native library is available, effectively allowing + * LTTng Log4j appenders to be used. + * + * @return True if Log4j works fine, false if it does not. + */ + public static boolean checkForLog4jLibrary() { + try { + LttngLogAppender testAppender = new LttngLogAppender(); + testAppender.close(); + } catch (SecurityException | IOException e) { + return false; + } + return true; + } + + /** + * Check that lttng-tools and babeltrace are installed on the system and + * working. + * + * @param domain + * The tracing domain to test for (we will try to setup a session + * with this domain) + * @return True if the environment should allow tracing fine, false if there + * was an error + */ + public static boolean checkForLttngTools(Domain domain) { + try (ILttngSession session = ILttngSession.createSession(null, domain)) { + boolean ret1 = session.enableAllEvents(); + boolean ret2 = session.start(); + boolean ret3 = session.stop(); + /* + * "lttng view" also tests that Babeltrace is installed and working + */ + List contents = session.view(); + return (ret1 && ret2 && ret3 && contents.isEmpty()); + } + } + + /** + * Check if there is a user session daemon currently running on the system. + * It needs to be of the same user as the application running this program. + * + * @return If there is a user session daemon currently running + */ + public static boolean checkForUserSessiond() { + String userName = System.getProperty("user.name"); + + /* The user name is truncated to 7 characters in "ps" */ + String shortUserName = userName.substring(0, Math.min(userName.length(), 7)); + + List command = Arrays.asList("ps", "-e", "u"); + List output = ShellUtils.getOutputFromCommand(false, command); + return output.stream() + .filter(s -> s.contains("lttng-sessiond")) + .anyMatch(s -> s.startsWith(shortUserName)); + } + + /** + * Check if there is a root user session daemon daemon currently running on + * the system. + * + * @return If there is a root session daemon currently running + */ + public static boolean checkForRootSessiond() { + List command = Arrays.asList("ps", "-e", "u"); + List output = ShellUtils.getOutputFromCommand(false, command); + return output.stream() + .filter(s -> s.contains("lttng-sessiond")) + .anyMatch(s -> s.startsWith("root")); + } + +} diff --git a/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/utils/TestPrintRunner.java b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/utils/TestPrintRunner.java new file mode 100644 index 0000000..2881067 --- /dev/null +++ b/lttng-ust-java-tests/src/test/java/org/lttng/ust/agent/utils/TestPrintRunner.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.lttng.ust.agent.utils; + +import org.junit.runner.Description; +import org.junit.runner.notification.Failure; +import org.junit.runner.notification.RunListener; +import org.junit.runner.notification.RunNotifier; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.junit.runners.model.InitializationError; + +/** + * Test runner that will print the name of the test being run to stdout. + * + * Thanks to http://stackoverflow.com/a/27070843/4227853 for the tips. + * + * @author Alexandre Montplaisir + */ +public class TestPrintRunner extends BlockJUnit4ClassRunner { + + /** + * Consructor + * + * @param klass + * @throws InitializationError + */ + public TestPrintRunner(Class klass) throws InitializationError { + super(klass); + } + + @Override + public void run(RunNotifier notifier) { + RunListener listener = new TestPrintListener(); + + notifier.addListener(listener); + super.run(notifier); + notifier.removeListener(listener); + } + + /** + * Listener that will print the class and test name to stdout. + */ + public static class TestPrintListener extends RunListener { + + @Override + public void testStarted(Description description) { + System.out.println("Running " + getTestName(description)); + } + + @Override + public void testAssumptionFailure(Failure failure) { + System.out.println("SKIPPING TEST: " + getTestName(failure.getDescription())); + System.out.println(failure.getMessage()); + } + + /** + * Get the className#methodName from a Description. + */ + private static String getTestName(Description description) { + return description.getClassName() + '#' + description.getMethodName(); + } + } + +} diff --git a/pom.xml b/pom.xml index fe19978..8dc1781 100644 --- a/pom.xml +++ b/pom.xml @@ -2,19 +2,19 @@ 3.0 - org.lttng.ust.agent - lttng-ust-agent-tests + org.lttng.ust + lttng-ust-java-parent 1.0.0 - jar + pom - LTTng-UST Java Agent Test Suite + LTTng-UST Java Agent UTF-8 - - /usr/local/share/java/lttng-ust-agent-common-1.0.0.jar - /usr/local/share/java/lttng-ust-agent-jul-1.0.0.jar - /usr/local/share/java/lttng-ust-agent-log4j-1.0.0.jar - -Djava.library.path=/usr/local/lib - - - - - org.lttng.ust.agent - lttng-ust-agent-common - 1.0.0 - system - ${common-jar-location} - - - org.lttng.ust.agent - lttng-ust-agent-jul - 1.0.0 - system - ${jul-jar-location} - - - org.lttng.ust.agent - lttng-ust-agent-log4j - 1.0.0 - system - ${log4j-jar-location} - - - - - log4j - log4j - 1.2.17 - - - junit - junit - 4.12 - test - - @@ -94,25 +50,11 @@ - - - - benchmark - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.18.1 - - - **/*Benchmark.java - - - - - - - + + + + lttng-ust-java-tests + lttng-tools-java + diff --git a/src/test/java/org/lttng/tools/ILttngSession.java b/src/test/java/org/lttng/tools/ILttngSession.java deleted file mode 100644 index e7d65a0..0000000 --- a/src/test/java/org/lttng/tools/ILttngSession.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.tools; - -import java.util.List; - -/** - * Java representation of a LTTng tracing session. - * - * @author Alexandre Montplaisir - */ -public interface ILttngSession extends AutoCloseable { - - /** - * Tracing domains as they are defined by lttng-tools - */ - enum Domain { - /** The JUL (java.util.logging) domain */ - JUL("-j"), /** The log4j (org.apache.log4j) domain */ - LOG4J("-l"); - - private final String flag; - - private Domain(String flag) { - this.flag = flag; - } - - /** - * @return The corresponding command-line flag to pass to options like - * "lttng enable-event" - */ - public String flag() { - return flag; - } - } - - // ------------------------------------------------------------------------ - // Factory methods - // ------------------------------------------------------------------------ - - /** - * Create a new LTTng tracing session using the default backend. - * - * @param sessionName - * The name of the session to use. It can be null, in which case - * we will provide a unique random name. - * @param domain - * The tracing domain of this session - * @return The new session object - */ - static ILttngSession createSession(String sessionName, Domain domain) { - return createCommandLineSession(sessionName, domain); - } - - /** - * Create a new LTTng tracing session, which will use the command-line - * "lttng" utility. - * - * @param sessionName - * The name of the session to use. It can be null, in which case - * we will provide a unique random name. - * @param domain - * The tracing domain of this session - * @return The new session object - */ - static ILttngSession createCommandLineSession(String sessionName, Domain domain) { - return new LttngCommandLineSession(sessionName, domain); - } - - // ------------------------------------------------------------------------ - // AutoCloseable - // ------------------------------------------------------------------------ - - /** - * Should be used to destroy the LTTng session. - */ - @Override - void close(); - - // ------------------------------------------------------------------------ - // Session management - // ------------------------------------------------------------------------ - - /** - * Enable all events in the session (as with "enable-event -a"). - * - * @return If the command executed successfully (return code = 0). - */ - boolean enableAllEvents(); - - /** - * Enable individual event(s). - * - * @param enabledEvents - * The list of events to enable. Should not be null or empty - * @return If the command executed successfully (return code = 0). - */ - boolean enableEvents(String... enabledEvents); - - /** - * Send a disable-event command. Used to disable events that were previously - * enabled. - * - * @param disabledEvents - * The list of disabled events. Should not be null or empty - * @return If the command executed successfully (return code = 0). - */ - boolean disableEvents(String... disabledEvents); - - /** - * Start tracing - * - * @return If the command executed successfully (return code = 0). - */ - boolean start(); - - /** - * Stop the tracing session - * - * @return If the command executed successfully (return code = 0). - */ - boolean stop(); - - /** - * Issue a "lttng view" command on the session, and returns its output. This - * effectively returns the current content of the trace in text form. - * - * @return The output of Babeltrace on the session's current trace - */ - List view(); -} diff --git a/src/test/java/org/lttng/tools/LttngCommandLineSession.java b/src/test/java/org/lttng/tools/LttngCommandLineSession.java deleted file mode 100644 index 0cd26cc..0000000 --- a/src/test/java/org/lttng/tools/LttngCommandLineSession.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.tools; - -import static org.lttng.tools.utils.ShellUtils.executeCommand; - -import java.util.Arrays; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.lttng.tools.utils.ShellUtils; - -/** - * Implementation of {@link ILttngSession} which uses the command-line "lttng" - * tool to manipulate the session. Creating an instance will run "lttng create", - * close()'ing it will run "lttng destroy". - * - * @author Alexandre Montplaisir - */ -class LttngCommandLineSession implements ILttngSession { - - private final String sessionName; - private final Domain domain; - - private volatile boolean channelCreated = false; - - /** - * Constructor to create a new LTTng tracing session. - * - * @param sessionName - * The name of the session to use. It can be null, in which case - * we will provide a unique random name. - * @param domain - * The tracing domain of this session - */ - public LttngCommandLineSession(String sessionName, Domain domain) { - if (sessionName != null) { - this.sessionName = sessionName; - } else { - this.sessionName = UUID.randomUUID().toString(); - } - this.domain = domain; - - /* Create the session in LTTng */ - executeCommand(Arrays.asList("lttng", "create", this.sessionName)); - } - - @Override - public void close() { - /* Destroy the session */ - executeCommand(Arrays.asList("lttng", "destroy", sessionName)); - // FIXME also delete the trace we generated ? - } - - @Override - public boolean enableAllEvents() { - channelCreated = true; - return executeCommand(Arrays.asList( - "lttng", "enable-event", domain.flag(), "-a", "-s", sessionName)); - } - - @Override - public boolean enableEvents(String... enabledEvents) { - if (enabledEvents == null || enabledEvents.length == 0) { - throw new IllegalArgumentException(); - } - channelCreated = true; - return executeCommand(Arrays.asList( - "lttng", "enable-event", domain.flag(), - Arrays.stream(enabledEvents).collect(Collectors.joining(",")), - "-s", sessionName)); - } - - @Override - public boolean disableEvents(String... disabledEvents) { - if (disabledEvents == null || disabledEvents.length == 0) { - throw new IllegalArgumentException(); - } - return executeCommand(Arrays.asList( - "lttng", "disable-event", domain.flag(), - Arrays.stream(disabledEvents).collect(Collectors.joining(",")), - "-s", sessionName)); - } - - @Override - public boolean start() { - /* - * We have to enable a channel for 'lttng start' to work. However, we - * cannot enable a channel directly, see - * https://bugs.lttng.org/issues/894 . Instead we will enable an event - * we know does not exist - */ - if (!channelCreated) { - enableEvents("non-event"); - } - return executeCommand(Arrays.asList("lttng", "start", sessionName)); - } - - @Override - public boolean stop() { - return executeCommand(Arrays.asList("lttng", "stop", sessionName)); - } - - @Override - public List view() { - return ShellUtils.getOutputFromCommand(true, Arrays.asList("lttng", "view", sessionName)); - } -} diff --git a/src/test/java/org/lttng/tools/LttngToolsHelper.java b/src/test/java/org/lttng/tools/LttngToolsHelper.java deleted file mode 100644 index a38661e..0000000 --- a/src/test/java/org/lttng/tools/LttngToolsHelper.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.tools; - -import static org.lttng.tools.utils.ShellUtils.executeCommand; - -import java.io.IOException; -import java.nio.file.FileVisitResult; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.SimpleFileVisitor; -import java.nio.file.attribute.BasicFileAttributes; -import java.util.Arrays; - -/** - * Helper class to issue LTTng commands that do not affect a single session, and - * as such, do not fit into the scope of one {@link ILttngSession}. - * - * @author Alexandre Montplaisir - */ -public final class LttngToolsHelper { - - private LttngToolsHelper() {} - - /** - * Utility method to destroy all existing sessions. Useful when first - * setting up a test to make sure no existing session interferes. - * - * @return If the command completed successfully - */ - public static boolean destroyAllSessions() { - return executeCommand(Arrays.asList("lttng", "destroy", "-a")); - } - - /** - * Outside of the scope of lttng-tools, but this utility method can be used - * to delete all traces currently under ~/lttng-traces/. This can be used by - * tests to cleanup a trace they have created. - * - * @return True if the command completes successfully, false if there was an - * error. - */ - public static boolean deleteAllTraces() { - String tracesDir = new String(System.getProperty("user.home") + "/lttng-traces/"); - return deleteDirectory(Paths.get(tracesDir)); - } - - // ------------------------------------------------------------------------ - // Private helper methods - // ------------------------------------------------------------------------ - - private static boolean deleteDirectory(Path directory) { - try { - Files.walkFileTree(directory, new SimpleFileVisitor() { - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { - Files.delete(file); - return FileVisitResult.CONTINUE; - } - - @Override - public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { - Files.delete(dir); - return FileVisitResult.CONTINUE; - } - }); - } catch (IOException e) { - /* At least we tried... */ - return false; - } - return true; - } -} diff --git a/src/test/java/org/lttng/tools/utils/LttngUtils.java b/src/test/java/org/lttng/tools/utils/LttngUtils.java deleted file mode 100644 index de7b233..0000000 --- a/src/test/java/org/lttng/tools/utils/LttngUtils.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.tools.utils; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import org.lttng.tools.ILttngSession; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.ust.agent.jul.LttngLogHandler; -import org.lttng.ust.agent.log4j.LttngLogAppender; - -/** - * Utility methods to test the presence of certain LTTng tools or libraries in - * the runtime environment. - */ -public final class LttngUtils { - - private LttngUtils() {} - - /** - * Check the the JUL native library is available, effectively allowing LTTng - * JUL handlers to be used. - * - * @return True if JUL works fine, false if it does not. - */ - public static boolean checkForJulLibrary() { - try { - LttngLogHandler testHandler = new LttngLogHandler(); - testHandler.close(); - } catch (SecurityException | IOException e) { - return false; - } - return true; - } - - /** - * Check the the Log4j native library is available, effectively allowing - * LTTng Log4j appenders to be used. - * - * @return True if Log4j works fine, false if it does not. - */ - public static boolean checkForLog4jLibrary() { - try { - LttngLogAppender testAppender = new LttngLogAppender(); - testAppender.close(); - } catch (SecurityException | IOException e) { - return false; - } - return true; - } - - /** - * Check that lttng-tools and babeltrace are installed on the system and - * working. - * - * @param domain - * The tracing domain to test for (we will try to setup a session - * with this domain) - * @return True if the environment should allow tracing fine, false if there - * was an error - */ - public static boolean checkForLttngTools(Domain domain) { - try (ILttngSession session = ILttngSession.createSession(null, domain)) { - boolean ret1 = session.enableAllEvents(); - boolean ret2 = session.start(); - boolean ret3 = session.stop(); - /* - * "lttng view" also tests that Babeltrace is installed and working - */ - List contents = session.view(); - return (ret1 && ret2 && ret3 && contents.isEmpty()); - } - } - - /** - * Check if there is a user session daemon currently running on the system. - * It needs to be of the same user as the application running this program. - * - * @return If there is a user session daemon currently running - */ - public static boolean checkForUserSessiond() { - String userName = System.getProperty("user.name"); - - /* The user name is truncated to 7 characters in "ps" */ - String shortUserName = userName.substring(0, Math.min(userName.length(), 7)); - - List command = Arrays.asList("ps", "-e", "u"); - List output = ShellUtils.getOutputFromCommand(false, command); - return output.stream() - .filter(s -> s.contains("lttng-sessiond")) - .anyMatch(s -> s.startsWith(shortUserName)); - } - - /** - * Check if there is a root user session daemon daemon currently running on - * the system. - * - * @return If there is a root session daemon currently running - */ - public static boolean checkForRootSessiond() { - List command = Arrays.asList("ps", "-e", "u"); - List output = ShellUtils.getOutputFromCommand(false, command); - return output.stream() - .filter(s -> s.contains("lttng-sessiond")) - .anyMatch(s -> s.startsWith("root")); - } - -} diff --git a/src/test/java/org/lttng/tools/utils/ShellUtils.java b/src/test/java/org/lttng/tools/utils/ShellUtils.java deleted file mode 100644 index eb94c20..0000000 --- a/src/test/java/org/lttng/tools/utils/ShellUtils.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.tools.utils; - -import java.io.IOException; -import java.lang.ProcessBuilder.Redirect; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.List; -import java.util.StringJoiner; - -/** - * Utility methods to execute commands on the command line. - * - * @author Alexandre Montplaisir - */ -public final class ShellUtils { - - private ShellUtils() {} - - /** - * Simple command to test that the environment / stdout are working - * correctly. - * - * @param args - * Command-line arguments - */ - public static void main(String[] args) { - List command = Arrays.asList("ls", "-l"); - executeCommand(command); - } - - /** - * Execute a shell command and retrieve its return value. - * - * @param command - * The command to execute, as a list of individual arguments (do - * not use spaces) - * @return If the command returned successfully (ret code = 0) - */ - public static boolean executeCommand(List command) { - try { - /* "echo" the command to stdout */ - StringJoiner sj = new StringJoiner(" ", "$ ", ""); - command.stream().forEach(sj::add); - System.out.println(sj.toString()); - - ProcessBuilder builder = new ProcessBuilder(command); - builder.redirectErrorStream(true); - builder.redirectOutput(Redirect.INHERIT); - - Process p = builder.start(); - int ret = p.waitFor(); - - System.out.println("(returned from command)"); - - return (ret == 0); - - } catch (IOException | InterruptedException e) { - return false; - } - } - - /** - * Execute a shell command and retrieve its output. - * - * @param print - * Should the output also be printed to stdout as usual - * @param command - * The command to execute, as a list of individual arguments (do - * not use spaces) - * @return The output of the command, as one list element per line - */ - public static List getOutputFromCommand(boolean print, List command) { - try { - /* "echo" the command to stdout */ - StringJoiner sj = new StringJoiner(" ", "$ ", ""); - command.stream().forEach(sj::add); - System.out.println(sj.toString()); - - Path tempFile = Files.createTempFile("test-output", null); - - ProcessBuilder builder = new ProcessBuilder(command); - builder.redirectErrorStream(true); - builder.redirectOutput(Redirect.to(tempFile.toFile())); - - Process p = builder.start(); - p.waitFor(); - - List lines = Files.readAllLines(tempFile); - Files.delete(tempFile); - - if (print) { - /* Also print the output to the console */ - lines.stream().forEach(System.out::println); - } else { - System.out.println("(output silenced)"); - } - - System.out.println("(returned from command)"); - return lines; - - } catch (IOException | InterruptedException e) { - return null; - } - } -} diff --git a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/JulHandlerBenchmarkBase.java b/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/JulHandlerBenchmarkBase.java deleted file mode 100644 index 9ac3df5..0000000 --- a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/JulHandlerBenchmarkBase.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.benchmarks.jul.handler; - -import java.util.LinkedList; -import java.util.List; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Base abstract class for JUL benchmarks. Sub-classes can setup parameters to - * test different types of log handlers. - */ -public abstract class JulHandlerBenchmarkBase { - - // ------------------------------------------------------------------------ - // Configurable test parameters - // ------------------------------------------------------------------------ - - /** Nb of runs per test, result will be averaged */ - private static final int NB_RUNS = 10; - - /** Trace/log events per run */ - private static final int NB_ITER = 100000; - - /** Which tests to run (for different number of threads) */ - private static final int[] NB_THREADS = {1, 1, 2, 3, 4, 5, 6, 7, 8}; - - // ------------------------------------------------------------------------ - // Attributes - // ------------------------------------------------------------------------ - - protected Logger logger; - protected Handler handler; - - // ------------------------------------------------------------------------ - // Maintenance methods - // ------------------------------------------------------------------------ - - /** - * Base test setup - */ - @Before - public void setup() { - /* Set up the logger */ - logger = Logger.getLogger("Test logger"); - logger.setUseParentHandlers(false); - logger.setLevel(Level.ALL); - - /* Sub-classes' @Before will setup the Handler */ - } - - /** - * Base test teardown - */ - @After - public void teardown() { - if (handler != null) { - logger.removeHandler(handler); - handler.close(); - } - handler = null; - logger = null; - } - - // ------------------------------------------------------------------------ - // Test methods - // ------------------------------------------------------------------------ - - /** - * Main test class for running the benchmark - */ - @Test - public void runBenchmark() { - if (handler != null) { - logger.addHandler(handler); - } - - System.out.println(); - System.out.println("Running benchmark: " + this.getClass().getCanonicalName()); - for (int i : NB_THREADS) { - runTest(logger, i); - } - } - - private static void runTest(Logger log, int nbThreads) { - long start, end, average, total = 0; - for (int i = 0; i < NB_RUNS; i++) { - Runner runner = new Runner(nbThreads, NB_ITER, log); - - start = System.nanoTime(); - runner.run(); - end = System.nanoTime(); - - total += (end - start); - } - average = total / NB_RUNS; - System.out.println(nbThreads + " threads, average = " + average / NB_ITER + " ns/event"); - } - - // ------------------------------------------------------------------------ - // Helper classes - // ------------------------------------------------------------------------ - - private static class Runner implements Runnable { - - private final List workers = new LinkedList<>(); - private final List workerThreads = new LinkedList<>(); - - public Runner(int nbThreads, int nbIter, Logger log) { - - for (int id = 0; id < nbThreads; id++) { - Worker curWorker = new Worker(id, nbIter, log); - workers.add(curWorker); - workerThreads.add(new Thread(curWorker, "worker " + id)); - } - } - - @Override - public void run() { - for (Thread curThread : workerThreads) { - curThread.start(); - } - - for (Thread curThread : workerThreads) { - try { - curThread.join(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - - private static class Worker implements Runnable { - - private final Logger log; - private final int threadId; - private final int nbIter; - - public Worker(int threadId, int nbIter, Logger log) { - this.log = log; - this.threadId = threadId; - this.nbIter = nbIter; - } - - @Override - public void run() { - for (int i = 0; i < nbIter; i++) { - log.info("Thread " + threadId + ", iteration " + i); - } - } - - } - } -} diff --git a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/DummyHandlerBenchmark.java b/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/DummyHandlerBenchmark.java deleted file mode 100644 index 44a5290..0000000 --- a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/DummyHandlerBenchmark.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.benchmarks.jul.handler.builtin; - -import java.util.logging.Handler; -import java.util.logging.LogRecord; - -import org.junit.Before; -import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; - -/** - * Test suite of using a "dummy" handler, which means a handler that does - * exactly nothing. - */ -public class DummyHandlerBenchmark extends JulHandlerBenchmarkBase { - - /** - * Test setup - */ - @Before - public void testSetup() { - handler = new DummyHandler(); - } - - private static class DummyHandler extends Handler { - - public DummyHandler() { - super(); - } - - @Override - public void close() throws SecurityException {} - - @Override - public void flush() {} - - @Override - public void publish(LogRecord record) {} - - } -} diff --git a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/FileHandlerBenchmark.java b/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/FileHandlerBenchmark.java deleted file mode 100644 index af4ab7c..0000000 --- a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/FileHandlerBenchmark.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.benchmarks.jul.handler.builtin; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.logging.FileHandler; -import java.util.logging.SimpleFormatter; - -import org.junit.After; -import org.junit.Before; -import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; - -/** - * Test class using a {@link FileHandler}, which a {@link SimpleFormatter}. - */ -public class FileHandlerBenchmark extends JulHandlerBenchmarkBase { - - private Path outputFile; - - /** - * Test setup - * - * @throws SecurityException - * If there is problem setting up the handler - * @throws IOException - * If there is problem setting up the handler - */ - @Before - public void testSetup() throws SecurityException, IOException { - outputFile = Files.createTempFile(this.getClass().getSimpleName(), null); - - handler = new FileHandler(outputFile.toString(), false); - handler.setFormatter(new SimpleFormatter()); - } - - /** - * Test cleanup - * - * @throws IOException - * If we could not delete the test file - */ - @After - public void testTeardown() throws IOException { - Files.deleteIfExists(outputFile); - } -} diff --git a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/NoHandlerBenchmark.java b/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/NoHandlerBenchmark.java deleted file mode 100644 index 09457d2..0000000 --- a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/builtin/NoHandlerBenchmark.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.benchmarks.jul.handler.builtin; - -import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; - -/** - * Benchmark that will attach no {@link java.util.logging.Handler} to the - * {@link java.util.logging.Logger} object. - */ -public class NoHandlerBenchmark extends JulHandlerBenchmarkBase { - - /* Do not setup any handler */ -} diff --git a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingDisabledBenchmark.java b/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingDisabledBenchmark.java deleted file mode 100644 index d0e514c..0000000 --- a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingDisabledBenchmark.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.benchmarks.jul.handler.lttng; - -import static org.junit.Assert.assertTrue; - -import java.io.IOException; - -import org.junit.After; -import org.junit.Before; -import org.lttng.tools.ILttngSession; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; -import org.lttng.ust.agent.jul.LttngLogHandler; - -/** - * Benchmark the LTTng-JUL handler, but with tracing disabled in the tracing - * session. - */ -public class LttngJulHandlerTracingDisabledBenchmark extends JulHandlerBenchmarkBase { - - private ILttngSession session; - - /** - * Test setup - * - * @throws IOException - */ - @Before - public void testSetup() throws IOException { - handler = new LttngLogHandler(); - - session = ILttngSession.createSession(null, Domain.JUL); - assertTrue(session.enableEvents("non-event")); - assertTrue(session.start()); - } - - /** - * Test cleanup - */ - @After - public void testTeardown() { - assertTrue(session.stop()); - session.close(); - } -} diff --git a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingEnabledBenchmark.java b/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingEnabledBenchmark.java deleted file mode 100644 index c594de4..0000000 --- a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/LttngJulHandlerTracingEnabledBenchmark.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.benchmarks.jul.handler.lttng; - -import static org.junit.Assert.assertTrue; - -import java.io.IOException; - -import org.junit.After; -import org.junit.Before; -import org.lttng.tools.ILttngSession; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; -import org.lttng.ust.agent.jul.LttngLogHandler; - -/** - * Test the LTTng-JUL handler, with it actually sending events to the tracer. - */ -public class LttngJulHandlerTracingEnabledBenchmark extends JulHandlerBenchmarkBase { - - private ILttngSession session; - - /** - * Test setup - * - * @throws IOException - */ - @Before - public void testSetup() throws IOException { - handler = new LttngLogHandler(); - - session = ILttngSession.createSession(null, Domain.JUL); - assertTrue(session.enableAllEvents()); - assertTrue(session.start()); - } - - /** - * Test cleanup - */ - @After - public void testTeardown() { - assertTrue(session.stop()); - session.close(); - } -} diff --git a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingDisabledBenchmark.java b/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingDisabledBenchmark.java deleted file mode 100644 index 112b0f0..0000000 --- a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingDisabledBenchmark.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.benchmarks.jul.handler.lttng.old; - -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.lttng.tools.ILttngSession; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.ust.agent.LTTngAgent; -import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; - -/** - * Benchmark for the LTTng-UST handler, using the legacy API. Tracing is - * disabled in the tracing session. - */ -@SuppressWarnings("deprecation") -public class OldLttngJulHandlerTracingDisabledBenchmark extends JulHandlerBenchmarkBase { - - private ILttngSession session; - - /** - * Test setup - */ - @Before - public void testSetup() { - LTTngAgent.getLTTngAgent(); - - session = ILttngSession.createSession(null, Domain.JUL); - assertTrue(session.enableEvents("non-event")); - assertTrue(session.start()); - } - - /** - * Test cleanup - */ - @After - public void testTeardown() { - assertTrue(session.stop()); - session.close(); - - LTTngAgent.dispose(); - } -} diff --git a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java b/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java deleted file mode 100644 index a36578b..0000000 --- a/src/test/java/org/lttng/ust/agent/benchmarks/jul/handler/lttng/old/OldLttngJulHandlerTracingEnabledBenchmark.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.benchmarks.jul.handler.lttng.old; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.lang.reflect.Field; - -import org.junit.After; -import org.junit.Before; -import org.lttng.tools.ILttngSession; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.ust.agent.LTTngAgent; -import org.lttng.ust.agent.benchmarks.jul.handler.JulHandlerBenchmarkBase; -import org.lttng.ust.agent.jul.LttngLogHandler; - -/** - * Benchmark for the LTTng-UST handler, using the legacy API. Tracing is - * enabled in the tracing session. - */ -@SuppressWarnings("deprecation") -public class OldLttngJulHandlerTracingEnabledBenchmark extends JulHandlerBenchmarkBase { - - private ILttngSession session; - private LttngLogHandler agentHandler; - - - /** - * Test setup - */ - @Before - public void testSetup() { - LTTngAgent agentInstance = LTTngAgent.getLTTngAgent(); - - /* - * The "old API" works by attaching a handler managed by the agent to - * the root JUL logger. This causes problems here, because we use - * logger.setUserParentHandler(false), which does not trigger the - * handler as would be expected. - * - * Instead we will retrieve this handler through reflection, and attach - * it to our own logger here for the duration of the test. - */ - try { - Field julHandlerField = LTTngAgent.class.getDeclaredField("julHandler"); - julHandlerField.setAccessible(true); - agentHandler = (LttngLogHandler) julHandlerField.get(agentInstance); - - logger.addHandler(agentHandler); - - } catch (ReflectiveOperationException e) { - fail(); - } - - session = ILttngSession.createSession(null, Domain.JUL); - assertTrue(session.enableAllEvents()); - assertTrue(session.start()); - } - - /** - * Test cleanup - */ - @After - public void testTeardown() { - assertTrue(session.stop()); - session.close(); - - logger.removeHandler(agentHandler); - LTTngAgent.dispose(); - } -} diff --git a/src/test/java/org/lttng/ust/agent/integration/EnabledEventsTestBase.java b/src/test/java/org/lttng/ust/agent/integration/EnabledEventsTestBase.java deleted file mode 100644 index fd72279..0000000 --- a/src/test/java/org/lttng/ust/agent/integration/EnabledEventsTestBase.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.integration; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.lttng.tools.ILttngSession; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.ust.agent.ILttngHandler; -import org.lttng.ust.agent.utils.TestPrintRunner; - -/** - * Base abstract class to implement all sorts of integration tests verifying the - * presence of enabled events in resulting traces. - */ -@RunWith(TestPrintRunner.class) -public abstract class EnabledEventsTestBase { - - protected static final String EVENT_NAME_A = "EventA"; - protected static final String EVENT_NAME_B = "EventAB"; - protected static final String EVENT_NAME_C = "EventABC"; - protected static final String EVENT_NAME_D = "EventABCD"; - - private ILttngSession session; - - /* Fields defined by the sub-class */ - protected ILttngHandler handlerA; - protected ILttngHandler handlerB; - protected ILttngHandler handlerC; - - protected abstract Domain getDomain(); - - protected abstract void sendEventsToLoggers(); - - /** - * Base test setup - */ - @Before - public void testSetup() { - session = ILttngSession.createSession(null, getDomain()); - } - - /** - * Base test teardown - */ - @After - public void testTeardown() { - session.close(); - - handlerA.close(); - handlerB.close(); - handlerC.close(); - - handlerA = null; - handlerB = null; - handlerC = null; - } - - /** - * Test sending events on the Java side, but no events enabled in the - * tracing session. There should be nothing in the resulting trace, and - * handlers should not have logged anything. - */ - @Test - public void testNoEvents() { - assertTrue(session.start()); - - sendEventsToLoggers(); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertTrue(output.isEmpty()); - - assertEquals(0, handlerA.getEventCount()); - assertEquals(0, handlerB.getEventCount()); - assertEquals(0, handlerC.getEventCount()); - } - - /** - * Test sending events on the Java side, and all events enabled in the - * tracing session. All handlers should have sent their events. - */ - @Test - public void testAllEvents() { - assertTrue(session.enableAllEvents()); - assertTrue(session.start()); - - sendEventsToLoggers(); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(30, output.size()); // loggerD has no handler attached - - assertEquals(10, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - } - - /** - * Test sending events on the Java side, with only some of them enabled in - * the tracing session. Only the subset that is enabled should be received. - */ - @Test - public void testSomeEvents() { - assertTrue(session.enableEvents(EVENT_NAME_A, EVENT_NAME_C, EVENT_NAME_D)); - assertTrue(session.start()); - - sendEventsToLoggers(); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(20, output.size()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(0, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - } - - /** - * Test with all events enabled (-a), plus some other events added manually. - * Events should still be retained, but there should be no duplicates. - */ - @Test - public void testAllEventsAndSome() { - assertTrue(session.enableAllEvents()); - assertTrue(session.enableEvents(EVENT_NAME_A, EVENT_NAME_B)); - assertTrue(session.start()); - - sendEventsToLoggers(); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(30, output.size()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - } - - /** - * Same as {@link #testSomeEvents()}, but some events were enabled first, - * then disabled. Makes sure the enabled-event refcounting works properly. - */ - @Test - public void testSomeEventsAfterDisabling() { - assertTrue(session.enableEvents(EVENT_NAME_A, EVENT_NAME_C, EVENT_NAME_D)); - assertTrue(session.disableEvents(EVENT_NAME_C)); - assertTrue(session.start()); - - sendEventsToLoggers(); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(10, output.size()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(0, handlerB.getEventCount()); - assertEquals(0, handlerC.getEventCount()); - } - - /** - * Test enabling an event prefix, which means an event name ending with a *, - * to match all events starting with this name. - */ - @Test - public void testEventPrefix() { - // should match event/loggers B and C, but not A. - assertTrue(session.enableEvents("EventAB*")); - assertTrue(session.start()); - - sendEventsToLoggers(); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(20, output.size()); - - assertEquals(0, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - } - - /** - * Same as {@link #testEventPrefix()}, but with multiple prefixes that - * overlap. There should not be any duplicate events in the trace or in the - * handlers. - */ - @Test - public void testEventPrefixOverlapping() { - // should still match B and C - assertTrue(session.enableEvents("EventAB*", "EventABC*")); - assertTrue(session.start()); - - sendEventsToLoggers(); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(20, output.size()); - - assertEquals(0, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - } - - /** - * Test with all events enabled (-a), plus an event prefix. Once again, - * there should be no duplicates. - */ - @Test - public void testAllEventsAndPrefix() { - assertTrue(session.enableAllEvents()); - assertTrue(session.enableEvents("EventAB*")); - assertTrue(session.start()); - - sendEventsToLoggers(); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(30, output.size()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - } -} diff --git a/src/test/java/org/lttng/ust/agent/integration/MultiSessionTestBase.java b/src/test/java/org/lttng/ust/agent/integration/MultiSessionTestBase.java deleted file mode 100644 index 1efa3a6..0000000 --- a/src/test/java/org/lttng/ust/agent/integration/MultiSessionTestBase.java +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.integration; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.lttng.tools.ILttngSession; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.ust.agent.ILttngHandler; -import org.lttng.ust.agent.utils.TestPrintRunner; - -/** - * Base abstract class for tests with multiple concurrent tracing sessions - */ -@RunWith(TestPrintRunner.class) -public abstract class MultiSessionTestBase { - - protected static final String EVENT_NAME_A = "EventA"; - protected static final String EVENT_NAME_B = "EventAB"; - protected static final String EVENT_NAME_C = "EventABC"; - protected static final String EVENT_NAME_D = "EventABCD"; - - private ILttngSession session1; - private ILttngSession session2; - private ILttngSession session3; - - /* Fields defined by the sub-class */ - protected ILttngHandler handlerA; - protected ILttngHandler handlerB; - protected ILttngHandler handlerC; - protected ILttngHandler handlerD; - - protected abstract Domain getDomain(); - - protected abstract void sendEventsToLoggers(); - - /** - * Base test setup - */ - @Before - public void testSetup() { - session1 = ILttngSession.createSession(null, getDomain()); - session2 = ILttngSession.createSession(null, getDomain()); - session3 = ILttngSession.createSession(null, getDomain()); - } - - /** - * Base test teardown - */ - @After - public void testTeardown() { - session1.close(); - session2.close(); - session3.close(); - - handlerA.close(); - handlerB.close(); - handlerC.close(); - handlerD.close(); - - handlerA = null; - handlerB = null; - handlerC = null; - handlerD = null; - } - - /** - * Test with no events in any session. - */ - @Test - public void testNoEvents() { - assertTrue(session1.start()); - assertTrue(session2.start()); - assertTrue(session3.start()); - - sendEventsToLoggers(); - - assertTrue(session1.stop()); - assertTrue(session2.stop()); - assertTrue(session3.stop()); - - List output1 = session1.view(); - List output2 = session2.view(); - List output3 = session3.view(); - assertNotNull(output1); - assertNotNull(output2); - assertNotNull(output3); - assertTrue(output1.isEmpty()); - assertTrue(output2.isEmpty()); - assertTrue(output3.isEmpty()); - - assertEquals(0, handlerA.getEventCount()); - assertEquals(0, handlerB.getEventCount()); - assertEquals(0, handlerC.getEventCount()); - assertEquals(0, handlerD.getEventCount()); - } - - /** - * Test with all events enabled in one session only. Everything should be - * sent through JNI, but only that session should keep the trace events. - */ - @Test - public void testAllEventsOneSession() { - assertTrue(session1.enableAllEvents()); - assertTrue(session1.start()); - assertTrue(session2.start()); - assertTrue(session3.start()); - - sendEventsToLoggers(); - - assertTrue(session1.stop()); - assertTrue(session2.stop()); - assertTrue(session3.stop()); - - List output1 = session1.view(); - List output2 = session2.view(); - List output3 = session3.view(); - assertNotNull(output1); - assertNotNull(output2); - assertNotNull(output3); - assertEquals(40, output1.size()); - assertTrue(output2.isEmpty()); - assertTrue(output3.isEmpty()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - assertEquals(10, handlerD.getEventCount()); - } - - /** - * Test with all events enabled in all sessions. All traces and handlers - * should see every event that was logged. - */ - @Test - public void testAllEventsAllSessions() { - assertTrue(session1.enableAllEvents()); - assertTrue(session2.enableAllEvents()); - assertTrue(session3.enableAllEvents()); - assertTrue(session1.start()); - assertTrue(session2.start()); - assertTrue(session3.start()); - - sendEventsToLoggers(); - - assertTrue(session1.stop()); - assertTrue(session2.stop()); - assertTrue(session3.stop()); - - List output1 = session1.view(); - List output2 = session2.view(); - List output3 = session3.view(); - assertNotNull(output1); - assertNotNull(output2); - assertNotNull(output3); - assertEquals(40, output1.size()); - assertEquals(40, output2.size()); - assertEquals(40, output3.size()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - assertEquals(10, handlerD.getEventCount()); - } - - /** - * Test enabling some events in some sessions only. - */ - @Test - public void testSomeEvents() { - assertTrue(session1.enableEvents(EVENT_NAME_A)); - assertTrue(session2.enableEvents(EVENT_NAME_B)); - assertTrue(session1.start()); - assertTrue(session2.start()); - assertTrue(session3.start()); - - sendEventsToLoggers(); - - assertTrue(session1.stop()); - assertTrue(session2.stop()); - assertTrue(session3.stop()); - - List output1 = session1.view(); - List output2 = session2.view(); - List output3 = session3.view(); - assertNotNull(output1); - assertNotNull(output2); - assertNotNull(output3); - assertEquals(10, output1.size()); - assertEquals(10, output2.size()); - assertEquals(0, output3.size()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(0, handlerC.getEventCount()); - assertEquals(0, handlerD.getEventCount()); - } - - /** - * Test with all events enabled in one session, and some others in another. - * All events should arrive where expected, with no duplicates. - */ - @Test - public void testAllEventsAndSome() { - assertTrue(session1.enableAllEvents()); - assertTrue(session2.enableEvents(EVENT_NAME_D)); - assertTrue(session1.start()); - assertTrue(session2.start()); - assertTrue(session3.start()); - - sendEventsToLoggers(); - - assertTrue(session1.stop()); - assertTrue(session2.stop()); - assertTrue(session3.stop()); - - List output1 = session1.view(); - List output2 = session2.view(); - List output3 = session3.view(); - assertNotNull(output1); - assertNotNull(output2); - assertNotNull(output3); - assertEquals(40, output1.size()); - assertEquals(10, output2.size()); - assertEquals(0, output3.size()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - assertEquals(10, handlerD.getEventCount()); - } - - /** - * Test with enabling then disabling some events. Makes sure the refcounting - * works properly. - */ - @Test - public void testSomeEventsAfterDisabling() { - assertTrue(session1.enableEvents(EVENT_NAME_A, EVENT_NAME_B, EVENT_NAME_C)); - assertTrue(session2.enableEvents(EVENT_NAME_B, EVENT_NAME_C, EVENT_NAME_D)); - assertTrue(session3.enableEvents(EVENT_NAME_A)); - - assertTrue(session1.disableEvents(EVENT_NAME_C)); - assertTrue(session2.disableEvents(EVENT_NAME_B, EVENT_NAME_C)); - assertTrue(session3.disableEvents(EVENT_NAME_A)); - - assertTrue(session1.start()); - assertTrue(session2.start()); - assertTrue(session3.start()); - - sendEventsToLoggers(); - - assertTrue(session1.stop()); - assertTrue(session2.stop()); - assertTrue(session3.stop()); - - List output1 = session1.view(); - List output2 = session2.view(); - List output3 = session3.view(); - assertNotNull(output1); - assertNotNull(output2); - assertNotNull(output3); - assertEquals(20, output1.size()); - assertEquals(10, output2.size()); - assertEquals(0, output3.size()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(0, handlerC.getEventCount()); - assertEquals(10, handlerD.getEventCount()); - } - - /** - * Test with a prefix in one session and a standard event in another. - */ - @Test - public void testPrefixAndEvent() { - assertTrue(session1.enableEvents("EventAB*")); - assertTrue(session3.enableEvents(EVENT_NAME_A)); - assertTrue(session1.start()); - assertTrue(session2.start()); - assertTrue(session3.start()); - - sendEventsToLoggers(); - - assertTrue(session1.stop()); - assertTrue(session2.stop()); - assertTrue(session3.stop()); - - List output1 = session1.view(); - List output2 = session2.view(); - List output3 = session3.view(); - assertNotNull(output1); - assertNotNull(output2); - assertNotNull(output3); - assertEquals(30, output1.size()); - assertEquals(0, output2.size()); - assertEquals(10, output3.size()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - assertEquals(10, handlerD.getEventCount()); - } - - /** - * Test with all events enabled in one session, and an event prefix in - * another. Once again, there should be no duplicates. - */ - @Test - public void testAllEventsAndPrefix() { - assertTrue(session1.enableAllEvents()); - assertTrue(session2.enableEvents("EventABC*")); - assertTrue(session1.start()); - assertTrue(session2.start()); - assertTrue(session3.start()); - - sendEventsToLoggers(); - - assertTrue(session1.stop()); - assertTrue(session2.stop()); - assertTrue(session3.stop()); - - List output1 = session1.view(); - List output2 = session2.view(); - List output3 = session3.view(); - assertNotNull(output1); - assertNotNull(output2); - assertNotNull(output3); - assertEquals(40, output1.size()); - assertEquals(20, output2.size()); - assertEquals(0, output3.size()); - - assertEquals(10, handlerA.getEventCount()); - assertEquals(10, handlerB.getEventCount()); - assertEquals(10, handlerC.getEventCount()); - assertEquals(10, handlerD.getEventCount()); - } -} diff --git a/src/test/java/org/lttng/ust/agent/integration/jul/JulEnabledEventsTest.java b/src/test/java/org/lttng/ust/agent/integration/jul/JulEnabledEventsTest.java deleted file mode 100644 index 949e914..0000000 --- a/src/test/java/org/lttng/ust/agent/integration/jul/JulEnabledEventsTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.integration.jul; - -import static org.junit.Assume.assumeTrue; - -import java.io.IOException; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.tools.LttngToolsHelper; -import org.lttng.tools.utils.LttngUtils; -import org.lttng.ust.agent.integration.EnabledEventsTestBase; -import org.lttng.ust.agent.jul.LttngLogHandler; - -/** - * Enabled events test for the LTTng-UST JUL log handler. - */ -public class JulEnabledEventsTest extends EnabledEventsTestBase { - - private static final Domain DOMAIN = Domain.JUL; - - private Logger loggerA; - private Logger loggerB; - private Logger loggerC; - private Logger loggerD; - - /** - * Class setup - */ - @BeforeClass - public static void julClassSetup() { - /* Skip tests if we can't find the JNI library or lttng-tools */ - assumeTrue(LttngUtils.checkForJulLibrary()); - assumeTrue(LttngUtils.checkForLttngTools(Domain.JUL)); - - LttngToolsHelper.destroyAllSessions(); - } - - /** - * Class cleanup - */ - @AfterClass - public static void julClassCleanup() { - LttngToolsHelper.deleteAllTraces(); - } - - /** - * Test setup - * - * @throws SecurityException - * @throws IOException - */ - @Before - public void julSetup() throws SecurityException, IOException { - loggerA = Logger.getLogger(EVENT_NAME_A); - loggerB = Logger.getLogger(EVENT_NAME_B); - loggerC = Logger.getLogger(EVENT_NAME_C); - loggerD = Logger.getLogger(EVENT_NAME_D); - - loggerA.setLevel(Level.ALL); - loggerB.setLevel(Level.ALL); - loggerC.setLevel(Level.ALL); - loggerD.setLevel(Level.ALL); - - handlerA = new LttngLogHandler(); - handlerB = new LttngLogHandler(); - handlerC = new LttngLogHandler(); - - loggerA.addHandler((Handler) handlerA); - loggerB.addHandler((Handler) handlerB); - loggerC.addHandler((Handler) handlerC); - } - - /** - * Test teardown - */ - @After - public void julTeardown() { - loggerA.removeHandler((Handler) handlerA); - loggerB.removeHandler((Handler) handlerB); - loggerC.removeHandler((Handler) handlerC); - - loggerA = null; - loggerB = null; - loggerC = null; - loggerD = null; - } - - @Override - protected Domain getDomain() { - return DOMAIN; - } - - @Override - protected void sendEventsToLoggers() { - JulTestUtils.send10EventsTo(loggerA); - JulTestUtils.send10EventsTo(loggerB); - JulTestUtils.send10EventsTo(loggerC); - JulTestUtils.send10EventsTo(loggerD); - } -} diff --git a/src/test/java/org/lttng/ust/agent/integration/jul/JulLegacyApiTest.java b/src/test/java/org/lttng/ust/agent/integration/jul/JulLegacyApiTest.java deleted file mode 100644 index a088bb9..0000000 --- a/src/test/java/org/lttng/ust/agent/integration/jul/JulLegacyApiTest.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.integration.jul; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.junit.Assume.assumeTrue; - -import java.lang.reflect.Field; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.lttng.tools.ILttngSession; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.tools.LttngToolsHelper; -import org.lttng.tools.utils.LttngUtils; -import org.lttng.ust.agent.ILttngHandler; -import org.lttng.ust.agent.LTTngAgent; -import org.lttng.ust.agent.utils.TestPrintRunner; - -/** - * Enabled events test for the LTTng-UST JUL log handler, using the legacy API. - */ -@RunWith(TestPrintRunner.class) -@SuppressWarnings("deprecation") -public class JulLegacyApiTest { - - private static final Domain DOMAIN = Domain.JUL; - - private static final String EVENT_NAME_A = "EventA"; - private static final String EVENT_NAME_B = "EventB"; - - private ILttngSession session; - - private Logger loggerA; - private Logger loggerB; - - /** - * Class setup - */ - @BeforeClass - public static void julClassSetup() { - /* Skip tests if we can't find the JNI library or lttng-tools */ - assumeTrue(LttngUtils.checkForJulLibrary()); - assumeTrue(LttngUtils.checkForLttngTools(Domain.JUL)); - - LttngToolsHelper.destroyAllSessions(); - } - - /** - * Class cleanup - */ - @AfterClass - public static void julClassCleanup() { - LttngToolsHelper.deleteAllTraces(); - } - - /** - * Test setup - */ - @Before - public void setup() { - loggerA = Logger.getLogger(EVENT_NAME_A); - LTTngAgent.getLTTngAgent(); - loggerB = Logger.getLogger(EVENT_NAME_B); - - loggerA.setLevel(Level.ALL); - loggerB.setLevel(Level.ALL); - - session = ILttngSession.createSession(null, DOMAIN); - } - - /** - * Test cleanup - */ - @After - public void tearDown() { - session.close(); - - LTTngAgent.dispose(); - - loggerA = null; - loggerB = null; - } - - /** - * Test tracing with no events enabled in the tracing session. - */ - @Test - public void testNoEvents() { - assertTrue(session.start()); - - JulTestUtils.send10EventsTo(loggerA); - JulTestUtils.send10EventsTo(loggerB); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertTrue(output.isEmpty()); - - ILttngHandler handler = getAgentHandler(); - assertEquals(0, handler.getEventCount()); - } - - /** - * Test tracing with all events enabled (-j -a) in the tracing session. - */ - @Test - public void testAllEvents() { - assertTrue(session.enableAllEvents()); - assertTrue(session.start()); - - JulTestUtils.send10EventsTo(loggerA); - JulTestUtils.send10EventsTo(loggerB); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(20, output.size()); - - ILttngHandler handler = getAgentHandler(); - assertEquals(20, handler.getEventCount()); - } - - /** - * Test tracing with a subset of events enabled in the tracing session. - */ - @Test - public void testSomeEvents() { - assertTrue(session.enableEvents(EVENT_NAME_A)); - assertTrue(session.start()); - - JulTestUtils.send10EventsTo(loggerA); - JulTestUtils.send10EventsTo(loggerB); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(10, output.size()); - - ILttngHandler handler = getAgentHandler(); - assertEquals(10, handler.getEventCount()); - } - - /** - * Get the singleton JUL Handler currently managed by the LTTngAgent. It is - * not public, so we need reflection to access it. - * - * @return The agent's JUL handler - */ - private static ILttngHandler getAgentHandler() { - try { - Field julHandlerField = LTTngAgent.class.getDeclaredField("julHandler"); - julHandlerField.setAccessible(true); - return (ILttngHandler) julHandlerField.get(LTTngAgent.getLTTngAgent()); - } catch (ReflectiveOperationException | SecurityException e) { - fail(); - return null; - } - } - -} - diff --git a/src/test/java/org/lttng/ust/agent/integration/jul/JulMultiSessionTest.java b/src/test/java/org/lttng/ust/agent/integration/jul/JulMultiSessionTest.java deleted file mode 100644 index 25a9cab..0000000 --- a/src/test/java/org/lttng/ust/agent/integration/jul/JulMultiSessionTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.integration.jul; - -import static org.junit.Assume.assumeTrue; - -import java.io.IOException; -import java.util.logging.Handler; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.tools.LttngToolsHelper; -import org.lttng.tools.utils.LttngUtils; -import org.lttng.ust.agent.integration.MultiSessionTestBase; -import org.lttng.ust.agent.jul.LttngLogHandler; - -/** - * JUL tests for multiple concurrent tracing sessions - */ -public class JulMultiSessionTest extends MultiSessionTestBase { - - private static final Domain DOMAIN = Domain.JUL; - - private Logger loggerA; - private Logger loggerB; - private Logger loggerC; - private Logger loggerD; - - /** - * Class setup - */ - @BeforeClass - public static void julClassSetup() { - /* Skip tests if we can't find the JNI library or lttng-tools */ - assumeTrue(LttngUtils.checkForJulLibrary()); - assumeTrue(LttngUtils.checkForLttngTools(Domain.JUL)); - - LttngToolsHelper.destroyAllSessions(); - } - - /** - * Class cleanup - */ - @AfterClass - public static void julClassCleanup() { - LttngToolsHelper.deleteAllTraces(); - } - - /** - * Test setup - * - * @throws SecurityException - * @throws IOException - */ - @Before - public void julSetup() throws SecurityException, IOException { - loggerA = Logger.getLogger(EVENT_NAME_A); - loggerB = Logger.getLogger(EVENT_NAME_B); - loggerC = Logger.getLogger(EVENT_NAME_C); - loggerD = Logger.getLogger(EVENT_NAME_D); - - loggerA.setLevel(Level.ALL); - loggerB.setLevel(Level.ALL); - loggerC.setLevel(Level.ALL); - loggerD.setLevel(Level.ALL); - - handlerA = new LttngLogHandler(); - handlerB = new LttngLogHandler(); - handlerC = new LttngLogHandler(); - handlerD = new LttngLogHandler(); - - loggerA.addHandler((Handler) handlerA); - loggerB.addHandler((Handler) handlerB); - loggerC.addHandler((Handler) handlerC); - loggerD.addHandler((Handler) handlerD); - } - - /** - * Test teardown - */ - @After - public void julTeardown() { - loggerA.removeHandler((Handler) handlerA); - loggerB.removeHandler((Handler) handlerB); - loggerC.removeHandler((Handler) handlerC); - loggerD.removeHandler((Handler) handlerD); - - loggerA = null; - loggerB = null; - loggerC = null; - loggerD = null; - } - - @Override - protected Domain getDomain() { - return DOMAIN; - } - - @Override - protected void sendEventsToLoggers() { - JulTestUtils.send10EventsTo(loggerA); - JulTestUtils.send10EventsTo(loggerB); - JulTestUtils.send10EventsTo(loggerC); - JulTestUtils.send10EventsTo(loggerD); - } -} diff --git a/src/test/java/org/lttng/ust/agent/integration/jul/JulTestUtils.java b/src/test/java/org/lttng/ust/agent/integration/jul/JulTestUtils.java deleted file mode 100644 index 0a3e13c..0000000 --- a/src/test/java/org/lttng/ust/agent/integration/jul/JulTestUtils.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.integration.jul; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Utility methods for JUL tests - */ -final class JulTestUtils { - - JulTestUtils() { - } - - static void send10EventsTo(Logger logger) { - String a = new String("a"); - Object[] params = { a, new String("b"), new Object() }; - - // Levels are FINE, FINER, FINEST, INFO, SEVERE, WARNING - logger.fine("A fine level message"); - logger.finer("A finer level message"); - logger.finest("A finest level message"); - logger.info("A info level message"); - logger.severe("A severe level message"); - logger.warning("A warning level message"); - logger.warning("Another warning level message"); - logger.log(Level.WARNING, "A warning message using Logger.log()"); - logger.log(Level.INFO, "A message with one parameter", a); - logger.log(Level.INFO, "A message with parameters", params); - } -} diff --git a/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jEnabledEventsTest.java b/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jEnabledEventsTest.java deleted file mode 100644 index a5b3453..0000000 --- a/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jEnabledEventsTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.integration.log4j; - -import static org.junit.Assume.assumeTrue; - -import java.io.IOException; - -import org.apache.log4j.Appender; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.tools.LttngToolsHelper; -import org.lttng.tools.utils.LttngUtils; -import org.lttng.ust.agent.integration.EnabledEventsTestBase; -import org.lttng.ust.agent.log4j.LttngLogAppender; - -/** - * Enabled events test for the LTTng-UST Log4j log handler. - */ -public class Log4jEnabledEventsTest extends EnabledEventsTestBase { - - private static final Domain DOMAIN = Domain.LOG4J; - - private Logger loggerA; - private Logger loggerB; - private Logger loggerC; - private Logger loggerD; - - /** - * Class setup - */ - @BeforeClass - public static void log4jClassSetup() { - /* Skip tests if we can't find the JNI library or lttng-tools */ - assumeTrue(LttngUtils.checkForLog4jLibrary()); - assumeTrue(LttngUtils.checkForLttngTools(Domain.LOG4J)); - - LttngToolsHelper.destroyAllSessions(); - } - - /** - * Class teardown - */ - @AfterClass - public static void log4jClassCleanup() { - LttngToolsHelper.deleteAllTraces(); - } - - /** - * Test setup - * - * @throws SecurityException - * @throws IOException - */ - @Before - public void log4jSetup() throws SecurityException, IOException { - loggerA = Logger.getLogger(EVENT_NAME_A); - loggerB = Logger.getLogger(EVENT_NAME_B); - loggerC = Logger.getLogger(EVENT_NAME_C); - loggerD = Logger.getLogger(EVENT_NAME_D); - - loggerA.setLevel(Level.ALL); - loggerB.setLevel(Level.ALL); - loggerC.setLevel(Level.ALL); - loggerD.setLevel(Level.ALL); - - handlerA = new LttngLogAppender(); - handlerB = new LttngLogAppender(); - handlerC = new LttngLogAppender(); - - loggerA.addAppender((Appender) handlerA); - loggerB.addAppender((Appender) handlerB); - loggerC.addAppender((Appender) handlerC); - } - - /** - * Test teardown - */ - @After - public void log4jTeardown() { - loggerA.removeAppender((Appender) handlerA); - loggerB.removeAppender((Appender) handlerB); - loggerC.removeAppender((Appender) handlerC); - - loggerA = null; - loggerB = null; - loggerC = null; - loggerD = null; - } - - @Override - protected Domain getDomain() { - return DOMAIN; - } - - @Override - protected void sendEventsToLoggers() { - Log4jTestUtils.send10Events(loggerA); - Log4jTestUtils.send10Events(loggerB); - Log4jTestUtils.send10Events(loggerC); - Log4jTestUtils.send10Events(loggerD); - } -} diff --git a/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jLegacyApiTest.java b/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jLegacyApiTest.java deleted file mode 100644 index d9ab7ff..0000000 --- a/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jLegacyApiTest.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.integration.log4j; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.junit.Assume.assumeTrue; - -import java.lang.reflect.Field; -import java.util.List; - -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.lttng.tools.ILttngSession; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.tools.LttngToolsHelper; -import org.lttng.tools.utils.LttngUtils; -import org.lttng.ust.agent.ILttngHandler; -import org.lttng.ust.agent.LTTngAgent; -import org.lttng.ust.agent.utils.TestPrintRunner; - -/** - * Enabled events test for the LTTng-UST Log4j log handler, using the legacy - * API. - */ -@RunWith(TestPrintRunner.class) -@SuppressWarnings("deprecation") -public class Log4jLegacyApiTest { - - private static final Domain DOMAIN = Domain.LOG4J; - - private static final String EVENT_NAME_A = "EventA"; - private static final String EVENT_NAME_B = "EventB"; - - private ILttngSession session; - - private Logger loggerA; - private Logger loggerB; - - /** - * Class setup - */ - @BeforeClass - public static void classSetup() { - /* Skip tests if we can't find the JNI library or lttng-tools */ - assumeTrue(LttngUtils.checkForLog4jLibrary()); - assumeTrue(LttngUtils.checkForLttngTools(Domain.LOG4J)); - - LttngToolsHelper.destroyAllSessions(); - } - - /** - * Class cleanup - */ - @AfterClass - public static void classCleanup() { - LttngToolsHelper.deleteAllTraces(); - } - - /** - * Test setup - */ - @Before - public void setup() { - loggerA = Logger.getLogger(EVENT_NAME_A); - LTTngAgent.getLTTngAgent(); - loggerB = Logger.getLogger(EVENT_NAME_B); - - loggerA.setLevel(Level.ALL); - loggerB.setLevel(Level.ALL); - - session = ILttngSession.createSession(null, DOMAIN); - } - - /** - * Test cleanup - */ - @After - public void tearDown() { - session.close(); - - LTTngAgent.dispose(); - - loggerA = null; - loggerB = null; - } - - /** - * Test tracing with no events enabled in the tracing session. - */ - @Test - public void testNoEvents() { - assertTrue(session.start()); - - Log4jTestUtils.send10Events(loggerA); - Log4jTestUtils.send10Events(loggerB); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertTrue(output.isEmpty()); - - ILttngHandler handler = getAgentHandler(); - assertEquals(0, handler.getEventCount()); - } - - /** - * Test tracing with all events enabled (-l -a) in the tracing session. - */ - @Test - public void testAllEvents() { - assertTrue(session.enableAllEvents()); - assertTrue(session.start()); - - Log4jTestUtils.send10Events(loggerA); - Log4jTestUtils.send10Events(loggerB); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(20, output.size()); - - ILttngHandler handler = getAgentHandler(); - assertEquals(20, handler.getEventCount()); - } - - /** - * Test tracing with a subset of events enabled in the tracing session. - */ - @Test - public void testSomeEvents() { - assertTrue(session.enableEvents(EVENT_NAME_A)); - assertTrue(session.start()); - - Log4jTestUtils.send10Events(loggerA); - Log4jTestUtils.send10Events(loggerB); - - assertTrue(session.stop()); - - List output = session.view(); - assertNotNull(output); - assertEquals(10, output.size()); - - ILttngHandler handler = getAgentHandler(); - assertEquals(10, handler.getEventCount()); - } - - /** - * Get the singleton Log4j Handler currently managed by the LTTngAgent. It - * is not public, so we need reflection to access it. - * - * @return The agent's Log4j handler - */ - private static ILttngHandler getAgentHandler() { - try { - Field log4jAppenderField = LTTngAgent.class.getDeclaredField("log4jAppender"); - log4jAppenderField.setAccessible(true); - return (ILttngHandler) log4jAppenderField.get(LTTngAgent.getLTTngAgent()); - } catch (ReflectiveOperationException | SecurityException e) { - fail(); - return null; - } - } - -} - diff --git a/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jMultiSessionTest.java b/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jMultiSessionTest.java deleted file mode 100644 index ef0bae1..0000000 --- a/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jMultiSessionTest.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.integration.log4j; - -import static org.junit.Assume.assumeTrue; - -import java.io.IOException; - -import org.apache.log4j.Appender; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.lttng.tools.ILttngSession.Domain; -import org.lttng.tools.LttngToolsHelper; -import org.lttng.tools.utils.LttngUtils; -import org.lttng.ust.agent.integration.MultiSessionTestBase; -import org.lttng.ust.agent.log4j.LttngLogAppender; - -/** - * Log4j tests for multiple concurrent tracing sessions - */ -public class Log4jMultiSessionTest extends MultiSessionTestBase { - - private static final Domain DOMAIN = Domain.LOG4J; - - private Logger loggerA; - private Logger loggerB; - private Logger loggerC; - private Logger loggerD; - - /** - * Class setup - */ - @BeforeClass - public static void log4jClassSetup() { - /* Skip tests if we can't find the JNI library or lttng-tools */ - assumeTrue(LttngUtils.checkForLog4jLibrary()); - assumeTrue(LttngUtils.checkForLttngTools(Domain.LOG4J)); - - LttngToolsHelper.destroyAllSessions(); - } - - /** - * Class teardown - */ - @AfterClass - public static void log4jClassCleanup() { - LttngToolsHelper.deleteAllTraces(); - } - - /** - * Test setup - * - * @throws SecurityException - * @throws IOException - */ - @Before - public void log4jSetup() throws SecurityException, IOException { - // TODO Wipe all existing LTTng sessions? - - loggerA = Logger.getLogger(EVENT_NAME_A); - loggerB = Logger.getLogger(EVENT_NAME_B); - loggerC = Logger.getLogger(EVENT_NAME_C); - loggerD = Logger.getLogger(EVENT_NAME_D); - - loggerA.setLevel(Level.ALL); - loggerB.setLevel(Level.ALL); - loggerC.setLevel(Level.ALL); - loggerD.setLevel(Level.ALL); - - handlerA = new LttngLogAppender(); - handlerB = new LttngLogAppender(); - handlerC = new LttngLogAppender(); - handlerD = new LttngLogAppender(); - - loggerA.addAppender((Appender) handlerA); - loggerB.addAppender((Appender) handlerB); - loggerC.addAppender((Appender) handlerC); - loggerD.addAppender((Appender) handlerD); - } - - /** - * Test teardown - */ - @After - public void log4jTeardown() { - loggerA.removeAppender((Appender) handlerA); - loggerB.removeAppender((Appender) handlerB); - loggerC.removeAppender((Appender) handlerC); - loggerD.removeAppender((Appender) handlerD); - - loggerA = null; - loggerB = null; - loggerC = null; - loggerD = null; - } - - @Override - protected Domain getDomain() { - return DOMAIN; - } - - @Override - protected void sendEventsToLoggers() { - Log4jTestUtils.send10Events(loggerA); - Log4jTestUtils.send10Events(loggerB); - Log4jTestUtils.send10Events(loggerC); - Log4jTestUtils.send10Events(loggerD); - } -} diff --git a/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jTestUtils.java b/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jTestUtils.java deleted file mode 100644 index c69f7bc..0000000 --- a/src/test/java/org/lttng/ust/agent/integration/log4j/Log4jTestUtils.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.integration.log4j; - -import java.io.IOException; - -import org.apache.log4j.Level; -import org.apache.log4j.Logger; - -/** - * Utility methods for log4j tests - */ -final class Log4jTestUtils { - - private Log4jTestUtils() { - } - - static void send10Events(Logger logger) { - // Levels/priorities are DEBUG, ERROR, FATAL, INFO, TRACE, WARN - logger.debug("Debug message. Lost among so many."); - logger.debug("Debug message with a throwable", new IOException()); - logger.error("Error messsage. This might be bad."); - logger.error("Error message with a throwable", new IOException()); - logger.fatal("A fatal message. You are already dead."); - logger.info("A info message. Lol, who cares."); - logger.trace("A trace message. No, no *that* trace"); - logger.warn("A warn message. Yellow underline."); - logger.log(Level.DEBUG, "A debug message using .log()"); - logger.log(Level.ERROR, "A error message using .log()"); - } -} diff --git a/src/test/java/org/lttng/ust/agent/utils/TestPrintRunner.java b/src/test/java/org/lttng/ust/agent/utils/TestPrintRunner.java deleted file mode 100644 index 2881067..0000000 --- a/src/test/java/org/lttng/ust/agent/utils/TestPrintRunner.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2015, EfficiOS Inc., Alexandre Montplaisir - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package org.lttng.ust.agent.utils; - -import org.junit.runner.Description; -import org.junit.runner.notification.Failure; -import org.junit.runner.notification.RunListener; -import org.junit.runner.notification.RunNotifier; -import org.junit.runners.BlockJUnit4ClassRunner; -import org.junit.runners.model.InitializationError; - -/** - * Test runner that will print the name of the test being run to stdout. - * - * Thanks to http://stackoverflow.com/a/27070843/4227853 for the tips. - * - * @author Alexandre Montplaisir - */ -public class TestPrintRunner extends BlockJUnit4ClassRunner { - - /** - * Consructor - * - * @param klass - * @throws InitializationError - */ - public TestPrintRunner(Class klass) throws InitializationError { - super(klass); - } - - @Override - public void run(RunNotifier notifier) { - RunListener listener = new TestPrintListener(); - - notifier.addListener(listener); - super.run(notifier); - notifier.removeListener(listener); - } - - /** - * Listener that will print the class and test name to stdout. - */ - public static class TestPrintListener extends RunListener { - - @Override - public void testStarted(Description description) { - System.out.println("Running " + getTestName(description)); - } - - @Override - public void testAssumptionFailure(Failure failure) { - System.out.println("SKIPPING TEST: " + getTestName(failure.getDescription())); - System.out.println(failure.getMessage()); - } - - /** - * Get the className#methodName from a Description. - */ - private static String getTestName(Description description) { - return description.getClassName() + '#' + description.getMethodName(); - } - } - -}