Skip to content

Latest commit

 

History

History
347 lines (304 loc) · 15.8 KB

ut_suite_builder.md

File metadata and controls

347 lines (304 loc) · 15.8 KB

UT_SUITE_BUILDER

Types

Name Code Description
t_annotation_text
subtype t_annotation_text     is varchar2(4000);
t_annotation_name
subtype t_annotation_name     is varchar2(4000);
t_object_name
subtype t_object_name         is varchar2(500);
t_annotation_position
subtype t_annotation_position is binary_integer;
tt_procedure_annotations
type tt_procedure_annotations is table of tt_annotation_texts index by t_annotation_name;

Variables

Name Code Description
l_throws_list := ut_utils.trim_list_elements(ut_utils.string_to_table(a_annotation_text, ',', 'Y'));
else
else
l_throws_list(i) := l_throws_list(i);
end
end if;
end
    end loop;
    
l_throws_list := ut_utils.filter_list( ut_utils.trim_list_elements(l_throws_list), l_regexp_for_excep_nums);
end
    end loop;
return
    return l_exception_number_list;
begin
  begin
a_list := ut_integer_list();
    l_annotation_pos := a_throws_ann_text.first;
l_annotation_pos := a_throws_ann_text.next(l_annotation_pos);
end
    end loop;
end
end if;
begin
    begin
l_annotation_pos := a_annotation_texts.first;
  l_annotation_pos := a_annotation_texts.next( l_annotation_pos);
end
end loop;
l_line_no
    l_line_no           binary_integer;
    l_line_no := a_annotations(a_for_annotation).next( l_line_no );
end
  end loop;
end
end if;
end
    end if;
l_line_no
    l_line_no           binary_integer;
      l_line_no := a_annotations(a_for_annotation).next( l_line_no );
end
    end loop;
end
  end if;
end
end if;
l_warning
    l_warning         varchar2(32767);
l_line_no
    l_line_no           binary_integer;
begin
  begin
l_annotation_name := a_proc_annotations.first;
    l_line_no := a_proc_annotations(l_annotation_name).next(l_line_no);
end
  end loop;
end
end if;
l_annotation_name := a_proc_annotations.next(l_annotation_name);
end
    end loop;
l_annotation_texts
    l_annotation_texts tt_annotation_texts;
l_annotation_pos
    l_annotation_pos   binary_integer;
begin
  begin
l_test := ut_test(a_suite.object_owner, a_suite.object_name, a_procedure_name);
else
    else
l_test.description := a_annotations(gc_test)(a_annotations(gc_test).first);
end
    end if;
end
end if;
end
    end if;
end
    end if;
end
    end if;
end
    end if;
l_context
    l_context   ut_logical_suite;
end
  end if;
end
end loop;
end
    end if;
end
end if;
end
end if;
end
end if;
end
end if;
end
    end if;
begin
  begin
a_before_each_list := ut_executables();
    a_after_each_list := ut_executables();
    l_position := a_annotations.first;
end
end if;
l_position := a_annotations.next( l_position);
end
    end loop;
l_after_each_list
    l_after_each_list    ut_executables;
l_rollback_type
    l_rollback_type      ut_utils.t_rollback_type;
l_annotation_text
    l_annotation_text    varchar2(32767);
l_object_name
    l_object_name        t_object_name;
else
    else
l_object_name := a_suite.object_name;
end
    end if;
end
  end if;
end
end if;
end
    end if;
end
end if;
end
    end if;
end
end if;
end
    end if;
l_end_context_pos
    l_end_context_pos    t_annotation_position;
l_package_ann_index
    l_package_ann_index  tt_annotations_index;
l_annotations
    l_annotations        tt_package_annotations;
l_suite
    l_suite              ut_suite;
l_context_no
    l_context_no         binary_integer := 1;
    l_result := a_package_ann_index(gc_endcontext).next(l_result);
end
  end loop;
end
end if;
return
return l_result;
l_position
l_position           t_annotation_position;
begin
    begin
l_position := a_context_pos;
  l_position := a_annotations.next(l_position);
