diff --git a/eclipse/eclipse-code-formatter.xml b/eclipse/eclipse-code-formatter.xml
new file mode 100644
index 00000000..4694d7f2
--- /dev/null
+++ b/eclipse/eclipse-code-formatter.xml
@@ -0,0 +1,295 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/eclipse/org.eclipse.jdt.core.prefs b/eclipse/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..63d59166
--- /dev/null
+++ b/eclipse/org.eclipse.jdt.core.prefs
@@ -0,0 +1,389 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+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.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+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=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=default
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+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=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+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.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+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.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+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.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=ignore
+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.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+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=false
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=90
+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=8
+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=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=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=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=90
+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=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/eclipse/org.eclipse.jdt.ui.prefs b/eclipse/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000..fb4753fe
--- /dev/null
+++ b/eclipse/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,125 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=true
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=false
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=false
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_type_arguments=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=false
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_Spring Cloud Cleanup Conventions
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Spring Cloud Java Conventions
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=false
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;\#;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=9999
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=9999
+org.eclipse.jdt.ui.text.custom_code_templates=/**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//*\n * Copyright 2013-2015 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *//**\n * @author ${user}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-Javadoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n\n${package_declaration}\n${typecomment}\n${type_declaration}\n\n\n\n// ${todo} Auto-generated catch block\nthrow new UnsupportedOperationException("Auto-generated method stub", ${exception_var});// ${todo} Auto-generated method stub\nthrow new UnsupportedOperationException("Auto-generated method stub");${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=true
+sp_cleanup.always_use_this_for_non_static_field_access=true
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=false
+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=false
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=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=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=true
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/pom.xml b/pom.xml
index 6a62acd8..5743f833 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,89 +1,98 @@
- 4.0.0
-
- org.springframework.cloud
- spring-cloud-commons
- 1.0.0.BUILD-SNAPSHOT
- jar
- Spring Cloud Commons
- Spring Cloud Commons
-
-
- org.springframework.cloud
- spring-cloud-build
- 1.0.0.BUILD-SNAPSHOT
-
-
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+
+ org.springframework.cloud
+ spring-cloud-build
+ 1.0.0.BUILD-SNAPSHOT
+
+
+ spring-cloud-commons
+ 1.0.0.BUILD-SNAPSHOT
+ jar
+ Spring Cloud Commons
+ Spring Cloud Commonshttps://github.com/spring-cloud/spring-cloud-commonsscm:git:git://github.com/spring-cloud/spring-cloud-commons.gitscm:git:ssh://git@github.com/spring-cloud/spring-cloud-commons.gitHEAD
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.7
- 1.7
-
-
-
-
-
-
-
-
- org.projectlombok
- lombok
- 1.12.6
-
-
- com.google.guava
- guava
- 18.0
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
- true
-
-
- org.springframework.boot
- spring-boot-starter-web
- true
-
-
- org.projectlombok
- lombok
+
+ .
+
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.7
+ 1.7
+
+
+
+ org.apache.maven.plugins
+ maven-eclipse-plugin
+
+ false
+
+
+ .settings/org.eclipse.jdt.ui.prefs
+ ${main.basedir}/eclipse/org.eclipse.jdt.ui.prefs
+
+
+ .settings/org.eclipse.jdt.core.prefs
+ ${main.basedir}/eclipse/org.eclipse.jdt.core.prefs
+
+
+
+
+
+
+
+
+
+ org.projectlombok
+ lombok
+ 1.12.6
+
+
+ com.google.guava
+ guava
+ 18.0
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ true
+
+
+ org.projectlombok
+ lombokcompiletrue
-
-
- com.google.guava
- guava
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
-
- true
-
-
+
+
+ com.google.guava
+ guava
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
diff --git a/src/main/java/org/springframework/cloud/client/CommonsClientAutoConfiguration.java b/src/main/java/org/springframework/cloud/client/CommonsClientAutoConfiguration.java
index 10da555f..df24aeed 100644
--- a/src/main/java/org/springframework/cloud/client/CommonsClientAutoConfiguration.java
+++ b/src/main/java/org/springframework/cloud/client/CommonsClientAutoConfiguration.java
@@ -1,9 +1,26 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client;
import java.util.List;
import org.springframework.boot.actuate.health.HealthAggregator;
import org.springframework.boot.actuate.health.HealthIndicator;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@@ -16,6 +33,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
/**
+ * {@link EnableAutoConfiguration Auto-configuration} for Spring Cloud Commons Client.
+ *
* @author Spencer Gibb
*/
@Configuration
@@ -27,14 +46,18 @@ public class CommonsClientAutoConfiguration {
@ConditionalOnBean(DiscoveryClient.class)
@ConditionalOnProperty(value = "spring.cloud.discovery.enabled", matchIfMissing = true)
protected static class HealthConfiguration {
+
@Bean
- public DiscoveryClientHealthIndicator instancesHealthIndicator(DiscoveryClient discoveryClient) {
+ public DiscoveryClientHealthIndicator instancesHealthIndicator(
+ DiscoveryClient discoveryClient) {
return new DiscoveryClientHealthIndicator(discoveryClient);
}
@Bean
- public DiscoveryCompositeHealthIndicator discoveryHealthIndicator(HealthAggregator aggregator, List indicators) {
+ public DiscoveryCompositeHealthIndicator discoveryHealthIndicator(
+ HealthAggregator aggregator, List indicators) {
return new DiscoveryCompositeHealthIndicator(aggregator, indicators);
}
+
}
}
diff --git a/src/main/java/org/springframework/cloud/client/DefaultServiceInstance.java b/src/main/java/org/springframework/cloud/client/DefaultServiceInstance.java
index 32cf1a79..160324d9 100644
--- a/src/main/java/org/springframework/cloud/client/DefaultServiceInstance.java
+++ b/src/main/java/org/springframework/cloud/client/DefaultServiceInstance.java
@@ -1,13 +1,35 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client;
import lombok.Data;
/**
+ * Default implementation of {@link ServiceInstance}.
+ *
* @author Spencer Gibb
*/
@Data
public class DefaultServiceInstance implements ServiceInstance {
- private final String serviceId;
- private final String host;
- private final int port;
+
+ private final String serviceId;
+
+ private final String host;
+
+ private final int port;
+
}
diff --git a/src/main/java/org/springframework/cloud/client/ServiceInstance.java b/src/main/java/org/springframework/cloud/client/ServiceInstance.java
index 2480f2a3..80877212 100644
--- a/src/main/java/org/springframework/cloud/client/ServiceInstance.java
+++ b/src/main/java/org/springframework/cloud/client/ServiceInstance.java
@@ -1,12 +1,31 @@
-package org.springframework.cloud.client;
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.cloud.client;
/**
* @author Spencer Gibb
- * TODO: name? Server? HostAndPort? Instance?
*/
public interface ServiceInstance {
- public String getServiceId();
- public String getHost();
- public int getPort();
+
+ // TODO: name? Server? HostAndPort? Instance?
+
+ public String getServiceId();
+
+ public String getHost();
+
+ public int getPort();
}
diff --git a/src/main/java/org/springframework/cloud/client/SingleImplementationImportSelector.java b/src/main/java/org/springframework/cloud/client/SingleImplementationImportSelector.java
index 407cfc07..6ec50eba 100644
--- a/src/main/java/org/springframework/cloud/client/SingleImplementationImportSelector.java
+++ b/src/main/java/org/springframework/cloud/client/SingleImplementationImportSelector.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client;
import java.util.ArrayList;
@@ -19,6 +35,7 @@ import org.springframework.util.Assert;
/**
* Selects a single configuration to load defined by the generic type T.
+ *
* @author Spencer Gibb
* @author Dave Syer
*/
@@ -29,11 +46,12 @@ public abstract class SingleImplementationImportSelector implements
private ClassLoader beanClassLoader;
private Class annotationClass;
+
private Environment environment;
@SuppressWarnings("unchecked")
protected SingleImplementationImportSelector() {
- annotationClass = (Class) GenericTypeResolver.resolveTypeArgument(
+ this.annotationClass = (Class) GenericTypeResolver.resolveTypeArgument(
this.getClass(), SingleImplementationImportSelector.class);
}
@@ -43,41 +61,40 @@ public abstract class SingleImplementationImportSelector implements
return new String[0];
}
AnnotationAttributes attributes = AnnotationAttributes.fromMap(metadata
- .getAnnotationAttributes(annotationClass.getName(), true));
+ .getAnnotationAttributes(this.annotationClass.getName(), true));
Assert.notNull(attributes, "No " + getSimpleName() + " attributes found. Is "
+ metadata.getClassName() + " annotated with @" + getSimpleName() + "?");
// Find all possible auto configuration classes, filtering duplicates
List factories = new ArrayList<>(new LinkedHashSet<>(
- SpringFactoriesLoader.loadFactoryNames(annotationClass,
+ SpringFactoriesLoader.loadFactoryNames(this.annotationClass,
this.beanClassLoader)));
if (factories.size() > 1) {
String factory = factories.get(0);
// there should only every be one DiscoveryClient
- log.warn(
- "More than one implementation of @{}. Using {} out of available {}",
- getSimpleName(), factory, factories);
+ log.warn("More than one implementation "
+ + "of @{}. Using {} out of available {}", getSimpleName(), factory,
+ factories);
factories = Collections.singletonList(factory);
}
return factories.toArray(new String[factories.size()]);
-
}
protected abstract boolean isEnabled();
protected String getSimpleName() {
- return annotationClass.getSimpleName();
+ return this.annotationClass.getSimpleName();
}
-
+
protected Class getAnnotationClass() {
- return annotationClass;
+ return this.annotationClass;
}
protected Environment getEnvironment() {
- return environment;
+ return this.environment;
}
@Override
@@ -89,4 +106,5 @@ public abstract class SingleImplementationImportSelector implements
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}
+
}
diff --git a/src/main/java/org/springframework/cloud/client/circuitbreaker/EnableCircuitBreaker.java b/src/main/java/org/springframework/cloud/client/circuitbreaker/EnableCircuitBreaker.java
index a4a66e3a..d180b91f 100644
--- a/src/main/java/org/springframework/cloud/client/circuitbreaker/EnableCircuitBreaker.java
+++ b/src/main/java/org/springframework/cloud/client/circuitbreaker/EnableCircuitBreaker.java
@@ -1,8 +1,29 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.circuitbreaker;
-import org.springframework.context.annotation.Import;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
-import java.lang.annotation.*;
+import org.springframework.context.annotation.Import;
/**
* @author Spencer Gibb
@@ -13,4 +34,5 @@ import java.lang.annotation.*;
@Inherited
@Import(EnableCircuitBreakerImportSelector.class)
public @interface EnableCircuitBreaker {
+
}
diff --git a/src/main/java/org/springframework/cloud/client/circuitbreaker/EnableCircuitBreakerImportSelector.java b/src/main/java/org/springframework/cloud/client/circuitbreaker/EnableCircuitBreakerImportSelector.java
index 55c9312e..06b76a5b 100644
--- a/src/main/java/org/springframework/cloud/client/circuitbreaker/EnableCircuitBreakerImportSelector.java
+++ b/src/main/java/org/springframework/cloud/client/circuitbreaker/EnableCircuitBreakerImportSelector.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.circuitbreaker;
import org.springframework.boot.bind.RelaxedPropertyResolver;
@@ -9,10 +25,13 @@ import org.springframework.core.annotation.Order;
* @author Spencer Gibb
*/
@Order(Ordered.LOWEST_PRECEDENCE - 100)
-public class EnableCircuitBreakerImportSelector extends SingleImplementationImportSelector {
+public class EnableCircuitBreakerImportSelector extends
+ SingleImplementationImportSelector {
@Override
protected boolean isEnabled() {
- return new RelaxedPropertyResolver(getEnvironment()).getProperty("spring.cloud.circuit.breaker.enabled", Boolean.class, Boolean.TRUE);
+ return new RelaxedPropertyResolver(getEnvironment()).getProperty(
+ "spring.cloud.circuit.breaker.enabled", Boolean.class, Boolean.TRUE);
}
+
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/AbstractDiscoveryLifecycle.java b/src/main/java/org/springframework/cloud/client/discovery/AbstractDiscoveryLifecycle.java
index 2397ca7f..db0f4d30 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/AbstractDiscoveryLifecycle.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/AbstractDiscoveryLifecycle.java
@@ -1,109 +1,139 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
+import javax.annotation.PreDestroy;
+
import org.springframework.beans.BeansException;
import org.springframework.boot.actuate.autoconfigure.ManagementServerProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.env.Environment;
-import javax.annotation.PreDestroy;
-
/**
* @author Spencer Gibb
*/
-public abstract class AbstractDiscoveryLifecycle implements DiscoveryLifecycle, ApplicationContextAware {
+public abstract class AbstractDiscoveryLifecycle implements DiscoveryLifecycle,
+ ApplicationContextAware {
- protected boolean autoStartup = true;
- protected boolean running;
- protected int order = 0;
- protected ApplicationContext context;
- protected Environment environment;
+ protected boolean autoStartup = true;
- @Override
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.context = applicationContext;
- environment = context.getEnvironment();
- }
+ protected boolean running;
- @Override
- public boolean isAutoStartup() {
- return autoStartup;
- }
+ protected int order = 0;
- @Override
- public void stop(Runnable callback) {
- stop();
- callback.run();
- }
+ protected ApplicationContext context;
- @Override
- public void start() {
- if (!isEnabled()) return;
+ protected Environment environment;
- register();
- if (ManagementServerPortUtils.isDifferent(context)) {
- registerManagement();
- }
- context.publishEvent(new InstanceRegisteredEvent<>(this, getConfiguration()));
- running = true;
- }
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext)
+ throws BeansException {
+ this.context = applicationContext;
+ this.environment = this.context.getEnvironment();
+ }
- protected abstract Object getConfiguration();
+ @Override
+ public boolean isAutoStartup() {
+ return this.autoStartup;
+ }
- protected abstract void register();
+ @Override
+ public void stop(Runnable callback) {
+ stop();
+ callback.run();
+ }
- protected void registerManagement() {}
+ @Override
+ public void start() {
+ if (!isEnabled()) {
+ return;
+ }
- protected abstract void deregister();
+ register();
+ if (ManagementServerPortUtils.isDifferent(this.context)) {
+ registerManagement();
+ }
+ this.context
+ .publishEvent(new InstanceRegisteredEvent<>(this, getConfiguration()));
+ this.running = true;
+ }
- protected void deregisterManagement() {}
+ protected abstract Object getConfiguration();
- protected abstract boolean isEnabled();
+ protected abstract void register();
- protected String getManagementServiceId() {
- return context.getId() + ":management"; //TODO: configurable management suffix
- }
+ protected void registerManagement() {
+ }
- protected String getManagementServiceName() {
- return getAppName() + ":management"; //TODO: configurable management suffix
- }
+ protected abstract void deregister();
- protected Integer getManagementPort() {
- return context.getBean(ManagementServerProperties.class).getPort();
- }
+ protected void deregisterManagement() {
+ }
- protected String getAppName() {
- return environment.getProperty("spring.application.name");
- }
+ protected abstract boolean isEnabled();
- @Override
- public void stop() {
- if (isEnabled()) {
- deregister();
- if (getManagementPort() != null) {
- deregisterManagement();
- }
- }
- running = false;
- }
+ protected String getManagementServiceId() {
+ return this.context.getId() + ":management";
+ // TODO: configurable management suffix
+ }
- @PreDestroy
- public void destroy() {
- stop();
- }
+ protected String getManagementServiceName() {
+ return getAppName() + ":management";
+ // TODO: configurable management suffix
+ }
- @Override
- public boolean isRunning() {
- return running;
- }
+ protected Integer getManagementPort() {
+ return this.context.getBean(ManagementServerProperties.class).getPort();
+ }
- @Override
- public int getOrder() {
- return order;
- }
+ protected String getAppName() {
+ return this.environment.getProperty("spring.application.name");
+ }
+
+ @Override
+ public void stop() {
+ if (isEnabled()) {
+ deregister();
+ if (getManagementPort() != null) {
+ deregisterManagement();
+ }
+ }
+ this.running = false;
+ }
+
+ @PreDestroy
+ public void destroy() {
+ stop();
+ }
+
+ @Override
+ public boolean isRunning() {
+ return this.running;
+ }
+
+ @Override
+ public int getOrder() {
+ return this.order;
+ }
+
+ @Override
+ public int getPhase() {
+ return 0;
+ }
- @Override
- public int getPhase() {
- return 0;
- }
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClient.java b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClient.java
index 2d4d0803..a5ea9756 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClient.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClient.java
@@ -1,32 +1,51 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
-import org.springframework.cloud.client.ServiceInstance;
-
import java.util.List;
+import org.springframework.cloud.client.ServiceInstance;
+
/**
* @author Spencer Gibb
*/
-//TODO: merge with LoadBalancerClient?
public interface DiscoveryClient {
+
+ // TODO: merge with LoadBalancerClient?
+
public String description();
- /**
- * @return ServiceInstance with information used to register the local service
- */
- public ServiceInstance getLocalServiceInstance();
+ /**
+ * @return ServiceInstance with information used to register the local service
+ */
+ public ServiceInstance getLocalServiceInstance();
- /**
- * Get all ServiceInstance's associated with a particular serviceId
- * @param serviceId the serviceId to query
- * @return a List of ServiceInstance
- */
- public List getInstances(String serviceId);
+ /**
+ * Get all ServiceInstance's associated with a particular serviceId
+ * @param serviceId the serviceId to query
+ * @return a List of ServiceInstance
+ */
+ public List getInstances(String serviceId);
- public List getAllInstances();
+ public List getAllInstances();
+
+ /**
+ * @return all known service id's
+ */
+ public List getServices();
- /**
- * @return all known service id's
- */
- public List getServices();
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClientHealthIndicator.java b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClientHealthIndicator.java
index 80c72954..1ab6d367 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClientHealthIndicator.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryClientHealthIndicator.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
import java.util.List;
@@ -15,6 +31,7 @@ import org.springframework.core.Ordered;
public class DiscoveryClientHealthIndicator implements DiscoveryHealthIndicator, Ordered {
private int order = Ordered.HIGHEST_PRECEDENCE;
+
private DiscoveryClient discoveryClient;
public DiscoveryClientHealthIndicator(DiscoveryClient discoveryClient) {
@@ -24,16 +41,17 @@ public class DiscoveryClientHealthIndicator implements DiscoveryHealthIndicator,
@Override
public Health health() {
Health.Builder builder = new Health.Builder();
- try {
- List services = discoveryClient.getServices();
- builder.status(new Status("UP", discoveryClient.description()))
+ try {
+ List services = this.discoveryClient.getServices();
+ builder.status(new Status("UP", this.discoveryClient.description()))
.withDetail("services", services);
- } catch (Exception e) {
- log.error("Error", e);
- builder.down(e);
- }
+ }
+ catch (Exception e) {
+ log.error("Error", e);
+ builder.down(e);
+ }
return builder.build();
- }
+ }
@Override
public String getName() {
@@ -42,10 +60,11 @@ public class DiscoveryClientHealthIndicator implements DiscoveryHealthIndicator,
@Override
public int getOrder() {
- return order;
+ return this.order;
}
public void setOrder(int order) {
this.order = order;
}
+
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryCompositeHealthIndicator.java b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryCompositeHealthIndicator.java
index 91d86f4e..8ca2c899 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryCompositeHealthIndicator.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryCompositeHealthIndicator.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
import java.util.List;
@@ -14,7 +30,8 @@ import org.springframework.boot.actuate.health.HealthIndicator;
public class DiscoveryCompositeHealthIndicator extends CompositeHealthIndicator {
@Autowired
- public DiscoveryCompositeHealthIndicator(HealthAggregator healthAggregator, List indicators) {
+ public DiscoveryCompositeHealthIndicator(HealthAggregator healthAggregator,
+ List indicators) {
super(healthAggregator);
for (DiscoveryHealthIndicator indicator : indicators) {
addHealthIndicator(indicator.getName(), new Holder(indicator));
@@ -30,7 +47,8 @@ public class DiscoveryCompositeHealthIndicator extends CompositeHealthIndicator
@Override
public Health health() {
- return delegate.health();
+ return this.delegate.health();
}
}
+
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryHealthIndicator.java b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryHealthIndicator.java
index 3db0bf40..9a93dcbc 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryHealthIndicator.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryHealthIndicator.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
import org.springframework.boot.actuate.health.Health;
@@ -6,10 +22,12 @@ import org.springframework.boot.actuate.health.Health;
* @author Spencer Gibb
*/
public interface DiscoveryHealthIndicator {
- public String getName();
+
+ String getName();
/**
* @return an indication of health
*/
Health health();
+
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryHeartbeatEvent.java b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryHeartbeatEvent.java
index 32f93cc6..caa58a47 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryHeartbeatEvent.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryHeartbeatEvent.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
import org.springframework.context.ApplicationEvent;
@@ -16,6 +32,7 @@ public class DiscoveryHeartbeatEvent extends ApplicationEvent {
}
public Object getValue() {
- return value;
+ return this.value;
}
+
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryLifecycle.java b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryLifecycle.java
index c6a43026..d7a8f4e3 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/DiscoveryLifecycle.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/DiscoveryLifecycle.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
import org.springframework.context.SmartLifecycle;
diff --git a/src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClient.java b/src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClient.java
index 4b6ab16a..2c503a2a 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClient.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClient.java
@@ -1,17 +1,38 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.springframework.context.annotation.Import;
+
/**
* @author Spencer Gibb
*/
-
-import java.lang.annotation.*;
-
-import org.springframework.context.annotation.Import;
-
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Import(EnableDiscoveryClientImportSelector.class)
public @interface EnableDiscoveryClient {
+
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClientImportSelector.java b/src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClientImportSelector.java
index 99f9fcca..e23e96ef 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClientImportSelector.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/EnableDiscoveryClientImportSelector.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
import org.springframework.boot.bind.RelaxedPropertyResolver;
@@ -17,4 +33,5 @@ public class EnableDiscoveryClientImportSelector extends
return new RelaxedPropertyResolver(getEnvironment()).getProperty(
"spring.cloud.discovery.enabled", Boolean.class, Boolean.TRUE);
}
+
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/InstanceRegisteredEvent.java b/src/main/java/org/springframework/cloud/client/discovery/InstanceRegisteredEvent.java
index c459b68e..6bf3ed3e 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/InstanceRegisteredEvent.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/InstanceRegisteredEvent.java
@@ -1,25 +1,46 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
import org.springframework.context.ApplicationEvent;
/**
- * Event to be published after the local service instance registers itself with a discovery service
+ * Event to be published after the local service instance registers itself with a
+ * discovery service.
+ *
* @author Spencer Gibb
*/
@SuppressWarnings("serial")
public class InstanceRegisteredEvent extends ApplicationEvent {
- private T config;
- /**
- * @param source the component that published the event (never {@code null})
- * @param config the configuration of the instance
- */
- public InstanceRegisteredEvent(Object source, T config) {
- super(source);
- this.config = config;
- }
+ private T config;
+
+ /**
+ * Create a new {@link InstanceRegisteredEvent} instance.
+ * @param source the component that published the event (never {@code null})
+ * @param config the configuration of the instance
+ */
+ public InstanceRegisteredEvent(Object source, T config) {
+ super(source);
+ this.config = config;
+ }
+
+ public T getConfig() {
+ return this.config;
+ }
- public T getConfig() {
- return config;
- }
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/ManagementServerPortUtils.java b/src/main/java/org/springframework/cloud/client/discovery/ManagementServerPortUtils.java
index 5861dde7..e0a3564e 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/ManagementServerPortUtils.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/ManagementServerPortUtils.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
import org.springframework.beans.factory.BeanFactory;
@@ -11,58 +27,58 @@ import org.springframework.web.context.WebApplicationContext;
*/
public class ManagementServerPortUtils {
- //TODO: copied from EndpointWebMvcAutoConfiguration.ManagementServerPort
- public static enum ManagementServerPort {
+ public static ManagementServerPort get(BeanFactory beanFactory) {
+ return ManagementServerPort.get(beanFactory);
+ }
- DISABLE, SAME, DIFFERENT;
+ public static boolean isDifferent(BeanFactory beanFactory) {
+ return get(beanFactory) == ManagementServerPort.DIFFERENT;
+ }
- public static ManagementServerPort get(BeanFactory beanFactory) {
+ public static boolean isDisabled(BeanFactory beanFactory) {
+ return get(beanFactory) == ManagementServerPort.DISABLE;
+ }
- ServerProperties serverProperties;
- try {
- serverProperties = beanFactory.getBean(ServerProperties.class);
- }
- catch (NoSuchBeanDefinitionException ex) {
- serverProperties = new ServerProperties();
- }
+ public static boolean isSame(BeanFactory beanFactory) {
+ return get(beanFactory) == ManagementServerPort.SAME;
+ }
- ManagementServerProperties managementServerProperties;
- try {
- managementServerProperties = beanFactory
- .getBean(ManagementServerProperties.class);
- }
- catch (NoSuchBeanDefinitionException ex) {
- managementServerProperties = new ManagementServerProperties();
- }
+ // TODO: copied from EndpointWebMvcAutoConfiguration.ManagementServerPort
+ public static enum ManagementServerPort {
- Integer port = managementServerProperties.getPort();
- if (port != null && port < 0) {
- return DISABLE;
- }
- if (!(beanFactory instanceof WebApplicationContext)) {
- // Current context is not a webapp
- return DIFFERENT;
- }
- return ((port == null)
- || (serverProperties.getPort() == null && port.equals(8080))
- || (port != 0 && port.equals(serverProperties.getPort())) ? SAME
- : DIFFERENT);
- }
- };
+ DISABLE, SAME, DIFFERENT;
- public static ManagementServerPort get(BeanFactory beanFactory) {
- return ManagementServerPort.get(beanFactory);
- }
+ public static ManagementServerPort get(BeanFactory beanFactory) {
+ ServerProperties serverProperties;
+ try {
+ serverProperties = beanFactory.getBean(ServerProperties.class);
+ }
+ catch (NoSuchBeanDefinitionException ex) {
+ serverProperties = new ServerProperties();
+ }
- public static boolean isDifferent(BeanFactory beanFactory) {
- return get(beanFactory) == ManagementServerPort.DIFFERENT;
- }
+ ManagementServerProperties managementServerProperties;
+ try {
+ managementServerProperties = beanFactory
+ .getBean(ManagementServerProperties.class);
+ }
+ catch (NoSuchBeanDefinitionException ex) {
+ managementServerProperties = new ManagementServerProperties();
+ }
- public static boolean isDisabled(BeanFactory beanFactory) {
- return get(beanFactory) == ManagementServerPort.DISABLE;
- }
+ Integer port = managementServerProperties.getPort();
+ if (port != null && port < 0) {
+ return DISABLE;
+ }
+ if (!(beanFactory instanceof WebApplicationContext)) {
+ // Current context is not a webapp
+ return DIFFERENT;
+ }
+ return ((port == null)
+ || (serverProperties.getPort() == null && port.equals(8080))
+ || (port != 0 && port.equals(serverProperties.getPort())) ? SAME
+ : DIFFERENT);
+ }
+ };
- public static boolean isSame(BeanFactory beanFactory) {
- return get(beanFactory) == ManagementServerPort.SAME;
- }
}
diff --git a/src/main/java/org/springframework/cloud/client/discovery/NoopDiscoveryClient.java b/src/main/java/org/springframework/cloud/client/discovery/NoopDiscoveryClient.java
index 6bcf8a2a..8e59d434 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/NoopDiscoveryClient.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/NoopDiscoveryClient.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.client.discovery;
import java.util.Collections;
@@ -22,12 +23,11 @@ import org.springframework.cloud.client.ServiceInstance;
/**
* @author Dave Syer
- *
*/
public class NoopDiscoveryClient implements DiscoveryClient {
private final ServiceInstance instance;
-
+
public NoopDiscoveryClient(ServiceInstance instance) {
this.instance = instance;
}
@@ -39,7 +39,7 @@ public class NoopDiscoveryClient implements DiscoveryClient {
@Override
public ServiceInstance getLocalServiceInstance() {
- return instance;
+ return this.instance;
}
@Override
diff --git a/src/main/java/org/springframework/cloud/client/discovery/NoopDiscoveryClientConfiguration.java b/src/main/java/org/springframework/cloud/client/discovery/NoopDiscoveryClientConfiguration.java
index 538bafd4..2bd2e9fa 100644
--- a/src/main/java/org/springframework/cloud/client/discovery/NoopDiscoveryClientConfiguration.java
+++ b/src/main/java/org/springframework/cloud/client/discovery/NoopDiscoveryClientConfiguration.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.cloud.client.discovery;
import java.net.InetAddress;
@@ -39,13 +40,13 @@ import org.springframework.core.env.Environment;
/**
* @author Dave Syer
- *
*/
@Configuration
@EnableConfigurationProperties
@ConditionalOnMissingClass(name = "com.netflix.discovery.EurekaClientConfig")
@ConditionalOnProperty(value = "eureka.client.enabled", havingValue = "false")
-public class NoopDiscoveryClientConfiguration implements ApplicationListener {
+public class NoopDiscoveryClientConfiguration implements
+ ApplicationListener {
private static final Logger logger = LoggerFactory
.getLogger(NoopDiscoveryClientConfiguration.class);
@@ -71,29 +72,30 @@ public class NoopDiscoveryClientConfiguration implements ApplicationListener(this, environment));
+ this.context.publishEvent(new InstanceRegisteredEvent(this,
+ this.environment));
}
@Bean
public DiscoveryClient discoveryClient() {
- return new NoopDiscoveryClient(serviceInstance);
+ return new NoopDiscoveryClient(this.serviceInstance);
}
}
diff --git a/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerClient.java b/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerClient.java
index 19ed6fc0..cf46fe6b 100644
--- a/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerClient.java
+++ b/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerClient.java
@@ -1,28 +1,47 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.loadbalancer;
-import org.springframework.cloud.client.ServiceInstance;
-
import java.net.URI;
+import org.springframework.cloud.client.ServiceInstance;
+
/**
* @author Spencer Gibb
*/
public interface LoadBalancerClient {
- /**
- * Choose a ServiceInstance from the LoadBalancer for the specified service
- * @param serviceId the service id to look up the LoadBalancer
- * @return a ServiceInstance that matches the serviceId
- */
- public ServiceInstance choose(String serviceId);
+ /**
+ * Choose a ServiceInstance from the LoadBalancer for the specified service
+ * @param serviceId the service id to look up the LoadBalancer
+ * @return a ServiceInstance that matches the serviceId
+ */
+ public ServiceInstance choose(String serviceId);
- /**
- * execute request using a ServiceInstance from the LoadBalancer for the specified service
- * @param serviceId the service id to look up the LoadBalancer
- * @param request allows implementations to execute pre and post actions such as incrementing metrics
- * @return the result of the LoadBalancerRequest callback on the selected ServiceInstance
- */
- public T execute(String serviceId, LoadBalancerRequest request);
+ /**
+ * execute request using a ServiceInstance from the LoadBalancer for the specified
+ * service
+ * @param serviceId the service id to look up the LoadBalancer
+ * @param request allows implementations to execute pre and post actions such as
+ * incrementing metrics
+ * @return the result of the LoadBalancerRequest callback on the selected
+ * ServiceInstance
+ */
+ public T execute(String serviceId, LoadBalancerRequest request);
- public URI reconstructURI(ServiceInstance instance, URI original);
+ public URI reconstructURI(ServiceInstance instance, URI original);
}
diff --git a/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerRequest.java b/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerRequest.java
index 7c6cbc60..4d0b4c31 100644
--- a/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerRequest.java
+++ b/src/main/java/org/springframework/cloud/client/loadbalancer/LoadBalancerRequest.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.loadbalancer;
import org.springframework.cloud.client.ServiceInstance;
@@ -6,5 +22,7 @@ import org.springframework.cloud.client.ServiceInstance;
* @author Spencer Gibb
*/
public interface LoadBalancerRequest {
- public T apply(ServiceInstance instance) throws Exception;
+
+ public T apply(ServiceInstance instance) throws Exception;
+
}
diff --git a/src/test/java/org/springframework/cloud/client/SingleImplementationImportSelectorTests.java b/src/test/java/org/springframework/cloud/client/SingleImplementationImportSelectorTests.java
index cd88ffbd..0a616491 100644
--- a/src/test/java/org/springframework/cloud/client/SingleImplementationImportSelectorTests.java
+++ b/src/test/java/org/springframework/cloud/client/SingleImplementationImportSelectorTests.java
@@ -1,26 +1,47 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client;
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
/**
* @author Spencer Gibb
*/
public class SingleImplementationImportSelectorTests {
- @Test
- public void testFindAnnotation() {
- MyAnnotationImportSelector selector = new MyAnnotationImportSelector();
- assertEquals("annotationClass was wrong", MyAnnotation.class, selector.getAnnotationClass());
- }
+ @Test
+ public void testFindAnnotation() {
+ MyAnnotationImportSelector selector = new MyAnnotationImportSelector();
+ assertEquals("annotationClass was wrong", MyAnnotation.class,
+ selector.getAnnotationClass());
+ }
- public static @interface MyAnnotation {}
- public static class MyAnnotationImportSelector extends SingleImplementationImportSelector {
- @Override
- protected boolean isEnabled() {
- return true;
- }
+ public static @interface MyAnnotation {
+ }
- }
+ public static class MyAnnotationImportSelector extends
+ SingleImplementationImportSelector {
+
+ @Override
+ protected boolean isEnabled() {
+ return true;
+ }
+
+ }
}
diff --git a/src/test/java/org/springframework/cloud/client/discovery/DiscoveryCompositeHealthIndicatorTests.java b/src/test/java/org/springframework/cloud/client/discovery/DiscoveryCompositeHealthIndicatorTests.java
index 58a04ee7..7d0cd5b6 100644
--- a/src/test/java/org/springframework/cloud/client/discovery/DiscoveryCompositeHealthIndicatorTests.java
+++ b/src/test/java/org/springframework/cloud/client/discovery/DiscoveryCompositeHealthIndicatorTests.java
@@ -1,6 +1,21 @@
+/*
+ * Copyright 2013-2015 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.cloud.client.discovery;
-import com.google.common.collect.Lists;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -14,14 +29,19 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import static org.mockito.Mockito.*;
-import static org.junit.Assert.*;
+import com.google.common.collect.Lists;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.mock;
/**
* @author Spencer Gibb
*/
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {DiscoveryCompositeHealthIndicatorTests.Config.class, CommonsClientAutoConfiguration.class})
+@ContextConfiguration(classes = { DiscoveryCompositeHealthIndicatorTests.Config.class,
+ CommonsClientAutoConfiguration.class })
public class DiscoveryCompositeHealthIndicatorTests {
@Autowired
@@ -37,8 +57,8 @@ public class DiscoveryCompositeHealthIndicatorTests {
@Bean
public DiscoveryClient discoveryClient() {
DiscoveryClient mock = mock(DiscoveryClient.class);
- when(mock.description()).thenReturn("TestDiscoveryClient");
- when(mock.getServices()).thenReturn(Lists.newArrayList("TestService1"));
+ given(mock.description()).willReturn("TestDiscoveryClient");
+ given(mock.getServices()).willReturn(Lists.newArrayList("TestService1"));
return mock;
}
@@ -60,12 +80,14 @@ public class DiscoveryCompositeHealthIndicatorTests {
@Test
public void testHealthIndicator() {
- assertNotNull("healthIndicator was null", healthIndicator);
- Health health = healthIndicator.health();
+ assertNotNull("healthIndicator was null", this.healthIndicator);
+ Health health = this.healthIndicator.health();
assertNotNull("health was null", health);
Status status = health.getStatus();
assertNotNull("status was null", status);
assertEquals("status code was wrong", "UP", status.getCode());
- assertEquals("status desciption was wrong", "TestDiscoveryClient", status.getDescription());
+ assertEquals("status desciption was wrong", "TestDiscoveryClient",
+ status.getDescription());
}
+
}