diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4fce593 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,1183 @@ +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = false +max_line_length = 120 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = true +ij_smart_tabs = false +ij_visual_guides = none +ij_wrap_on_typing = false + +[*.css] +ij_css_align_closing_brace_with_properties = false +ij_css_blank_lines_around_nested_selector = 1 +ij_css_blank_lines_between_blocks = 1 +ij_css_brace_placement = end_of_line +ij_css_enforce_quotes_on_format = false +ij_css_hex_color_long_format = false +ij_css_hex_color_lower_case = false +ij_css_hex_color_short_format = false +ij_css_hex_color_upper_case = false +ij_css_keep_blank_lines_in_code = 2 +ij_css_keep_indents_on_empty_lines = false +ij_css_keep_single_line_blocks = false +ij_css_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_css_space_after_colon = true +ij_css_space_before_opening_brace = true +ij_css_use_double_quotes = true +ij_css_value_alignment = do_not_align + +[*.feature] +indent_size = 2 +ij_gherkin_keep_indents_on_empty_lines = false + +[*.gsp] +ij_gsp_keep_indents_on_empty_lines = false + +[*.haml] +indent_size = 2 +ij_haml_keep_indents_on_empty_lines = false + +[*.java] +ij_java_align_consecutive_assignments = false +ij_java_align_consecutive_variable_declarations = false +ij_java_align_group_field_declarations = false +ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_array_initializer_expression = false +ij_java_align_multiline_assignment = false +ij_java_align_multiline_binary_operation = false +ij_java_align_multiline_chained_methods = false +ij_java_align_multiline_extends_list = false +ij_java_align_multiline_for = true +ij_java_align_multiline_method_parentheses = false +ij_java_align_multiline_parameters = true +ij_java_align_multiline_parameters_in_calls = false +ij_java_align_multiline_parenthesized_expression = false +ij_java_align_multiline_records = true +ij_java_align_multiline_resources = true +ij_java_align_multiline_ternary_operation = false +ij_java_align_multiline_text_blocks = false +ij_java_align_multiline_throws_list = false +ij_java_align_subsequent_simple_methods = false +ij_java_align_throws_keyword = false +ij_java_annotation_parameter_wrap = off +ij_java_array_initializer_new_line_after_left_brace = false +ij_java_array_initializer_right_brace_on_new_line = false +ij_java_array_initializer_wrap = off +ij_java_assert_statement_colon_on_next_line = false +ij_java_assert_statement_wrap = off +ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = false +ij_java_binary_operation_wrap = off +ij_java_blank_lines_after_anonymous_class_header = 0 +ij_java_blank_lines_after_class_header = 0 +ij_java_blank_lines_after_imports = 1 +ij_java_blank_lines_after_package = 1 +ij_java_blank_lines_around_class = 1 +ij_java_blank_lines_around_field = 0 +ij_java_blank_lines_around_field_in_interface = 0 +ij_java_blank_lines_around_initializer = 1 +ij_java_blank_lines_around_method = 1 +ij_java_blank_lines_around_method_in_interface = 1 +ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_imports = 1 +ij_java_blank_lines_before_method_body = 0 +ij_java_blank_lines_before_package = 0 +ij_java_block_brace_style = next_line +ij_java_block_comment_at_first_column = true +ij_java_call_parameters_new_line_after_left_paren = false +ij_java_call_parameters_right_paren_on_new_line = true +ij_java_call_parameters_wrap = off +ij_java_case_statement_on_separate_line = true +ij_java_catch_on_new_line = true +ij_java_class_annotation_wrap = split_into_lines +ij_java_class_brace_style = next_line +ij_java_class_count_to_use_import_on_demand = 9999 +ij_java_class_names_in_javadoc = 1 +ij_java_do_not_indent_top_level_class_members = false +ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_while_brace_force = never +ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = false +ij_java_doc_add_blank_line_after_return = false +ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_align_exception_comments = true +ij_java_doc_align_param_comments = true +ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_enable_formatting = true +ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = false +ij_java_doc_keep_empty_lines = true +ij_java_doc_keep_empty_parameter_tag = true +ij_java_doc_keep_empty_return_tag = true +ij_java_doc_keep_empty_throws_tag = true +ij_java_doc_keep_invalid_tags = true +ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = false +ij_java_doc_use_throws_not_exception_tag = true +ij_java_else_on_new_line = true +ij_java_entity_dd_suffix = EJB +ij_java_entity_eb_suffix = Bean +ij_java_entity_hi_suffix = Home +ij_java_entity_lhi_prefix = Local +ij_java_entity_lhi_suffix = Home +ij_java_entity_li_prefix = Local +ij_java_entity_pk_class = java.lang.String +ij_java_entity_vo_suffix = VO +ij_java_enum_constants_wrap = off +ij_java_extends_keyword_wrap = off +ij_java_extends_list_wrap = off +ij_java_field_annotation_wrap = split_into_lines +ij_java_finally_on_new_line = false +ij_java_for_brace_force = never +ij_java_for_statement_new_line_after_left_paren = false +ij_java_for_statement_right_paren_on_new_line = false +ij_java_for_statement_wrap = off +ij_java_generate_final_locals = true +ij_java_generate_final_parameters = true +ij_java_if_brace_force = never +ij_java_imports_layout = $*, |, java.**, |, javax.**, |, org.**, |, * +ij_java_indent_case_from_switch = true +ij_java_insert_inner_class_imports = false +ij_java_insert_override_annotation = true +ij_java_keep_blank_lines_before_right_brace = 2 +ij_java_keep_blank_lines_between_package_declaration_and_header = 2 +ij_java_keep_blank_lines_in_code = 2 +ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_control_statement_in_one_line = true +ij_java_keep_first_column_comment = false +ij_java_keep_indents_on_empty_lines = false +ij_java_keep_line_breaks = true +ij_java_keep_multiple_expressions_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false +ij_java_label_indent_absolute = false +ij_java_label_indent_size = 0 +ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +ij_java_line_comment_add_space = false +ij_java_line_comment_at_first_column = true +ij_java_message_dd_suffix = EJB +ij_java_message_eb_suffix = Bean +ij_java_method_annotation_wrap = split_into_lines +ij_java_method_brace_style = next_line +ij_java_method_call_chain_wrap = off +ij_java_method_parameters_new_line_after_left_paren = false +ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = off +ij_java_modifier_list_wrap = false +ij_java_names_count_to_use_import_on_demand = 9999 +ij_java_new_line_after_lparen_in_record_header = false +ij_java_packages_to_use_import_on_demand = java.awt.*, javax.swing.* +ij_java_parameter_annotation_wrap = off +ij_java_parentheses_expression_new_line_after_left_paren = false +ij_java_parentheses_expression_right_paren_on_new_line = false +ij_java_place_assignment_sign_on_next_line = false +ij_java_prefer_longer_names = true +ij_java_prefer_parameters_wrap = false +ij_java_record_components_wrap = normal +ij_java_repeat_synchronized = true +ij_java_replace_instanceof_and_cast = false +ij_java_replace_null_check = true +ij_java_replace_sum_lambda_with_method_ref = true +ij_java_resource_list_new_line_after_left_paren = false +ij_java_resource_list_right_paren_on_new_line = false +ij_java_resource_list_wrap = off +ij_java_rparen_on_new_line_in_record_header = false +ij_java_session_dd_suffix = EJB +ij_java_session_eb_suffix = Bean +ij_java_session_hi_suffix = Home +ij_java_session_lhi_prefix = Local +ij_java_session_lhi_suffix = Home +ij_java_session_li_prefix = Local +ij_java_session_si_suffix = Service +ij_java_space_after_closing_angle_bracket_in_type_argument = false +ij_java_space_after_colon = true +ij_java_space_after_comma = true +ij_java_space_after_comma_in_type_arguments = true +ij_java_space_after_for_semicolon = true +ij_java_space_after_quest = true +ij_java_space_after_type_cast = true +ij_java_space_before_annotation_array_initializer_left_brace = false +ij_java_space_before_annotation_parameter_list = false +ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_catch_keyword = true +ij_java_space_before_catch_left_brace = true +ij_java_space_before_catch_parentheses = true +ij_java_space_before_class_left_brace = true +ij_java_space_before_colon = true +ij_java_space_before_colon_in_foreach = true +ij_java_space_before_comma = false +ij_java_space_before_do_left_brace = true +ij_java_space_before_else_keyword = true +ij_java_space_before_else_left_brace = true +ij_java_space_before_finally_keyword = true +ij_java_space_before_finally_left_brace = true +ij_java_space_before_for_left_brace = true +ij_java_space_before_for_parentheses = true +ij_java_space_before_for_semicolon = false +ij_java_space_before_if_left_brace = true +ij_java_space_before_if_parentheses = true +ij_java_space_before_method_call_parentheses = false +ij_java_space_before_method_left_brace = true +ij_java_space_before_method_parentheses = false +ij_java_space_before_opening_angle_bracket_in_type_parameter = false +ij_java_space_before_quest = true +ij_java_space_before_switch_left_brace = true +ij_java_space_before_switch_parentheses = true +ij_java_space_before_synchronized_left_brace = true +ij_java_space_before_synchronized_parentheses = true +ij_java_space_before_try_left_brace = true +ij_java_space_before_try_parentheses = true +ij_java_space_before_type_parameter_list = false +ij_java_space_before_while_keyword = true +ij_java_space_before_while_left_brace = true +ij_java_space_before_while_parentheses = true +ij_java_space_inside_one_line_enum_braces = false +ij_java_space_within_empty_array_initializer_braces = false +ij_java_space_within_empty_method_call_parentheses = false +ij_java_space_within_empty_method_parentheses = false +ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_assignment_operators = true +ij_java_spaces_around_bitwise_operators = true +ij_java_spaces_around_equality_operators = true +ij_java_spaces_around_lambda_arrow = true +ij_java_spaces_around_logical_operators = true +ij_java_spaces_around_method_ref_dbl_colon = false +ij_java_spaces_around_multiplicative_operators = true +ij_java_spaces_around_relational_operators = true +ij_java_spaces_around_shift_operators = true +ij_java_spaces_around_type_bounds_in_type_parameters = true +ij_java_spaces_around_unary_operator = false +ij_java_spaces_within_angle_brackets = false +ij_java_spaces_within_annotation_parentheses = false +ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_braces = false +ij_java_spaces_within_brackets = false +ij_java_spaces_within_cast_parentheses = false +ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_for_parentheses = false +ij_java_spaces_within_if_parentheses = false +ij_java_spaces_within_method_call_parentheses = false +ij_java_spaces_within_method_parentheses = false +ij_java_spaces_within_parentheses = false +ij_java_spaces_within_record_header = false +ij_java_spaces_within_switch_parentheses = false +ij_java_spaces_within_synchronized_parentheses = false +ij_java_spaces_within_try_parentheses = false +ij_java_spaces_within_while_parentheses = false +ij_java_special_else_if_treatment = true +ij_java_subclass_name_suffix = Impl +ij_java_ternary_operation_signs_on_next_line = false +ij_java_ternary_operation_wrap = off +ij_java_test_name_suffix = Test +ij_java_throws_keyword_wrap = off +ij_java_throws_list_wrap = off +ij_java_use_external_annotations = false +ij_java_use_fq_class_names = false +ij_java_use_relative_indents = false +ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = off +ij_java_visibility = public +ij_java_while_brace_force = never +ij_java_while_on_new_line = false +ij_java_wrap_comments = false +ij_java_wrap_first_method_in_call_chain = false +ij_java_wrap_long_lines = false + +[*.less] +indent_size = 2 +ij_less_align_closing_brace_with_properties = false +ij_less_blank_lines_around_nested_selector = 1 +ij_less_blank_lines_between_blocks = 1 +ij_less_brace_placement = 0 +ij_less_enforce_quotes_on_format = false +ij_less_hex_color_long_format = false +ij_less_hex_color_lower_case = false +ij_less_hex_color_short_format = false +ij_less_hex_color_upper_case = false +ij_less_keep_blank_lines_in_code = 2 +ij_less_keep_indents_on_empty_lines = false +ij_less_keep_single_line_blocks = false +ij_less_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_less_space_after_colon = true +ij_less_space_before_opening_brace = true +ij_less_use_double_quotes = true +ij_less_value_alignment = 0 + +[*.sass] +indent_size = 2 +ij_sass_align_closing_brace_with_properties = false +ij_sass_blank_lines_around_nested_selector = 1 +ij_sass_blank_lines_between_blocks = 1 +ij_sass_brace_placement = 0 +ij_sass_enforce_quotes_on_format = false +ij_sass_hex_color_long_format = false +ij_sass_hex_color_lower_case = false +ij_sass_hex_color_short_format = false +ij_sass_hex_color_upper_case = false +ij_sass_keep_blank_lines_in_code = 2 +ij_sass_keep_indents_on_empty_lines = false +ij_sass_keep_single_line_blocks = false +ij_sass_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_sass_space_after_colon = true +ij_sass_space_before_opening_brace = true +ij_sass_use_double_quotes = true +ij_sass_value_alignment = 0 + +[*.scss] +indent_size = 2 +ij_scss_align_closing_brace_with_properties = false +ij_scss_blank_lines_around_nested_selector = 1 +ij_scss_blank_lines_between_blocks = 1 +ij_scss_brace_placement = 0 +ij_scss_enforce_quotes_on_format = false +ij_scss_hex_color_long_format = false +ij_scss_hex_color_lower_case = false +ij_scss_hex_color_short_format = false +ij_scss_hex_color_upper_case = false +ij_scss_keep_blank_lines_in_code = 2 +ij_scss_keep_indents_on_empty_lines = false +ij_scss_keep_single_line_blocks = false +ij_scss_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_scss_space_after_colon = true +ij_scss_space_before_opening_brace = true +ij_scss_use_double_quotes = true +ij_scss_value_alignment = 0 + +[*.styl] +indent_size = 2 +ij_stylus_align_closing_brace_with_properties = false +ij_stylus_blank_lines_around_nested_selector = 1 +ij_stylus_blank_lines_between_blocks = 1 +ij_stylus_brace_placement = 0 +ij_stylus_enforce_quotes_on_format = false +ij_stylus_hex_color_long_format = false +ij_stylus_hex_color_lower_case = false +ij_stylus_hex_color_short_format = false +ij_stylus_hex_color_upper_case = false +ij_stylus_keep_blank_lines_in_code = 2 +ij_stylus_keep_indents_on_empty_lines = false +ij_stylus_keep_single_line_blocks = false +ij_stylus_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_stylus_space_after_colon = true +ij_stylus_space_before_opening_brace = true +ij_stylus_use_double_quotes = true +ij_stylus_value_alignment = 0 + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ant, *.fxml, *.jhm, *.jnlp, *.jrxml, *.pom, *.rng, *.tld, *.wadl, *.wsdd, *.wsdl, *.xjb, *.xml, *.xsd, *.xsl, *.xslt, *.xul}] +ij_xml_align_attributes = true +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = true +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = false +ij_xml_text_wrap = normal +ij_xml_use_custom_settings = false + +[{*.ats, *.ts}] +ij_continuation_indent_size = 4 +ij_typescript_align_imports = false +ij_typescript_align_multiline_array_initializer_expression = false +ij_typescript_align_multiline_binary_operation = false +ij_typescript_align_multiline_chained_methods = false +ij_typescript_align_multiline_extends_list = false +ij_typescript_align_multiline_for = true +ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters_in_calls = false +ij_typescript_align_multiline_ternary_operation = false +ij_typescript_align_object_properties = 0 +ij_typescript_align_union_types = false +ij_typescript_align_var_statements = 0 +ij_typescript_array_initializer_new_line_after_left_brace = false +ij_typescript_array_initializer_right_brace_on_new_line = false +ij_typescript_array_initializer_wrap = off +ij_typescript_assignment_wrap = off +ij_typescript_binary_operation_sign_on_next_line = false +ij_typescript_binary_operation_wrap = off +ij_typescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_typescript_blank_lines_after_imports = 1 +ij_typescript_blank_lines_around_class = 1 +ij_typescript_blank_lines_around_field = 0 +ij_typescript_blank_lines_around_field_in_interface = 0 +ij_typescript_blank_lines_around_function = 1 +ij_typescript_blank_lines_around_method = 1 +ij_typescript_blank_lines_around_method_in_interface = 1 +ij_typescript_block_brace_style = end_of_line +ij_typescript_call_parameters_new_line_after_left_paren = false +ij_typescript_call_parameters_right_paren_on_new_line = false +ij_typescript_call_parameters_wrap = off +ij_typescript_catch_on_new_line = false +ij_typescript_chained_call_dot_on_new_line = true +ij_typescript_class_brace_style = end_of_line +ij_typescript_comma_on_new_line = false +ij_typescript_do_while_brace_force = never +ij_typescript_else_on_new_line = false +ij_typescript_enforce_trailing_comma = keep +ij_typescript_extends_keyword_wrap = off +ij_typescript_extends_list_wrap = off +ij_typescript_field_prefix = _ +ij_typescript_file_name_style = relaxed +ij_typescript_finally_on_new_line = false +ij_typescript_for_brace_force = never +ij_typescript_for_statement_new_line_after_left_paren = false +ij_typescript_for_statement_right_paren_on_new_line = false +ij_typescript_for_statement_wrap = off +ij_typescript_force_quote_style = false +ij_typescript_force_semicolon_style = false +ij_typescript_function_expression_brace_style = end_of_line +ij_typescript_if_brace_force = never +ij_typescript_import_merge_members = global +ij_typescript_import_prefer_absolute_path = global +ij_typescript_import_sort_members = true +ij_typescript_import_sort_module_name = false +ij_typescript_import_use_node_resolution = true +ij_typescript_imports_wrap = on_every_item +ij_typescript_indent_case_from_switch = true +ij_typescript_indent_chained_calls = true +ij_typescript_indent_package_children = 0 +ij_typescript_jsdoc_include_types = false +ij_typescript_jsx_attribute_value = braces +ij_typescript_keep_blank_lines_in_code = 2 +ij_typescript_keep_first_column_comment = true +ij_typescript_keep_indents_on_empty_lines = false +ij_typescript_keep_line_breaks = true +ij_typescript_keep_simple_blocks_in_one_line = false +ij_typescript_keep_simple_methods_in_one_line = false +ij_typescript_line_comment_add_space = true +ij_typescript_line_comment_at_first_column = false +ij_typescript_method_brace_style = end_of_line +ij_typescript_method_call_chain_wrap = off +ij_typescript_method_parameters_new_line_after_left_paren = false +ij_typescript_method_parameters_right_paren_on_new_line = false +ij_typescript_method_parameters_wrap = off +ij_typescript_object_literal_wrap = on_every_item +ij_typescript_parentheses_expression_new_line_after_left_paren = false +ij_typescript_parentheses_expression_right_paren_on_new_line = false +ij_typescript_place_assignment_sign_on_next_line = false +ij_typescript_prefer_as_type_cast = false +ij_typescript_prefer_explicit_types_function_expression_returns = false +ij_typescript_prefer_explicit_types_function_returns = false +ij_typescript_prefer_explicit_types_vars_fields = false +ij_typescript_prefer_parameters_wrap = false +ij_typescript_reformat_c_style_comments = false +ij_typescript_space_after_colon = true +ij_typescript_space_after_comma = true +ij_typescript_space_after_dots_in_rest_parameter = false +ij_typescript_space_after_generator_mult = true +ij_typescript_space_after_property_colon = true +ij_typescript_space_after_quest = true +ij_typescript_space_after_type_colon = true +ij_typescript_space_after_unary_not = false +ij_typescript_space_before_async_arrow_lparen = true +ij_typescript_space_before_catch_keyword = true +ij_typescript_space_before_catch_left_brace = true +ij_typescript_space_before_catch_parentheses = true +ij_typescript_space_before_class_lbrace = true +ij_typescript_space_before_class_left_brace = true +ij_typescript_space_before_colon = true +ij_typescript_space_before_comma = false +ij_typescript_space_before_do_left_brace = true +ij_typescript_space_before_else_keyword = true +ij_typescript_space_before_else_left_brace = true +ij_typescript_space_before_finally_keyword = true +ij_typescript_space_before_finally_left_brace = true +ij_typescript_space_before_for_left_brace = true +ij_typescript_space_before_for_parentheses = true +ij_typescript_space_before_for_semicolon = false +ij_typescript_space_before_function_left_parenth = true +ij_typescript_space_before_generator_mult = false +ij_typescript_space_before_if_left_brace = true +ij_typescript_space_before_if_parentheses = true +ij_typescript_space_before_method_call_parentheses = false +ij_typescript_space_before_method_left_brace = true +ij_typescript_space_before_method_parentheses = false +ij_typescript_space_before_property_colon = false +ij_typescript_space_before_quest = true +ij_typescript_space_before_switch_left_brace = true +ij_typescript_space_before_switch_parentheses = true +ij_typescript_space_before_try_left_brace = true +ij_typescript_space_before_type_colon = false +ij_typescript_space_before_unary_not = false +ij_typescript_space_before_while_keyword = true +ij_typescript_space_before_while_left_brace = true +ij_typescript_space_before_while_parentheses = true +ij_typescript_spaces_around_additive_operators = true +ij_typescript_spaces_around_arrow_function_operator = true +ij_typescript_spaces_around_assignment_operators = true +ij_typescript_spaces_around_bitwise_operators = true +ij_typescript_spaces_around_equality_operators = true +ij_typescript_spaces_around_logical_operators = true +ij_typescript_spaces_around_multiplicative_operators = true +ij_typescript_spaces_around_relational_operators = true +ij_typescript_spaces_around_shift_operators = true +ij_typescript_spaces_around_unary_operator = false +ij_typescript_spaces_within_array_initializer_brackets = false +ij_typescript_spaces_within_brackets = false +ij_typescript_spaces_within_catch_parentheses = false +ij_typescript_spaces_within_for_parentheses = false +ij_typescript_spaces_within_if_parentheses = false +ij_typescript_spaces_within_imports = false +ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_method_call_parentheses = false +ij_typescript_spaces_within_method_parentheses = false +ij_typescript_spaces_within_object_literal_braces = false +ij_typescript_spaces_within_object_type_braces = true +ij_typescript_spaces_within_parentheses = false +ij_typescript_spaces_within_switch_parentheses = false +ij_typescript_spaces_within_type_assertion = false +ij_typescript_spaces_within_union_types = true +ij_typescript_spaces_within_while_parentheses = false +ij_typescript_special_else_if_treatment = true +ij_typescript_ternary_operation_signs_on_next_line = false +ij_typescript_ternary_operation_wrap = off +ij_typescript_union_types_wrap = on_every_item +ij_typescript_use_chained_calls_group_indents = false +ij_typescript_use_double_quotes = true +ij_typescript_use_explicit_js_extension = global +ij_typescript_use_path_mapping = always +ij_typescript_use_public_modifier = false +ij_typescript_use_semicolon_after_statement = true +ij_typescript_var_declaration_wrap = normal +ij_typescript_while_brace_force = never +ij_typescript_while_on_new_line = false +ij_typescript_wrap_comments = false + +[{*.bash, *.sh, *.zsh}] +indent_size = 2 +tab_width = 2 +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false + +[{*.cjs, *.js}] +ij_continuation_indent_size = 4 +ij_javascript_align_imports = false +ij_javascript_align_multiline_array_initializer_expression = false +ij_javascript_align_multiline_binary_operation = false +ij_javascript_align_multiline_chained_methods = false +ij_javascript_align_multiline_extends_list = false +ij_javascript_align_multiline_for = true +ij_javascript_align_multiline_parameters = true +ij_javascript_align_multiline_parameters_in_calls = false +ij_javascript_align_multiline_ternary_operation = false +ij_javascript_align_object_properties = 0 +ij_javascript_align_union_types = false +ij_javascript_align_var_statements = 0 +ij_javascript_array_initializer_new_line_after_left_brace = false +ij_javascript_array_initializer_right_brace_on_new_line = false +ij_javascript_array_initializer_wrap = off +ij_javascript_assignment_wrap = off +ij_javascript_binary_operation_sign_on_next_line = false +ij_javascript_binary_operation_wrap = off +ij_javascript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_javascript_blank_lines_after_imports = 1 +ij_javascript_blank_lines_around_class = 1 +ij_javascript_blank_lines_around_field = 0 +ij_javascript_blank_lines_around_function = 1 +ij_javascript_blank_lines_around_method = 1 +ij_javascript_block_brace_style = end_of_line +ij_javascript_call_parameters_new_line_after_left_paren = false +ij_javascript_call_parameters_right_paren_on_new_line = false +ij_javascript_call_parameters_wrap = off +ij_javascript_catch_on_new_line = false +ij_javascript_chained_call_dot_on_new_line = true +ij_javascript_class_brace_style = end_of_line +ij_javascript_comma_on_new_line = false +ij_javascript_do_while_brace_force = never +ij_javascript_else_on_new_line = false +ij_javascript_enforce_trailing_comma = keep +ij_javascript_extends_keyword_wrap = off +ij_javascript_extends_list_wrap = off +ij_javascript_field_prefix = _ +ij_javascript_file_name_style = relaxed +ij_javascript_finally_on_new_line = false +ij_javascript_for_brace_force = never +ij_javascript_for_statement_new_line_after_left_paren = false +ij_javascript_for_statement_right_paren_on_new_line = false +ij_javascript_for_statement_wrap = off +ij_javascript_force_quote_style = false +ij_javascript_force_semicolon_style = false +ij_javascript_function_expression_brace_style = end_of_line +ij_javascript_if_brace_force = never +ij_javascript_import_merge_members = global +ij_javascript_import_prefer_absolute_path = global +ij_javascript_import_sort_members = true +ij_javascript_import_sort_module_name = false +ij_javascript_import_use_node_resolution = true +ij_javascript_imports_wrap = on_every_item +ij_javascript_indent_case_from_switch = true +ij_javascript_indent_chained_calls = true +ij_javascript_indent_package_children = 0 +ij_javascript_jsx_attribute_value = braces +ij_javascript_keep_blank_lines_in_code = 2 +ij_javascript_keep_first_column_comment = true +ij_javascript_keep_indents_on_empty_lines = false +ij_javascript_keep_line_breaks = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false +ij_javascript_line_comment_add_space = true +ij_javascript_line_comment_at_first_column = false +ij_javascript_method_brace_style = end_of_line +ij_javascript_method_call_chain_wrap = off +ij_javascript_method_parameters_new_line_after_left_paren = false +ij_javascript_method_parameters_right_paren_on_new_line = false +ij_javascript_method_parameters_wrap = off +ij_javascript_object_literal_wrap = on_every_item +ij_javascript_parentheses_expression_new_line_after_left_paren = false +ij_javascript_parentheses_expression_right_paren_on_new_line = false +ij_javascript_place_assignment_sign_on_next_line = false +ij_javascript_prefer_as_type_cast = false +ij_javascript_prefer_explicit_types_function_expression_returns = false +ij_javascript_prefer_explicit_types_function_returns = false +ij_javascript_prefer_explicit_types_vars_fields = false +ij_javascript_prefer_parameters_wrap = false +ij_javascript_reformat_c_style_comments = false +ij_javascript_space_after_colon = true +ij_javascript_space_after_comma = true +ij_javascript_space_after_dots_in_rest_parameter = false +ij_javascript_space_after_generator_mult = true +ij_javascript_space_after_property_colon = true +ij_javascript_space_after_quest = true +ij_javascript_space_after_type_colon = true +ij_javascript_space_after_unary_not = false +ij_javascript_space_before_async_arrow_lparen = true +ij_javascript_space_before_catch_keyword = true +ij_javascript_space_before_catch_left_brace = true +ij_javascript_space_before_catch_parentheses = true +ij_javascript_space_before_class_lbrace = true +ij_javascript_space_before_class_left_brace = true +ij_javascript_space_before_colon = true +ij_javascript_space_before_comma = false +ij_javascript_space_before_do_left_brace = true +ij_javascript_space_before_else_keyword = true +ij_javascript_space_before_else_left_brace = true +ij_javascript_space_before_finally_keyword = true +ij_javascript_space_before_finally_left_brace = true +ij_javascript_space_before_for_left_brace = true +ij_javascript_space_before_for_parentheses = true +ij_javascript_space_before_for_semicolon = false +ij_javascript_space_before_function_left_parenth = true +ij_javascript_space_before_generator_mult = false +ij_javascript_space_before_if_left_brace = true +ij_javascript_space_before_if_parentheses = true +ij_javascript_space_before_method_call_parentheses = false +ij_javascript_space_before_method_left_brace = true +ij_javascript_space_before_method_parentheses = false +ij_javascript_space_before_property_colon = false +ij_javascript_space_before_quest = true +ij_javascript_space_before_switch_left_brace = true +ij_javascript_space_before_switch_parentheses = true +ij_javascript_space_before_try_left_brace = true +ij_javascript_space_before_type_colon = false +ij_javascript_space_before_unary_not = false +ij_javascript_space_before_while_keyword = true +ij_javascript_space_before_while_left_brace = true +ij_javascript_space_before_while_parentheses = true +ij_javascript_spaces_around_additive_operators = true +ij_javascript_spaces_around_arrow_function_operator = true +ij_javascript_spaces_around_assignment_operators = true +ij_javascript_spaces_around_bitwise_operators = true +ij_javascript_spaces_around_equality_operators = true +ij_javascript_spaces_around_logical_operators = true +ij_javascript_spaces_around_multiplicative_operators = true +ij_javascript_spaces_around_relational_operators = true +ij_javascript_spaces_around_shift_operators = true +ij_javascript_spaces_around_unary_operator = false +ij_javascript_spaces_within_array_initializer_brackets = false +ij_javascript_spaces_within_brackets = false +ij_javascript_spaces_within_catch_parentheses = false +ij_javascript_spaces_within_for_parentheses = false +ij_javascript_spaces_within_if_parentheses = false +ij_javascript_spaces_within_imports = false +ij_javascript_spaces_within_interpolation_expressions = false +ij_javascript_spaces_within_method_call_parentheses = false +ij_javascript_spaces_within_method_parentheses = false +ij_javascript_spaces_within_object_literal_braces = false +ij_javascript_spaces_within_object_type_braces = true +ij_javascript_spaces_within_parentheses = false +ij_javascript_spaces_within_switch_parentheses = false +ij_javascript_spaces_within_type_assertion = false +ij_javascript_spaces_within_union_types = true +ij_javascript_spaces_within_while_parentheses = false +ij_javascript_special_else_if_treatment = true +ij_javascript_ternary_operation_signs_on_next_line = false +ij_javascript_ternary_operation_wrap = off +ij_javascript_union_types_wrap = on_every_item +ij_javascript_use_chained_calls_group_indents = false +ij_javascript_use_double_quotes = true +ij_javascript_use_explicit_js_extension = global +ij_javascript_use_path_mapping = always +ij_javascript_use_public_modifier = false +ij_javascript_use_semicolon_after_statement = true +ij_javascript_var_declaration_wrap = normal +ij_javascript_while_brace_force = never +ij_javascript_while_on_new_line = false +ij_javascript_wrap_comments = false + +[{*.cjsx, *.coffee}] +indent_size = 2 +tab_width = 2 +ij_continuation_indent_size = 2 +ij_coffeescript_align_function_body = false +ij_coffeescript_align_imports = false +ij_coffeescript_align_multiline_array_initializer_expression = true +ij_coffeescript_align_multiline_parameters = true +ij_coffeescript_align_multiline_parameters_in_calls = false +ij_coffeescript_align_object_properties = 0 +ij_coffeescript_align_union_types = false +ij_coffeescript_align_var_statements = 0 +ij_coffeescript_array_initializer_new_line_after_left_brace = false +ij_coffeescript_array_initializer_right_brace_on_new_line = false +ij_coffeescript_array_initializer_wrap = normal +ij_coffeescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_coffeescript_blank_lines_around_function = 1 +ij_coffeescript_call_parameters_new_line_after_left_paren = false +ij_coffeescript_call_parameters_right_paren_on_new_line = false +ij_coffeescript_call_parameters_wrap = normal +ij_coffeescript_chained_call_dot_on_new_line = true +ij_coffeescript_comma_on_new_line = false +ij_coffeescript_enforce_trailing_comma = keep +ij_coffeescript_field_prefix = _ +ij_coffeescript_file_name_style = relaxed +ij_coffeescript_force_quote_style = false +ij_coffeescript_force_semicolon_style = false +ij_coffeescript_function_expression_brace_style = end_of_line +ij_coffeescript_import_merge_members = global +ij_coffeescript_import_prefer_absolute_path = global +ij_coffeescript_import_sort_members = true +ij_coffeescript_import_sort_module_name = false +ij_coffeescript_import_use_node_resolution = true +ij_coffeescript_imports_wrap = on_every_item +ij_coffeescript_indent_chained_calls = true +ij_coffeescript_indent_package_children = 0 +ij_coffeescript_jsx_attribute_value = braces +ij_coffeescript_keep_blank_lines_in_code = 2 +ij_coffeescript_keep_first_column_comment = true +ij_coffeescript_keep_indents_on_empty_lines = false +ij_coffeescript_keep_line_breaks = true +ij_coffeescript_keep_simple_methods_in_one_line = false +ij_coffeescript_method_parameters_new_line_after_left_paren = false +ij_coffeescript_method_parameters_right_paren_on_new_line = false +ij_coffeescript_method_parameters_wrap = off +ij_coffeescript_object_literal_wrap = on_every_item +ij_coffeescript_prefer_as_type_cast = false +ij_coffeescript_prefer_explicit_types_function_expression_returns = false +ij_coffeescript_prefer_explicit_types_function_returns = false +ij_coffeescript_prefer_explicit_types_vars_fields = false +ij_coffeescript_reformat_c_style_comments = false +ij_coffeescript_space_after_comma = true +ij_coffeescript_space_after_dots_in_rest_parameter = false +ij_coffeescript_space_after_generator_mult = true +ij_coffeescript_space_after_property_colon = true +ij_coffeescript_space_after_type_colon = true +ij_coffeescript_space_after_unary_not = false +ij_coffeescript_space_before_async_arrow_lparen = true +ij_coffeescript_space_before_class_lbrace = true +ij_coffeescript_space_before_comma = false +ij_coffeescript_space_before_function_left_parenth = true +ij_coffeescript_space_before_generator_mult = false +ij_coffeescript_space_before_property_colon = false +ij_coffeescript_space_before_type_colon = false +ij_coffeescript_space_before_unary_not = false +ij_coffeescript_spaces_around_additive_operators = true +ij_coffeescript_spaces_around_arrow_function_operator = true +ij_coffeescript_spaces_around_assignment_operators = true +ij_coffeescript_spaces_around_bitwise_operators = true +ij_coffeescript_spaces_around_equality_operators = true +ij_coffeescript_spaces_around_logical_operators = true +ij_coffeescript_spaces_around_multiplicative_operators = true +ij_coffeescript_spaces_around_relational_operators = true +ij_coffeescript_spaces_around_shift_operators = true +ij_coffeescript_spaces_around_unary_operator = false +ij_coffeescript_spaces_within_array_initializer_braces = false +ij_coffeescript_spaces_within_array_initializer_brackets = false +ij_coffeescript_spaces_within_imports = false +ij_coffeescript_spaces_within_index_brackets = false +ij_coffeescript_spaces_within_interpolation_expressions = false +ij_coffeescript_spaces_within_method_call_parentheses = false +ij_coffeescript_spaces_within_method_parentheses = false +ij_coffeescript_spaces_within_object_braces = false +ij_coffeescript_spaces_within_object_literal_braces = false +ij_coffeescript_spaces_within_object_type_braces = true +ij_coffeescript_spaces_within_range_brackets = false +ij_coffeescript_spaces_within_type_assertion = false +ij_coffeescript_spaces_within_union_types = true +ij_coffeescript_union_types_wrap = on_every_item +ij_coffeescript_use_chained_calls_group_indents = false +ij_coffeescript_use_double_quotes = true +ij_coffeescript_use_explicit_js_extension = global +ij_coffeescript_use_path_mapping = always +ij_coffeescript_use_public_modifier = false +ij_coffeescript_use_semicolon_after_statement = false +ij_coffeescript_var_declaration_wrap = normal + +[{*.ft, *.vm, *.vsl}] +ij_vtl_keep_indents_on_empty_lines = false + +[{*.gant, *.gradle, *.groovy, *.gson, *.gy}] +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *, |, javax.**, java.**, |, $* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_long_lines = false + +[{*.gradle.kts, *.kt, *.kts, *.main.kts}] +ij_kotlin_align_in_columns_case_branch = false +ij_kotlin_align_multiline_binary_operation = false +ij_kotlin_align_multiline_extends_list = false +ij_kotlin_align_multiline_method_parentheses = false +ij_kotlin_align_multiline_parameters = true +ij_kotlin_align_multiline_parameters_in_calls = false +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_assignment_wrap = off +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = false +ij_kotlin_call_parameters_right_paren_on_new_line = false +ij_kotlin_call_parameters_wrap = off +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = split_into_lines +ij_kotlin_continuation_indent_for_chained_calls = true +ij_kotlin_continuation_indent_for_expression_bodies = true +ij_kotlin_continuation_indent_in_argument_lists = true +ij_kotlin_continuation_indent_in_elvis = true +ij_kotlin_continuation_indent_in_if_conditions = true +ij_kotlin_continuation_indent_in_parameter_lists = true +ij_kotlin_continuation_indent_in_supertype_lists = true +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = off +ij_kotlin_field_annotation_wrap = split_into_lines +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = false +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 2 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_comment_add_space = false +ij_kotlin_line_comment_at_first_column = true +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = off +ij_kotlin_method_parameters_new_line_after_left_paren = false +ij_kotlin_method_parameters_right_paren_on_new_line = false +ij_kotlin_method_parameters_wrap = off +ij_kotlin_name_count_to_use_star_import = 5 +ij_kotlin_name_count_to_use_star_import_for_members = 3 +ij_kotlin_packages_to_use_import_on_demand = java.util.*, kotlinx.android.synthetic.**, io.ktor.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 0 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.har, *.jsb2, *.jsb3, *.json, .babelrc, .eslintrc, .stylelintrc, bowerrc, jest.config}] +indent_size = 2 +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = true +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.htm, *.html, *.ng, *.sht, *.shtm, *.shtml}] +ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p +ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span, pre, textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal +ij_html_uniform_ident = false + +[{*.jsf, *.jsp, *.jspf, *.tag, *.tagf, *.xjsp}] +ij_jsp_jsp_prefer_comma_separated_import_list = false +ij_jsp_keep_indents_on_empty_lines = false + +[{*.jspx, *.tagx}] +ij_jspx_keep_indents_on_empty_lines = false + +[{*.markdown, *.md}] +ij_markdown_force_one_space_after_blockquote_symbol = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 1 +ij_markdown_min_lines_between_paragraphs = 1 + +[{*.properties, spring.handlers, spring.schemas}] +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + +[{*.yaml, *.yml}] +indent_size = 2 +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true \ No newline at end of file diff --git a/README.md b/README.md index 1ede6b7..79823d6 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,21 @@ # Internet Time Utility + [![Maven Central](https://img.shields.io/maven-central/v/com.ethlo.time/itu.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.ethlo.time%22%20a%3A%22itu%22) [![Hex.pm](https://img.shields.io/hexpm/l/plug.svg)](LICENSE) -[![Coverage Status](https://coveralls.io/repos/github/ethlo/itu/badge.svg?branch=master&kill_cache=1)](https://coveralls.io/github/ethlo/itu?branch=master)[![Build Status](https://travis-ci.org/ethlo/itu.svg?branch=master)](https://travis-ci.org/ethlo/itu) +[![Coverage Status](https://coveralls.io/repos/github/ethlo/itu/badge.svg?branch=master&kill_cache=1)](https://coveralls.io/github/ethlo/itu?branch=master)[![Build +Status](https://travis-ci.org/ethlo/itu.svg?branch=master)](https://travis-ci.org/ethlo/itu) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/598913bc1fe9405c82be73d9a4f105c8)](https://www.codacy.com/app/ethlo/itu?utm_source=github.com&utm_medium=referral&utm_content=ethlo/itu&utm_campaign=Badge_Grade) An extremely fast parser and formatter of standardized date-times. -> Date and time formats cause a lot of confusion and interoperability problems on the Internet. -This document addresses many of the problems encountered and makes recommendations to improve consistency and interoperability when representing and using date and time in Internet protocols. +> Date and time formats cause a lot of confusion and interoperability problems on the Internet. This document addresses many of the problems encountered and makes recommendations to improve consistency and interoperability when representing and using date and time in Internet protocols. -This project's goal it to do one thing and to do it right; make it easy to handle [Date and Time on the Internet: Timestamps](https://www.ietf.org/rfc/rfc3339.txt) and W3C [Date and Time Formats](https://www.w3.org/TR/NOTE-datetime) in Java. +This project's goal it to do one thing and to do it right; make it easy to +handle [Date and Time on the Internet: Timestamps](https://www.ietf.org/rfc/rfc3339.txt) and +W3C [Date and Time Formats](https://www.w3.org/TR/NOTE-datetime) in Java. ## Features + * No external dependencies, minimalistic JAR * Apache license * Configurable validator, formatter and parser within the boundaries of the specification @@ -20,18 +24,22 @@ This project's goal it to do one thing and to do it right; make it easy to handl * Very high performance ## Performance -Implementation | Parse | Format ----------------|---------:|-----------: -java.util (Java 7) * | 742 850 parse/sec | 1 837 811 format/sec -java.time (Java 8) | 545 333 parse/sec | 2 101 431 format/sec -Apache FastDateUtils * | 1 076 995 parse/sec | 1 989 163 format/sec -Internet Time Utility | 15 569 458 parse/sec | 12 726 932 format/sec -* Single hard-coded format. Lenient parsing would require multiple patterns to be attempted (4-6). +Performance plot + +| Implementation | Parse | Format | Round-trip | +-------------------|--------:|----------:|-----:| +| Google DateTime | 1,020 ns | Not supported | N/A +| JDK Java Time | 1,558 ns | 426 ns | 1,984 ns | +| Ethlo ITU | 88 ns |166 ns |254 ns| + -Your milage may vary. The tests are included in this repository. +Values in nano-seconds. Lower is better. + +Your mileage may vary. The tests are easy to run and are included in the repository. ## Example use + ```java // Parse a string final OffsetDateTime dateTime = ITU.parseDateTime("2012-12-27T19:07:22.123456789-03:00"); @@ -42,15 +50,18 @@ final String formatted = ITU.formatUtc(dateTime); // 2012-12-27T22:07:22Z // Format with microsecond precision final String formattedMicro = ITU.formatUtcMicro(dateTime); // 2012-12-27T22:07:22.123457Z ``` + ## Q & A *Why this little project?* -There are an endless amount of APIs with non-standard date/time exchange, and the goal of this project is to make it a no-brainer to do-the-right-thing(c). +There are an endless amount of APIs with non-standard date/time exchange, and the goal of this project is to make it a +no-brainer to do-the-right-thing(c). *Why the performance optimized version?* -Some projects use epoch time-stamps for date-time exchange, and from a performance perspective this *may* make sense in *some* cases. With this project one can do-the-right-thing and maintain performance in date-time handling. +Some projects use epoch time-stamps for date-time exchange, and from a performance perspective this *may* make sense +in *some* cases. With this project one can do-the-right-thing and maintain performance in date-time handling. *What is wrong with epoch timestamps?* @@ -59,9 +70,13 @@ Some projects use epoch time-stamps for date-time exchange, and from a performan * Unclear resolution and/or time-range ## What is RFC-3339? -[RFC-3339](https://www.ietf.org/rfc/rfc3339.txt) is a subset/profile defined by [W3C](https://www.w3.org/) of the formats defined in [ISO-8601](http://www.iso.org/iso/home/standards/iso8601.htm), to simplify date and time exhange in modern Internet protocols. -Typical formats include: +[RFC-3339](https://www.ietf.org/rfc/rfc3339.txt) is a subset/profile defined by [W3C](https://www.w3.org/) of the +formats defined in [ISO-8601](http://www.iso.org/iso/home/standards/iso8601.htm), to simplify date and time exhange in +modern Internet protocols. + +Typical formats include: + * `2017-12-27T23:45:32Z` - No fractional seconds, UTC/Zulu time * `2017-12-27T23:45:32.999Z` - Millisecond fractions, UTC/Zulu time * `2017-12-27T23:45:32.999999Z` - Microsecond fractions, UTC/Zulu time @@ -72,9 +87,12 @@ Typical formats include: * `2017-12-27T18:45:32.999999999-05:00` - Nanosecond fractions, EST time ## What is W3C - Date and Time Formats -[Date and Time Formats](https://www.w3.org/TR/NOTE-datetime) is a _note_, meaning it is not endorsed, but it still serves as a sane subset of ISO-8601, just like RFC-3339. -Typical formats include: +[Date and Time Formats](https://www.w3.org/TR/NOTE-datetime) is a _note_, meaning it is not endorsed, but it still +serves as a sane subset of ISO-8601, just like RFC-3339. + +Typical formats include: + * `2017-12-27T23:45Z` - Minute resolution, UTC/Zulu time * `2017-12-27` - Date only, no timezone (like someones birthday) * `2017-12` - Year and month only. Like an expiry date. @@ -82,14 +100,17 @@ Typical formats include: ## Limitations ### Local offset -For the sake of avoiding data integrity issues, this library will not allow offset of `-00:00`. -Such offset is described in RFC3339 section 4.3., named "Unknown Local Offset Convention". Such offset is explicitly prohibited in ISO-8601 as well. -> If the time in UTC is known, but the offset to local time is unknown, - this can be represented with an offset of "-00:00". This differs - semantically from an offset of "Z" or "+00:00", which imply that UTC - is the preferred reference point for the specified time. +For the sake of avoiding data integrity issues, this library will not allow offset of `-00:00`. Such offset is described +in RFC3339 section 4.3., named "Unknown Local Offset Convention". Such offset is explicitly prohibited in ISO-8601 as +well. + +> If the time in UTC is known, but the offset to local time is unknown, this can be represented with an offset of "-00:00". This differs semantically from an offset of "Z" or "+00:00", which imply that UTC is the preferred reference point for the specified time. ### Leap second parsing -Since Java's `java.time` classes do not support storing leap seconds, ITU will throw a `LeapSecondException` if one is encountered to signal that this is a leap second. The exception can then be queried for the second-value. Storing such values is not possible in a `java.time.OffsetDateTime`, the `60` is therefore abandoned and the date-time will use `59` instead of `60`. + +Since Java's `java.time` classes do not support storing leap seconds, ITU will throw a `LeapSecondException` if one is +encountered to signal that this is a leap second. The exception can then be queried for the second-value. Storing such +values is not possible in a `java.time.OffsetDateTime`, the `60` is therefore abandoned and the date-time will use `59` +instead of `60`. diff --git a/doc/performance.jpg b/doc/performance.jpg new file mode 100644 index 0000000..62a08f9 Binary files /dev/null and b/doc/performance.jpg differ diff --git a/pom.xml b/pom.xml index 54484fd..6090d86 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt + https://www.apache.org/licenses/LICENSE-2.0.txt repo @@ -18,26 +18,38 @@ Morten Haraldsen - http://ethlo.com + https://ethlo.com - junit - junit - 4.13.1 + org.apache.commons + commons-lang3 + 3.5 test - org.easytesting - fest-assert-core - 2.0M10 + org.junit.jupiter + junit-jupiter-engine + 5.8.2 test - org.apache.commons - commons-lang3 - 3.5 + org.assertj + assertj-core + 3.21.0 + test + + + com.ethlo.time + chronograph + 1.2.0 + test + + + com.google.http-client + google-http-client + 1.41.4 test @@ -49,7 +61,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19.1 + 3.0.0-M5 **/*CorrectnessTest.java @@ -64,7 +76,7 @@ maven-compiler-plugin - 3.6.1 + 3.8.1 1.8 1.8 @@ -74,7 +86,7 @@ org.jacoco jacoco-maven-plugin - 0.8.4 + 0.8.7 prepare-agent @@ -92,7 +104,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.19.1 + 3.0.0-M5 **/*BenchmarkTest.java @@ -102,7 +114,7 @@ org.apache.maven.plugins maven-source-plugin - 3.0.1 + 3.2.1 attach-sources @@ -115,7 +127,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.10.4 + 3.3.1 attach-javadocs @@ -131,12 +143,12 @@ org.codehaus.mojo versions-maven-plugin - 2.3 + 2.8.1 org.sonatype.plugins nexus-staging-maven-plugin - 1.6.5 + 1.6.8 true sonatype-nexus-staging @@ -147,7 +159,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.0.1 sign-artifacts @@ -164,7 +176,7 @@ org.codehaus.mojo license-maven-plugin - 1.12 + 2.0.0 false true @@ -204,7 +216,7 @@ org.apache.maven.wagon wagon-ssh - 2.12 + 3.4.3 @@ -212,11 +224,11 @@ sonatype-nexus-staging Nexus Release Repository - http://oss.sonatype.org/service/local/staging/deploy/maven2/ + https://oss.sonatype.org/service/local/staging/deploy/maven2/ - http://github.com:ethlo/itu + https://github.com:ethlo/itu scm:git:git@github.com:ethlo/itu.git scm:git:git@github.com:ethlo/itu.git diff --git a/src/main/java/com/ethlo/time/FastInternetDateTimeUtil.java b/src/main/java/com/ethlo/time/EthloITU.java similarity index 98% rename from src/main/java/com/ethlo/time/FastInternetDateTimeUtil.java rename to src/main/java/com/ethlo/time/EthloITU.java index 110583a..d4be14e 100644 --- a/src/main/java/com/ethlo/time/FastInternetDateTimeUtil.java +++ b/src/main/java/com/ethlo/time/EthloITU.java @@ -32,7 +32,7 @@ import java.util.Arrays; import java.util.Date; -public class FastInternetDateTimeUtil extends AbstractRfc3339 implements W3cDateTimeUtil +public class EthloITU extends AbstractRfc3339 implements W3cDateTimeUtil { public static final int LEAP_SECOND_SECONDS = 60; private static final char PLUS = '+'; @@ -46,7 +46,7 @@ public class FastInternetDateTimeUtil extends AbstractRfc3339 implements W3cDate private static final char ZULU_UPPER = 'Z'; private static final char ZULU_LOWER = 'z'; private static final int[] widths = new int[]{100_000_000, 10_000_000, 1_000_000, 100_000, 10_000, 1_000, 100, 10, 1}; - private final StdJdkInternetDateTimeUtil delegate = new StdJdkInternetDateTimeUtil(); + private final Java8Rfc3339 delegate = new Java8Rfc3339(); @Override public OffsetDateTime parseDateTime(String s) diff --git a/src/main/java/com/ethlo/time/ITU.java b/src/main/java/com/ethlo/time/ITU.java index b568f0b..86a8b43 100644 --- a/src/main/java/com/ethlo/time/ITU.java +++ b/src/main/java/com/ethlo/time/ITU.java @@ -31,7 +31,7 @@ public class ITU { - private static final FastInternetDateTimeUtil delegate = new FastInternetDateTimeUtil(); + private static final EthloITU delegate = new EthloITU(); private static final ZoneId GMT_ZONE = ZoneId.of("GMT"); private ITU() diff --git a/src/main/java/com/ethlo/time/StdJdkInternetDateTimeUtil.java b/src/main/java/com/ethlo/time/Java8Rfc3339.java similarity index 98% rename from src/main/java/com/ethlo/time/StdJdkInternetDateTimeUtil.java rename to src/main/java/com/ethlo/time/Java8Rfc3339.java index 16b80d8..aff202c 100644 --- a/src/main/java/com/ethlo/time/StdJdkInternetDateTimeUtil.java +++ b/src/main/java/com/ethlo/time/Java8Rfc3339.java @@ -36,7 +36,7 @@ * * @author ethlo - Morten Haraldsen */ -public class StdJdkInternetDateTimeUtil extends AbstractRfc3339 +public class Java8Rfc3339 extends AbstractRfc3339 { private SimpleDateFormat[] formats = new SimpleDateFormat[MAX_FRACTION_DIGITS]; @@ -86,7 +86,7 @@ public class StdJdkInternetDateTimeUtil extends AbstractRfc3339 .toFormatter(); - public StdJdkInternetDateTimeUtil() + public Java8Rfc3339() { for (int i = 1; i < MAX_FRACTION_DIGITS; i++) { diff --git a/src/main/java/com/ethlo/time/LeapSecondException.java b/src/main/java/com/ethlo/time/LeapSecondException.java index 7a8a3e1..4f6fcd7 100644 --- a/src/main/java/com/ethlo/time/LeapSecondException.java +++ b/src/main/java/com/ethlo/time/LeapSecondException.java @@ -9,9 +9,9 @@ * 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. diff --git a/src/main/java/com/ethlo/time/Rfc3339.java b/src/main/java/com/ethlo/time/Rfc3339.java index 3df7692..9cf6df3 100644 --- a/src/main/java/com/ethlo/time/Rfc3339.java +++ b/src/main/java/com/ethlo/time/Rfc3339.java @@ -27,99 +27,9 @@ * The recommendation for date-time exchange in modern APIs is to use RFC-3339, available at https://tools.ietf.org/html/rfc3339 * This class supports both validation, parsing and formatting of such date-times. * - * @author Ethlo, Morten Haraldsen + * @author ethlo, Morten Haraldsen */ -public interface Rfc3339 +public interface Rfc3339 extends Rfc3339Parser, Rfc3339Formatter { - /** - * Format the {@link Date} as a UTC formatted date-time string - * - * @param date The date to format - * @return the formatted string - */ - String formatUtc(OffsetDateTime date); - /** - * Parse the date-time and return it as a {@link OffsetDateTime}. - * - * @param dateTimeStr The date-time string to parse - * @return The instant defined by the date-time in UTC time-zone - */ - OffsetDateTime parseDateTime(String dateTimeStr); - - /** - * See {@link #formatUtc(OffsetDateTime)} - * - * @param date The date to format - * @return The formatted string - */ - String formatUtc(Date date); - - /** - * See {@link #formatUtcMilli(OffsetDateTime)} - * - * @param date The date to format - * @return The formatted string - */ - String formatUtcMilli(Date date); - - /** - * Format a date in the given time-zone - * - * @param date The date to format - * @param timezone The time-zone - * @return the formatted string - */ - String format(Date date, String timezone); - - /** - * Format the date as a date-time String with specified resolution and time-zone offset, for example 1999-12-31T16:48:36[.123456789]-05:00 - * - * @param date The date to format - * @param timezone The time-zone - * @param fractionDigits The number of fraction digits - * @return the formatted string - */ - String format(Date date, String timezone, int fractionDigits); - - /** - * Check whether the string is a valid date-time according to RFC-3339 - * - * @param dateTimeStr The date-time to validate - * @return True if valid date-time or null, false otherwise - */ - boolean isValid(String dateTimeStr); - - /** - * Format the date as a date-time String with millisecond resolution, for example 1999-12-31T16:48:36.123Z - * - * @param date The date to format - * @return the formatted string - */ - String formatUtcMilli(OffsetDateTime date); - - /** - * Format the date as a date-time String with microsecond resolution, aka 1999-12-31T16:48:36.123456Z - * - * @param date The date to format - * @return the formatted string - */ - String formatUtcMicro(OffsetDateTime date); - - /** - * Format the date as a date-time String with nanosecond resolution, aka 1999-12-31T16:48:36.123456789Z - * - * @param date The date to format - * @return the formatted string - */ - String formatUtcNano(OffsetDateTime date); - - /** - * Format the date as a date-time String with specified resolution, aka 1999-12-31T16:48:36[.123456789]Z - * - * @param date The date to format - * @param fractionDigits The number of fractional digits in the second - * @return the formatted string - */ - String formatUtc(OffsetDateTime date, int fractionDigits); } diff --git a/src/main/java/com/ethlo/time/Rfc3339Formatter.java b/src/main/java/com/ethlo/time/Rfc3339Formatter.java new file mode 100644 index 0000000..38ebfda --- /dev/null +++ b/src/main/java/com/ethlo/time/Rfc3339Formatter.java @@ -0,0 +1,103 @@ +package com.ethlo.time; + +/*- + * #%L + * Internet Time Utility + * %% + * Copyright (C) 2017 - 2022 Morten Haraldsen (ethlo) + * %% + * 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. + * #L% + */ + +import java.time.OffsetDateTime; +import java.util.Date; + +public interface Rfc3339Formatter +{ + /** + * Format the {@link Date} as a UTC formatted date-time string + * + * @param date The date to format + * @return the formatted string + */ + String formatUtc(OffsetDateTime date); + + /** + * See {@link #formatUtc(OffsetDateTime)} + * + * @param date The date to format + * @return The formatted string + */ + String formatUtc(Date date); + + /** + * See {@link #formatUtcMilli(OffsetDateTime)} + * + * @param date The date to format + * @return The formatted string + */ + String formatUtcMilli(Date date); + + /** + * Format a date in the given time-zone + * + * @param date The date to format + * @param timezone The time-zone + * @return the formatted string + */ + String format(Date date, String timezone); + + /** + * Format the date as a date-time String with specified resolution and time-zone offset, for example 1999-12-31T16:48:36[.123456789]-05:00 + * + * @param date The date to format + * @param timezone The time-zone + * @param fractionDigits The number of fraction digits + * @return the formatted string + */ + String format(Date date, String timezone, int fractionDigits); + + /** + * Format the date as a date-time String with millisecond resolution, for example 1999-12-31T16:48:36.123Z + * + * @param date The date to format + * @return the formatted string + */ + String formatUtcMilli(OffsetDateTime date); + + /** + * Format the date as a date-time String with microsecond resolution, aka 1999-12-31T16:48:36.123456Z + * + * @param date The date to format + * @return the formatted string + */ + String formatUtcMicro(OffsetDateTime date); + + /** + * Format the date as a date-time String with nanosecond resolution, aka 1999-12-31T16:48:36.123456789Z + * + * @param date The date to format + * @return the formatted string + */ + String formatUtcNano(OffsetDateTime date); + + /** + * Format the date as a date-time String with specified resolution, aka 1999-12-31T16:48:36[.123456789]Z + * + * @param date The date to format + * @param fractionDigits The number of fractional digits in the second + * @return the formatted string + */ + String formatUtc(OffsetDateTime date, int fractionDigits); +} diff --git a/src/main/java/com/ethlo/time/Rfc3339Parser.java b/src/main/java/com/ethlo/time/Rfc3339Parser.java new file mode 100644 index 0000000..0a05325 --- /dev/null +++ b/src/main/java/com/ethlo/time/Rfc3339Parser.java @@ -0,0 +1,42 @@ +package com.ethlo.time; + +/*- + * #%L + * Internet Time Utility + * %% + * Copyright (C) 2017 - 2022 Morten Haraldsen (ethlo) + * %% + * 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. + * #L% + */ + +import java.time.OffsetDateTime; + +public interface Rfc3339Parser +{ + /** + * Parse the date-time and return it as a {@link OffsetDateTime}. + * + * @param dateTimeStr The date-time string to parse + * @return The {@link OffsetDateTime} as parsed from the input + */ + OffsetDateTime parseDateTime(String dateTimeStr); + + /** + * Check whether the string is a valid date-time according to RFC-3339 + * + * @param dateTimeStr The date-time to validate + * @return True if valid date-time or null, false otherwise + */ + boolean isValid(String dateTimeStr); +} diff --git a/src/test/java/com/ethlo/time/AbstractTest.java b/src/test/java/com/ethlo/time/AbstractTest.java index 3abcf67..47992f7 100644 --- a/src/test/java/com/ethlo/time/AbstractTest.java +++ b/src/test/java/com/ethlo/time/AbstractTest.java @@ -20,64 +20,43 @@ * #L% */ -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.util.Locale; -import java.util.function.Consumer; +import org.junit.jupiter.api.BeforeEach; -import org.junit.Before; - -public abstract class AbstractTest +public abstract class AbstractTest { - protected T instance; + protected Rfc3339Parser parser; + protected Rfc3339Formatter formatter; - protected abstract T getInstance(); + protected abstract Rfc3339Parser getParser(); + protected abstract Rfc3339Formatter getFormatter(); protected abstract long getRuns(); - @Before + @BeforeEach public void setup() { - this.instance = getInstance(); + this.parser = getParser(); + this.formatter = getFormatter(); } - protected final void perform(Consumer func, String msg) + protected final void unsupported(final Chronograph chronograph, String msg) + { + chronograph.timed(msg + " - unsupported!", () -> { + }); + } + + protected final void perform(final Chronograph chronograph, final Runnable func, final String msg) { // Warm-up for (int i = 0; i < getRuns(); i++) { - func.accept(null); + func.run(); } // Benchmark - final long start = System.nanoTime(); for (int i = 0; i < getRuns(); i++) { - func.accept(null); + chronograph.timed(msg, func); } - final long end = System.nanoTime(); - final double secs = (end - start) / 1_000_000_000D; - System.out.println(msg + ": " + getElapsedFormatter().format(secs) + " sec elapsed. " + getPerformanceFormatter().format((getRuns() / secs)) + " iterations/sec. " + getRuns() + " total iterations"); - } - - protected DecimalFormat getPerformanceFormatter() - { - DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.US); - DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols(); - symbols.setGroupingSeparator(' '); - formatter.setMaximumFractionDigits(0); - formatter.setDecimalFormatSymbols(symbols); - return formatter; - } - - protected DecimalFormat getElapsedFormatter() - { - DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.US); - DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols(); - symbols.setGroupingSeparator(' '); - formatter.setMaximumFractionDigits(2); - formatter.setDecimalFormatSymbols(symbols); - return formatter; } } diff --git a/src/test/java/com/ethlo/time/ApacheFastDateUtilsInternetDateTimeUtil.java b/src/test/java/com/ethlo/time/ApacheFastDateFormatRfc3339.java similarity index 78% rename from src/test/java/com/ethlo/time/ApacheFastDateUtilsInternetDateTimeUtil.java rename to src/test/java/com/ethlo/time/ApacheFastDateFormatRfc3339.java index c1663d3..cb54a72 100644 --- a/src/test/java/com/ethlo/time/ApacheFastDateUtilsInternetDateTimeUtil.java +++ b/src/test/java/com/ethlo/time/ApacheFastDateFormatRfc3339.java @@ -28,9 +28,10 @@ import org.apache.commons.lang3.time.FastDateFormat; -public class ApacheFastDateUtilsInternetDateTimeUtil implements Rfc3339 +public class ApacheFastDateFormatRfc3339 implements Rfc3339 { - private final FastDateFormat parser = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); + private final FastDateFormat fractionParser = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); + private final FastDateFormat parser = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ssXXX"); @Override public String formatUtc(OffsetDateTime date) @@ -43,18 +44,25 @@ public OffsetDateTime parseDateTime(String dateTimeStr) { try { - return OffsetDateTime.ofInstant(parser.parse(dateTimeStr).toInstant(), ZoneOffset.UTC); + return OffsetDateTime.ofInstant(fractionParser.parse(dateTimeStr).toInstant(), ZoneOffset.UTC); } - catch (ParseException exc) + catch (ParseException fractionExc) { - throw new DateTimeException(exc.getMessage(), exc); + try + { + return OffsetDateTime.ofInstant(parser.parse(dateTimeStr).toInstant(), ZoneOffset.UTC); + } + catch (ParseException exc) + { + throw new DateTimeException(exc.getMessage(), exc); + } } } @Override public String formatUtc(Date date) { - return parser.format(date); + return fractionParser.format(date); } @Override diff --git a/src/test/java/com/ethlo/time/ApacheFastDateFormatRfc3339BenchmarkTest.java b/src/test/java/com/ethlo/time/ApacheFastDateFormatRfc3339BenchmarkTest.java new file mode 100644 index 0000000..e4613bd --- /dev/null +++ b/src/test/java/com/ethlo/time/ApacheFastDateFormatRfc3339BenchmarkTest.java @@ -0,0 +1,39 @@ +package com.ethlo.time; + +/*- + * #%L + * Internet Time Utility + * %% + * Copyright (C) 2017 Morten Haraldsen (ethlo) + * %% + * 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. + * #L% + */ + +import org.junit.jupiter.api.Disabled; + +@Disabled("Not returning correct results") +public class ApacheFastDateFormatRfc3339BenchmarkTest extends BenchmarkTest +{ + @Override + protected Rfc3339 getParser() + { + return new ApacheFastDateFormatRfc3339(); + } + + @Override + protected Rfc3339Formatter getFormatter() + { + return new ApacheFastDateFormatRfc3339(); + } +} diff --git a/src/test/java/com/ethlo/time/BenchmarkTest.java b/src/test/java/com/ethlo/time/BenchmarkTest.java index 4895b32..8ac4c85 100644 --- a/src/test/java/com/ethlo/time/BenchmarkTest.java +++ b/src/test/java/com/ethlo/time/BenchmarkTest.java @@ -20,36 +20,87 @@ * #L% */ +import static org.assertj.core.api.Assertions.assertThat; + +import java.time.Duration; import java.time.OffsetDateTime; import java.time.ZoneOffset; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Test; -public abstract class BenchmarkTest extends AbstractTest +public abstract class BenchmarkTest extends AbstractTest { private final OffsetDateTime d = OffsetDateTime.of(2017, 12, 21, 15, 27, 39, 987, ZoneOffset.UTC); + private static final Chronograph chronograph = Chronograph.create(CaptureConfig.minInterval(Duration.ofMillis(1))); + + @Override + protected long getRuns() + { + return 1_000_000; + } + @Test public void testParsePerformance() { - final String s = "2017-12-21T15:27:39.987Z"; - perform(f -> instance.parseDateTime(s), instance.getClass().getSimpleName() + " - parse"); + final Map formats = new LinkedHashMap<>(); + for (String f : Arrays.asList( + "2017-12-21T15:27:39.987Z", + "2017-12-21T15:27:39.98Z", + "2017-12-21T15:27:39.9Z", + "2017-12-21T15:27:39Z" + )) + { + formats.put(f, OffsetDateTime.parse(f)); + } + + final String name = parser.getClass().getSimpleName() + " - parse"; + perform(chronograph, () -> + { + for (Map.Entry e : formats.entrySet()) + { + assertThat(parser.parseDateTime(e.getKey())).isEqualTo(e.getValue()); + } + }, name); } @Test public void testParseLenient() { final String s = "2017-12-21T12:20:45.987Z"; - if (instance instanceof W3cDateTimeUtil) + final String name = parser.getClass().getSimpleName() + " - parseLenient"; + if (parser instanceof W3cDateTimeUtil) { - final W3cDateTimeUtil w3cUtil = (W3cDateTimeUtil) instance; - perform(f -> w3cUtil.parseLenient(s), instance.getClass().getSimpleName() + " - parseLenient"); + final W3cDateTimeUtil w3cUtil = (W3cDateTimeUtil) parser; + perform(chronograph, () -> w3cUtil.parseLenient(s), name); + } + else + { + unsupported(chronograph, name); } } @Test public void testFormatPerformance() { - perform(f -> instance.formatUtc(d), instance.getClass().getSimpleName() + " - formatUtc"); + final String name = parser.getClass().getSimpleName() + " - formatUtc"; + if (formatter != null) + { + perform(chronograph, () -> formatter.formatUtc(d), name); + } + else + { + unsupported(chronograph, name); + } + } + + @AfterAll + static void printStats() + { + System.out.println(chronograph.prettyPrint()); } } diff --git a/src/test/java/com/ethlo/time/CharArrayUtilTest.java b/src/test/java/com/ethlo/time/CharArrayUtilTest.java index 5bd931f..4bd695d 100644 --- a/src/test/java/com/ethlo/time/CharArrayUtilTest.java +++ b/src/test/java/com/ethlo/time/CharArrayUtilTest.java @@ -20,11 +20,11 @@ * #L% */ -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class CharArrayUtilTest { diff --git a/src/test/java/com/ethlo/time/CorrectnessTest.java b/src/test/java/com/ethlo/time/CorrectnessTest.java index e8beaf4..2b8cf0c 100644 --- a/src/test/java/com/ethlo/time/CorrectnessTest.java +++ b/src/test/java/com/ethlo/time/CorrectnessTest.java @@ -20,18 +20,19 @@ * #L% */ -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.time.DateTimeException; import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.util.Date; -import org.junit.Test; -import org.junit.experimental.categories.Category; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; -@Category(CorrectnessTest.class) -public abstract class CorrectnessTest extends AbstractTest +@Tag("CorrectnessTest") +public abstract class CorrectnessTest extends AbstractTest { private final String[] validFormats = { @@ -57,7 +58,7 @@ public void testParseLeapSecondUTC() { final String leapSecondUTC = "1990-12-31T23:59:60Z"; final LeapSecondException exc = getLeapSecondsException(leapSecondUTC); - assertThat(instance.formatUtc(exc.getNearestDateTime())).isEqualTo("1991-01-01T00:00:00Z"); + assertThat(formatter.formatUtc(exc.getNearestDateTime())).isEqualTo("1991-01-01T00:00:00Z"); assertThat(exc.getSecondsInMinute()).isEqualTo(60); } @@ -66,7 +67,7 @@ public void testParseLeapSecondPST() { final String leapSecondPST = "1990-12-31T15:59:60-08:00"; final LeapSecondException exc = getLeapSecondsException(leapSecondPST); - assertThat(instance.formatUtc(exc.getNearestDateTime())).isEqualTo("1991-01-01T00:00:00Z"); + assertThat(formatter.formatUtc(exc.getNearestDateTime())).isEqualTo("1991-01-01T00:00:00Z"); assertThat(exc.getSecondsInMinute()).isEqualTo(60); } @@ -75,7 +76,7 @@ public void testParseLeapSecondUTCJune() { final String leapSecondUTC = "1992-06-30T23:59:60Z"; final LeapSecondException exc = getLeapSecondsException(leapSecondUTC); - assertThat(instance.formatUtc(exc.getNearestDateTime())).isEqualTo("1992-07-01T00:00:00Z"); + assertThat(formatter.formatUtc(exc.getNearestDateTime())).isEqualTo("1992-07-01T00:00:00Z"); assertThat(exc.getSecondsInMinute()).isEqualTo(60); } @@ -84,7 +85,7 @@ public void testParseLeapSecondPSTJune() { final String leapSecondPST = "1992-06-30T15:59:60-08:00"; final LeapSecondException exc = getLeapSecondsException(leapSecondPST); - assertThat(instance.formatUtc(exc.getNearestDateTime())).isEqualTo("1992-07-01T00:00:00Z"); + assertThat(formatter.formatUtc(exc.getNearestDateTime())).isEqualTo("1992-07-01T00:00:00Z"); assertThat(exc.getSecondsInMinute()).isEqualTo(60); } @@ -92,7 +93,7 @@ private LeapSecondException getLeapSecondsException(final String dateTime) { try { - instance.parseDateTime(dateTime); + parser.parseDateTime(dateTime); throw new IllegalArgumentException("Should have thrown LeapSecondException"); } catch (LeapSecondException exc) @@ -101,66 +102,66 @@ private LeapSecondException getLeapSecondsException(final String dateTime) } } - @Test(expected = DateTimeException.class) + @Test public void testFormat1() { final String s = "2017-02-21T15:27:39.0000000"; - instance.parseDateTime(s); + assertThrows(DateTimeException.class, () -> parser.parseDateTime(s)); } - @Test(expected = DateTimeException.class) + @Test public void testFormat2() { final String s = "2017-02-21T15:27:39.000+30:00"; - instance.parseDateTime(s); + assertThrows(DateTimeException.class, () -> parser.parseDateTime(s)); } @Test public void testFormat3() { final String s = "2017-02-21T10:00:00.000+12:00"; - final OffsetDateTime date = instance.parseDateTime(s); - assertThat(instance.formatUtcMilli(date)).isEqualTo("2017-02-20T22:00:00.000Z"); + final OffsetDateTime date = parser.parseDateTime(s); + assertThat(formatter.formatUtcMilli(date)).isEqualTo("2017-02-20T22:00:00.000Z"); } - @Test(expected = DateTimeException.class) + @Test public void testInvalidNothingAfterFractionalSeconds() { final String s = "2017-02-21T10:00:00.12345"; - instance.parseDateTime(s); + assertThrows(DateTimeException.class, () -> parser.parseDateTime(s)); } @Test public void testFormat4() { final String s = "2017-02-21T15:00:00.123Z"; - final OffsetDateTime date = instance.parseDateTime(s); - assertThat(instance.formatUtcMilli(date)).isEqualTo("2017-02-21T15:00:00.123Z"); - assertThat(instance.format(Date.from(date.atZoneSameInstant(ZoneOffset.UTC).toInstant()), "CET", 3)).isEqualTo("2017-02-21T16:00:00.123+01:00"); - assertThat(instance.format(new Date(date.toInstant().toEpochMilli()), "EST", 3)).isEqualTo("2017-02-21T10:00:00.123-05:00"); + final OffsetDateTime date = parser.parseDateTime(s); + assertThat(formatter.formatUtcMilli(date)).isEqualTo("2017-02-21T15:00:00.123Z"); + assertThat(formatter.format(Date.from(date.atZoneSameInstant(ZoneOffset.UTC).toInstant()), "CET", 3)).isEqualTo("2017-02-21T16:00:00.123+01:00"); + assertThat(formatter.format(new Date(date.toInstant().toEpochMilli()), "EST", 3)).isEqualTo("2017-02-21T10:00:00.123-05:00"); } - @Test(expected = DateTimeException.class) + @Test public void testParseMoreThanNanoResolutionFails() { - instance.parseDateTime("2017-02-21T15:00:00.1234567891Z"); + assertThrows(DateTimeException.class, () -> parser.parseDateTime("2017-02-21T15:00:00.1234567891Z")); } - @Test(expected = DateTimeException.class) + @Test public void testFormatMoreThanNanoResolutionFails() { - final OffsetDateTime d = instance.parseDateTime("2017-02-21T15:00:00.123456789Z"); + final OffsetDateTime d = parser.parseDateTime("2017-02-21T15:00:00.123456789Z"); final int fractionDigits = 10; - instance.formatUtc(d, fractionDigits); + assertThrows(DateTimeException.class, () -> formatter.formatUtc(d, fractionDigits)); } @Test public void testFormatUtc() { final String s = "2017-02-21T15:09:03.123456789Z"; - final OffsetDateTime date = instance.parseDateTime(s); + final OffsetDateTime date = parser.parseDateTime(s); final String expected = "2017-02-21T15:09:03Z"; - final String actual = instance.formatUtc(date); + final String actual = formatter.formatUtc(date); assertThat(actual).isEqualTo(expected); } @@ -168,54 +169,54 @@ public void testFormatUtc() public void testFormatUtcMilli() { final String s = "2017-02-21T15:00:00.123456789Z"; - final OffsetDateTime date = instance.parseDateTime(s); - assertThat(instance.formatUtcMilli(date)).isEqualTo("2017-02-21T15:00:00.123Z"); + final OffsetDateTime date = parser.parseDateTime(s); + assertThat(formatter.formatUtcMilli(date)).isEqualTo("2017-02-21T15:00:00.123Z"); } @Test public void testFormatUtcMilliWithDate() { final String s = "2017-02-21T15:00:00.123456789Z"; - final OffsetDateTime date = instance.parseDateTime(s); - assertThat(instance.formatUtcMilli(new Date(date.toInstant().toEpochMilli()))).isEqualTo("2017-02-21T15:00:00.123Z"); + final OffsetDateTime date = parser.parseDateTime(s); + assertThat(formatter.formatUtcMilli(new Date(date.toInstant().toEpochMilli()))).isEqualTo("2017-02-21T15:00:00.123Z"); } @Test public void testFormatUtcMicro() { final String s = "2017-02-21T15:00:00.123456789Z"; - final OffsetDateTime date = instance.parseDateTime(s); - assertThat(instance.formatUtcMicro(date)).isEqualTo("2017-02-21T15:00:00.123456Z"); + final OffsetDateTime date = parser.parseDateTime(s); + assertThat(formatter.formatUtcMicro(date)).isEqualTo("2017-02-21T15:00:00.123456Z"); } @Test public void testFormatUtcNano() { final String s = "2017-02-21T15:00:00.987654321Z"; - final OffsetDateTime date = instance.parseDateTime(s); - assertThat(instance.formatUtcNano(date)).isEqualTo(s); + final OffsetDateTime date = parser.parseDateTime(s); + assertThat(formatter.formatUtcNano(date)).isEqualTo(s); } - @Test(expected = DateTimeException.class) + @Test public void testFormat4TrailingNoise() { final String s = "2017-02-21T15:00:00.123ZGGG"; - instance.parseDateTime(s); + assertThrows(DateTimeException.class, () -> parser.parseDateTime(s)); } @Test public void testFormat5() { final String s = "2017-02-21T15:27:39.123+13:00"; - final OffsetDateTime date = instance.parseDateTime(s); - assertThat(instance.formatUtcMilli(date)).isEqualTo("2017-02-21T02:27:39.123Z"); + final OffsetDateTime date = parser.parseDateTime(s); + assertThat(formatter.formatUtcMilli(date)).isEqualTo("2017-02-21T02:27:39.123Z"); } @Test public void testParseEmptyString() { final String s = ""; - final OffsetDateTime date = instance.parseDateTime(s); + final OffsetDateTime date = parser.parseDateTime(s); assertThat(date).isNull(); } @@ -223,7 +224,7 @@ public void testParseEmptyString() public void testParseNull() { final String s = null; - final OffsetDateTime date = instance.parseDateTime(s); + final OffsetDateTime date = parser.parseDateTime(s); assertThat(date).isNull(); } @@ -234,44 +235,44 @@ public void testRfcExample() // 1994-11-05T13:15:30Z corresponds to the same instant. final String a = "1994-11-05T08:15:30-05:00"; final String b = "1994-11-05T13:15:30Z"; - final OffsetDateTime dA = instance.parseDateTime(a); - final OffsetDateTime dB = instance.parseDateTime(b); - assertThat(instance.formatUtc(dA)).isEqualTo(instance.formatUtc(dB)); + final OffsetDateTime dA = parser.parseDateTime(a); + final OffsetDateTime dB = parser.parseDateTime(b); + assertThat(formatter.formatUtc(dA)).isEqualTo(formatter.formatUtc(dB)); } - @Test(expected = DateTimeException.class) + @Test public void testBadSeparator() { final String a = "1994 11-05T08:15:30-05:00"; - assertThat(instance.parseDateTime(a)).isNotNull(); + assertThrows(DateTimeException.class, () -> parser.parseDateTime(a)); } - @Test(expected = DateTimeException.class) + @Test public void testParseNonDigit() { final String a = "199g-11-05T08:15:30-05:00"; - assertThat(instance.parseDateTime(a)).isNotNull(); + assertThrows(DateTimeException.class, () -> parser.parseDateTime(a)); } - @Test(expected = DateTimeException.class) + @Test public void testInvalidDateTimeSeparator() { final String a = "1994-11-05X08:15:30-05:00"; - assertThat(instance.parseDateTime(a)).isNotNull(); + assertThrows(DateTimeException.class, () -> parser.parseDateTime(a)); } @Test public void testLowerCaseTseparator() { final String a = "1994-11-05t08:15:30z"; - assertThat(instance.parseDateTime(a)).isNotNull(); + assertThat(parser.parseDateTime(a)).isNotNull(); } @Test public void testSpaceAsSeparator() { final String a = "1994-11-05 08:15:30z"; - assertThat(instance.parseDateTime(a)).isNotNull(); + assertThat(parser.parseDateTime(a)).isNotNull(); } @Test @@ -279,7 +280,7 @@ public void testValid() { for (String f : this.validFormats) { - assertThat(instance.isValid(f)).overridingErrorMessage("Expecting to be valid <%s>", f).isTrue(); + assertThat(parser.isValid(f)).overridingErrorMessage("Expecting to be valid <%s>", f).isTrue(); } } @@ -288,7 +289,7 @@ public void testInvalid() { for (String f : this.invalidFormats) { - if (instance.isValid(f)) + if (parser.isValid(f)) { throw new DateTimeException(f + " is deemed valid"); } @@ -299,29 +300,29 @@ public void testInvalid() public void testMilitaryOffset() { final String s = "2017-02-21T15:27:39+0000"; - assertThat(instance.isValid(s)).isFalse(); + assertThat(parser.isValid(s)).isFalse(); } - @Test(expected = DateTimeException.class) + @Test public void testParseUnknownLocalOffsetConvention() { final String s = "2017-02-21T15:27:39-00:00"; - instance.parseDateTime(s); + assertThrows(DateTimeException.class, () -> parser.parseDateTime(s)); } @Test public void testParseLowercaseZ() { final String s = "2017-02-21T15:27:39.000z"; - instance.parseDateTime(s); + parser.parseDateTime(s); } @Test public void testFormatWithNamedTimeZoneDate() { final String s = "2017-02-21T15:27:39.321+00:00"; - final OffsetDateTime d = instance.parseDateTime(s); - final String formatted = instance.format(new Date(d.toInstant().toEpochMilli()), "EST"); + final OffsetDateTime d = parser.parseDateTime(s); + final String formatted = formatter.format(new Date(d.toInstant().toEpochMilli()), "EST"); assertThat(formatted).isEqualTo("2017-02-21T10:27:39.321-05:00"); } @@ -329,8 +330,8 @@ public void testFormatWithNamedTimeZoneDate() public void testFormatUtcDate() { final String s = "2017-02-21T15:27:39.321+00:00"; - final OffsetDateTime d = instance.parseDateTime(s); - final String formatted = instance.formatUtc(new Date(d.toInstant().toEpochMilli())); + final OffsetDateTime d = parser.parseDateTime(s); + final String formatted = formatter.formatUtc(new Date(d.toInstant().toEpochMilli())); assertThat(formatted).isEqualTo("2017-02-21T15:27:39.321Z"); } @@ -338,8 +339,8 @@ public void testFormatUtcDate() public void testFormatWithNamedTimeZone() { final String s = "2017-02-21T15:27:39.321+00:00"; - final OffsetDateTime d = instance.parseDateTime(s); - final String formatted = instance.format(new Date(d.toInstant().toEpochMilli()), "EST", 3); + final OffsetDateTime d = parser.parseDateTime(s); + final String formatted = formatter.format(new Date(d.toInstant().toEpochMilli()), "EST", 3); assertThat(formatted).isEqualTo("2017-02-21T10:27:39.321-05:00"); } diff --git a/src/test/java/com/ethlo/time/FastBenchmarkTest.java b/src/test/java/com/ethlo/time/EthloITUBenchmarkTest.java similarity index 78% rename from src/test/java/com/ethlo/time/FastBenchmarkTest.java rename to src/test/java/com/ethlo/time/EthloITUBenchmarkTest.java index 6c87103..a336ebe 100644 --- a/src/test/java/com/ethlo/time/FastBenchmarkTest.java +++ b/src/test/java/com/ethlo/time/EthloITUBenchmarkTest.java @@ -20,17 +20,17 @@ * #L% */ -public class FastBenchmarkTest extends BenchmarkTest +public class EthloITUBenchmarkTest extends BenchmarkTest { @Override - protected Rfc3339 getInstance() + protected Rfc3339 getParser() { - return new FastInternetDateTimeUtil(); + return new EthloITU(); } @Override - protected long getRuns() + protected Rfc3339Formatter getFormatter() { - return 100_000_000; + return new EthloITU(); } } diff --git a/src/test/java/com/ethlo/time/StdJdkBenchmarkTest.java b/src/test/java/com/ethlo/time/EthloITUCorrectnessTest.java similarity index 78% rename from src/test/java/com/ethlo/time/StdJdkBenchmarkTest.java rename to src/test/java/com/ethlo/time/EthloITUCorrectnessTest.java index 7f2d14e..f26fc2b 100644 --- a/src/test/java/com/ethlo/time/StdJdkBenchmarkTest.java +++ b/src/test/java/com/ethlo/time/EthloITUCorrectnessTest.java @@ -20,17 +20,17 @@ * #L% */ -public class StdJdkBenchmarkTest extends BenchmarkTest +public class EthloITUCorrectnessTest extends CorrectnessTest { @Override - protected Rfc3339 getInstance() + protected Rfc3339 getParser() { - return new StdJdkInternetDateTimeUtil(); + return new EthloITU(); } @Override - protected long getRuns() + protected Rfc3339Formatter getFormatter() { - return 10_000_000; + return new EthloITU(); } } diff --git a/src/test/java/com/ethlo/time/FastCorrectnessTest.java b/src/test/java/com/ethlo/time/FastCorrectnessTest.java deleted file mode 100644 index b0c3dfc..0000000 --- a/src/test/java/com/ethlo/time/FastCorrectnessTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ethlo.time; - -/*- - * #%L - * Internet Time Utility - * %% - * Copyright (C) 2017 Morten Haraldsen (ethlo) - * %% - * 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. - * #L% - */ - -public class FastCorrectnessTest extends CorrectnessTest -{ - @Override - protected Rfc3339 getInstance() - { - return new FastInternetDateTimeUtil(); - } -} diff --git a/src/test/java/com/ethlo/time/FieldTest.java b/src/test/java/com/ethlo/time/FieldTest.java index f536d5c..33f72c4 100644 --- a/src/test/java/com/ethlo/time/FieldTest.java +++ b/src/test/java/com/ethlo/time/FieldTest.java @@ -20,7 +20,7 @@ * #L% */ -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import java.time.LocalDate; import java.time.OffsetDateTime; @@ -28,10 +28,11 @@ import java.time.YearMonth; import java.time.temporal.Temporal; -import org.junit.Test; -import org.junit.experimental.categories.Category; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; -@Category(CorrectnessTest.class) +@Tag("CorrectnessTest") public class FieldTest { @Test @@ -43,9 +44,9 @@ public void testGetKnownFields() assertThat(Field.valueOf(OffsetDateTime.class)).isEqualTo(Field.SECOND); } - @Test(expected = IllegalArgumentException.class) + @Test public void testGetUnknown() { - Field.valueOf(Temporal.class); + Assertions.assertThrows(IllegalArgumentException.class, () -> Field.valueOf(Temporal.class)); } } diff --git a/src/test/java/com/ethlo/time/GoogleDateTimeRfc3339.java b/src/test/java/com/ethlo/time/GoogleDateTimeRfc3339.java new file mode 100644 index 0000000..ff9c5b3 --- /dev/null +++ b/src/test/java/com/ethlo/time/GoogleDateTimeRfc3339.java @@ -0,0 +1,51 @@ +package com.ethlo.time; + +/*- + * #%L + * Internet Time Utility + * %% + * Copyright (C) 2017 Morten Haraldsen (ethlo) + * %% + * 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. + * #L% + */ + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +import com.google.api.client.util.DateTime; + +public class GoogleDateTimeRfc3339 implements Rfc3339Parser +{ + @Override + public OffsetDateTime parseDateTime(String dateTimeStr) + { + final DateTime.SecondsAndNanos secondsAndNanos = DateTime.parseRfc3339ToSecondsAndNanos(dateTimeStr); + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(secondsAndNanos.getSeconds(), secondsAndNanos.getNanos()), ZoneOffset.UTC); + } + + @Override + public boolean isValid(final String dateTimeStr) + { + try + { + parseDateTime(dateTimeStr); + return true; + } + catch (NumberFormatException exc) + { + return false; + } + } +} diff --git a/src/test/java/com/ethlo/time/ApacheFastDateUtilsBenchmarkTest.java b/src/test/java/com/ethlo/time/GoogleDateTimeRfc3339BenchmarkTest.java similarity index 77% rename from src/test/java/com/ethlo/time/ApacheFastDateUtilsBenchmarkTest.java rename to src/test/java/com/ethlo/time/GoogleDateTimeRfc3339BenchmarkTest.java index 9cb0492..ad84426 100644 --- a/src/test/java/com/ethlo/time/ApacheFastDateUtilsBenchmarkTest.java +++ b/src/test/java/com/ethlo/time/GoogleDateTimeRfc3339BenchmarkTest.java @@ -20,17 +20,17 @@ * #L% */ -public class ApacheFastDateUtilsBenchmarkTest extends BenchmarkTest +public class GoogleDateTimeRfc3339BenchmarkTest extends BenchmarkTest { @Override - protected Rfc3339 getInstance() + protected Rfc3339Parser getParser() { - return new ApacheFastDateUtilsInternetDateTimeUtil(); + return new GoogleDateTimeRfc3339(); } @Override - protected long getRuns() + protected Rfc3339Formatter getFormatter() { - return 10_000_000; + return null; } } diff --git a/src/test/java/com/ethlo/time/ITUTest.java b/src/test/java/com/ethlo/time/ITUTest.java index 31d81ed..e2ef66a 100644 --- a/src/test/java/com/ethlo/time/ITUTest.java +++ b/src/test/java/com/ethlo/time/ITUTest.java @@ -20,16 +20,16 @@ * #L% */ -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import java.time.OffsetDateTime; import java.time.YearMonth; import java.util.Date; -import org.junit.Test; -import org.junit.experimental.categories.Category; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; -@Category(CorrectnessTest.class) +@Tag("CorrectnessTest") public class ITUTest { private static final OffsetDateTime VALID_DATETIME = OffsetDateTime.parse("2017-05-01T16:23:12Z"); diff --git a/src/test/java/com/ethlo/time/Java7InternetDateTimeUtil.java b/src/test/java/com/ethlo/time/Java7Rfc3339.java similarity index 80% rename from src/test/java/com/ethlo/time/Java7InternetDateTimeUtil.java rename to src/test/java/com/ethlo/time/Java7Rfc3339.java index 8f2c5cc..11c31e9 100644 --- a/src/test/java/com/ethlo/time/Java7InternetDateTimeUtil.java +++ b/src/test/java/com/ethlo/time/Java7Rfc3339.java @@ -28,9 +28,10 @@ import java.time.ZoneOffset; import java.util.Date; -public class Java7InternetDateTimeUtil implements Rfc3339 +public class Java7Rfc3339 implements Rfc3339 { - private final DateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); + private final DateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); + private final DateFormat fractionParser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); @Override public String formatUtc(OffsetDateTime date) @@ -43,11 +44,18 @@ public OffsetDateTime parseDateTime(String dateTimeStr) { try { - return OffsetDateTime.ofInstant(parser.parse(dateTimeStr).toInstant(), ZoneOffset.UTC); + return OffsetDateTime.ofInstant(fractionParser.parse(dateTimeStr).toInstant(), ZoneOffset.UTC); } - catch (ParseException exc) + catch (ParseException fractionExc) { - throw new DateTimeException(exc.getMessage(), exc); + try + { + return OffsetDateTime.ofInstant(parser.parse(dateTimeStr).toInstant(), ZoneOffset.UTC); + } + catch (ParseException exc) + { + throw new DateTimeException(exc.getMessage(), exc); + } } } diff --git a/src/test/java/com/ethlo/time/Java7Rfc3339BenchmarkTest.java b/src/test/java/com/ethlo/time/Java7Rfc3339BenchmarkTest.java new file mode 100644 index 0000000..6716438 --- /dev/null +++ b/src/test/java/com/ethlo/time/Java7Rfc3339BenchmarkTest.java @@ -0,0 +1,38 @@ +package com.ethlo.time; + +import org.junit.jupiter.api.Disabled; + +/*- + * #%L + * Internet Time Utility + * %% + * Copyright (C) 2017 Morten Haraldsen (ethlo) + * %% + * 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. + * #L% + */ +@Disabled("Not returning correct results") +public class Java7Rfc3339BenchmarkTest extends BenchmarkTest +{ + @Override + protected Rfc3339 getParser() + { + return new Java7Rfc3339(); + } + + @Override + protected Rfc3339Formatter getFormatter() + { + return new Java7Rfc3339(); + } +} diff --git a/src/test/java/com/ethlo/time/Java7BenchmarkTest.java b/src/test/java/com/ethlo/time/Java8Rfc3339BenchmarkTest.java similarity index 77% rename from src/test/java/com/ethlo/time/Java7BenchmarkTest.java rename to src/test/java/com/ethlo/time/Java8Rfc3339BenchmarkTest.java index 18fbe4a..42de489 100644 --- a/src/test/java/com/ethlo/time/Java7BenchmarkTest.java +++ b/src/test/java/com/ethlo/time/Java8Rfc3339BenchmarkTest.java @@ -20,17 +20,17 @@ * #L% */ -public class Java7BenchmarkTest extends BenchmarkTest +public class Java8Rfc3339BenchmarkTest extends BenchmarkTest { @Override - protected Rfc3339 getInstance() + protected Rfc3339 getParser() { - return new Java7InternetDateTimeUtil(); + return new Java8Rfc3339(); } @Override - protected long getRuns() + protected Rfc3339Formatter getFormatter() { - return 10_000_000; + return new Java8Rfc3339(); } } diff --git a/src/test/java/com/ethlo/time/StdJdkCorrectnessTest.java b/src/test/java/com/ethlo/time/Java8Rfc3339CorrectnessTest.java similarity index 78% rename from src/test/java/com/ethlo/time/StdJdkCorrectnessTest.java rename to src/test/java/com/ethlo/time/Java8Rfc3339CorrectnessTest.java index 1372920..5625f23 100644 --- a/src/test/java/com/ethlo/time/StdJdkCorrectnessTest.java +++ b/src/test/java/com/ethlo/time/Java8Rfc3339CorrectnessTest.java @@ -20,20 +20,27 @@ * #L% */ -import org.junit.Ignore; -import org.junit.Test; -public class StdJdkCorrectnessTest extends CorrectnessTest +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public class Java8Rfc3339CorrectnessTest extends CorrectnessTest { @Override - protected Rfc3339 getInstance() + protected Rfc3339 getParser() + { + return new Java8Rfc3339(); + } + + @Override + protected Rfc3339 getFormatter() { - return new StdJdkInternetDateTimeUtil(); + return new Java8Rfc3339(); } @Override @Test - @Ignore + @Disabled public void testFormat4TrailingNoise() { // For ignore marker only @@ -41,7 +48,7 @@ public void testFormat4TrailingNoise() @Override @Test - @Ignore + @Disabled public void testParseUnknownLocalOffsetConvention() { // For ignore marker only @@ -50,7 +57,7 @@ public void testParseUnknownLocalOffsetConvention() @Override @Test - @Ignore + @Disabled public void testParseLeapSecondUTC() { // For ignore marker only @@ -58,7 +65,7 @@ public void testParseLeapSecondUTC() @Override @Test - @Ignore + @Disabled public void testParseLeapSecondPST() { // For ignore marker only @@ -66,7 +73,7 @@ public void testParseLeapSecondPST() @Override @Test - @Ignore + @Disabled public void testParseLeapSecondUTCJune() { // For ignore marker only @@ -74,7 +81,7 @@ public void testParseLeapSecondUTCJune() @Override @Test - @Ignore + @Disabled public void testParseLeapSecondPSTJune() { // For ignore marker only diff --git a/src/test/java/com/ethlo/time/W3cCorrectnessTest.java b/src/test/java/com/ethlo/time/W3cCorrectnessTest.java index 1bfb211..4fc6280 100644 --- a/src/test/java/com/ethlo/time/W3cCorrectnessTest.java +++ b/src/test/java/com/ethlo/time/W3cCorrectnessTest.java @@ -20,7 +20,7 @@ * #L% */ -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import java.time.DateTimeException; import java.time.LocalDate; @@ -32,11 +32,12 @@ import java.time.temporal.ChronoField; import java.time.temporal.Temporal; -import org.junit.Test; -import org.junit.experimental.categories.Category; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; -@Category(CorrectnessTest.class) -public class W3cCorrectnessTest extends AbstractTest +@Tag("CorrectnessTest") +public class W3cCorrectnessTest extends AbstractTest { private W3cDateTimeUtil w3cDateUtil; @@ -44,7 +45,7 @@ public class W3cCorrectnessTest extends AbstractTest public void testParseEmptyString() { final String s = ""; - final OffsetDateTime date = instance.parseDateTime(s); + final OffsetDateTime date = parser.parseDateTime(s); assertThat(date).isNull(); } @@ -105,32 +106,38 @@ public void testParseDateString() { final String s = "2012-03-29"; final LocalDate date = w3cDateUtil.parseLenient(s, LocalDate.class); - assertThat(instance.formatUtc(OffsetDateTime.of(date, LocalTime.MIN, ZoneOffset.UTC))).isEqualTo("2012-03-29T00:00:00Z"); + assertThat(formatter.formatUtc(OffsetDateTime.of(date, LocalTime.MIN, ZoneOffset.UTC))).isEqualTo("2012-03-29T00:00:00Z"); } - @Test(expected = DateTimeException.class) + @Test public void testParseBestEffort1DigitMinute() { final String s = "2012-03-29T23:1"; - w3cDateUtil.parseLenient(s); + Assertions.assertThrows(DateTimeException.class, () -> w3cDateUtil.parseLenient(s)); } @Test public void testParseNull() { final String s = null; - final OffsetDateTime date = instance.parseDateTime(s); + final OffsetDateTime date = parser.parseDateTime(s); assertThat(date).isNull(); } @Override - protected Rfc3339 getInstance() + protected Rfc3339 getParser() { - final FastInternetDateTimeUtil retVal = new FastInternetDateTimeUtil(); + final EthloITU retVal = new EthloITU(); this.w3cDateUtil = retVal; return retVal; } + @Override + protected Rfc3339Formatter getFormatter() + { + return new EthloITU(); + } + @Override protected long getRuns() {