end
end loop;
return
return l_annotations;
end
    end if;
    l_context_pos := a_package_ann_index(gc_context).first;
end
end if;
l_annotations       := get_annotations_in_context(a_annotations, l_context_pos, l_end_context_pos);
l_package_ann_index := build_annotation_index(l_annotations);
l_suite := ut_suite(a_suite.object_owner, a_suite.object_name, gc_context
'_'
else
else
l_context_pos := null;
end
end if;
l_context_no := l_context_no + 1;
end
    end loop;
    l_annotation_pos := a_package_ann_index(gc_context).next(l_annotation_pos);
end
  end loop;
end
end if;
    l_annotation_pos := a_package_ann_index(gc_endcontext).next(l_annotation_pos);
end
  end loop;
end
end if;
l_package_ann_index
    l_package_ann_index tt_annotations_index;
l_suite
    l_suite              ut_suite;
begin
  begin
l_package_ann_index := build_annotation_index(l_annotations);
end
    end if;
return
    return l_suite;
end
  end create_suite;
l_suite_path
    l_suite_path        varchar2(4000 char);
l_parent_path
    l_parent_path       varchar2(4000 char);
l_name
    l_name              varchar2(4000 char);
l_suites_by_path
    l_suites_by_path    tt_schema_suites;
begin
  begin
l_suites_by_path := a_suites_by_path;
    l_suite_path  := l_suites_by_path.last;
else
  else
ut_utils.debug_log(' Parent suite "'
end
  end if;
end
end if;
l_suite_path := l_suites_by_path.prior(l_suite_path);
end
    end loop;
return
    return l_result;
l_annotated_objects
    l_annotated_objects ut_annotated_objects;
l_all_suites
    l_all_suites        tt_schema_suites;
l_result
    l_result            t_schema_suites_info;
begin
  begin
fetch a_annotated_objects bulk collect into l_annotated_objects;
close
    close a_annotated_objects;
end
end if;
end
    end loop;
return
    return l_result;
return
    return build_suites(l_annotations_cursor);
end
end ut_suite_builder;

Exceptions

Name Code Description
l_throws_list := ut_utils.trim_list_elements(ut_utils.string_to_table(a_annotation_text, ',', 'Y'));
else
else
l_throws_list(i) := l_throws_list(i);
end
end if;
end
    end loop;
    
l_throws_list := ut_utils.filter_list( ut_utils.trim_list_elements(l_throws_list), l_regexp_for_excep_nums);
end
    end loop;
return
    return l_exception_number_list;
begin
  begin
a_list := ut_integer_list();
    l_annotation_pos := a_throws_ann_text.first;
l_annotation_pos := a_throws_ann_text.next(l_annotation_pos);
end
    end loop;
end
end if;
begin
    begin
l_annotation_pos := a_annotation_texts.first;
  l_annotation_pos := a_annotation_texts.next( l_annotation_pos);
end
end loop;
l_line_no
    l_line_no           binary_integer;
    l_line_no := a_annotations(a_for_annotation).next( l_line_no );
end
  end loop;
end
end if;
end
    end if;
l_line_no
    l_line_no           binary_integer;
      l_line_no := a_annotations(a_for_annotation).next( l_line_no );
end
    end loop;
end
  end if;
end
end if;
l_warning
    l_warning         varchar2(32767);
l_line_no
    l_line_no           binary_integer;
begin
  begin
l_annotation_name := a_proc_annotations.first;
    l_line_no := a_proc_annotations(l_annotation_name).next(l_line_no);
end
  end loop;
end
end if;
l_annotation_name := a_proc_annotations.next(l_annotation_name);
end
    end loop;
l_annotation_texts
    l_annotation_texts tt_annotation_texts;
l_annotation_pos
    l_annotation_pos   binary_integer;
begin
  begin
l_test := ut_test(a_suite.object_owner, a_suite.object_name, a_procedure_name);
else
    else
l_test.description := a_annotations(gc_test)(a_annotations(gc_test).first);
end
    end if;
end
end if;
end
    end if;
end
    end if;
end
    end if;
end
    end if;
l_context
    l_context   ut_logical_suite;
end
  end if;
end
end loop;
end
    end if;
end
end if;
end
end if;
end
end if;
end
end if;
end
    end if;
begin
  begin
a_before_each_list := ut_executables();
    a_after_each_list := ut_executables();
    l_position := a_annotations.first;
end
end if;
l_position := a_annotations.next( l_position);
end
    end loop;
l_after_each_list
    l_after_each_list    ut_executables;
l_rollback_type
    l_rollback_type      ut_utils.t_rollback_type;
l_annotation_text
    l_annotation_text    varchar2(32767);
l_object_name
    l_object_name        t_object_name;
else
    else
l_object_name := a_suite.object_name;
end
    end if;
end
  end if;
end
end if;
end
    end if;
end
end if;
end
    end if;
end
end if;
end
    end if;
l_end_context_pos
    l_end_context_pos    t_annotation_position;
l_package_ann_index
    l_package_ann_index  tt_annotations_index;
l_annotations
    l_annotations        tt_package_annotations;
l_suite
    l_suite              ut_suite;
l_context_no
    l_context_no         binary_integer := 1;
    l_result := a_package_ann_index(gc_endcontext).next(l_result);
end
  end loop;
end
end if;
return
return l_result;
l_position
l_position           t_annotation_position;
begin
    begin
l_position := a_context_pos;
  l_position := a_annotations.next(l_position);
end
end loop;
return
return l_annotations;
end
    end if;
    l_context_pos := a_package_ann_index(gc_context).first;
end
end if;
l_annotations       := get_annotations_in_context(a_annotations, l_context_pos, l_end_context_pos);
l_package_ann_index := build_annotation_index(l_annotations);
l_suite := ut_suite(a_suite.object_owner, a_suite.object_name, gc_context
'_'
else
else
l_context_pos := null;
end
end if;
l_context_no := l_context_no + 1;
end
    end loop;
    l_annotation_pos := a_package_ann_index(gc_context).next(l_annotation_pos);
end
  end loop;
end
end if;
    l_annotation_pos := a_package_ann_index(gc_endcontext).next(l_annotation_pos);
end
  end loop;
end
end if;
l_package_ann_index
    l_package_ann_index tt_annotations_index;
l_suite
    l_suite              ut_suite;
begin
  begin
l_package_ann_index := build_annotation_index(l_annotations);
end
    end if;
return
    return l_suite;
end
  end create_suite;
l_suite_path
    l_suite_path        varchar2(4000 char);
l_parent_path
    l_parent_path       varchar2(4000 char);
l_name
    l_name              varchar2(4000 char);
l_suites_by_path
    l_suites_by_path    tt_schema_suites;
begin
  begin
l_suites_by_path := a_suites_by_path;
    l_suite_path  := l_suites_by_path.last;
else
  else
ut_utils.debug_log(' Parent suite "'
end
  end if;
end
end if;
l_suite_path := l_suites_by_path.prior(l_suite_path);
end
    end loop;
return
    return l_result;
l_annotated_objects
    l_annotated_objects ut_annotated_objects;
l_all_suites
    l_all_suites        tt_schema_suites;
l_result
    l_result            t_schema_suites_info;
begin
  begin
fetch a_annotated_objects bulk collect into l_annotated_objects;
close
    close a_annotated_objects;
end
end if;
end
    end loop;
return
    return l_result;
return
    return build_suites(l_annotations_cursor);
end
end ut_suite_builder;

BUILD_SCHEMA_SUITES Function

Builds set of hierarchical suites for a given schema

Syntax

function build_schema_suites(a_owner_name varchar2) return t_schema_suites_info

Parameters

Name Description
a_owner_name name of the schema to builds suites for
return list of suites organized into hierarchy

BUILD_SUITES Function

Builds set of hierarchical suites for given annotations

Syntax

function build_suites(a_annotated_objects sys_refcursor) return t_schema_suites_info

Parameters

Name Description
a_annotated_objects cursor returning ut_annotated_object type
return list of suites organized into hierarchy