Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class CountyOptionResolver extends SQLBasedOptionResolver {
from
[NBS_SRTE].[dbo].state_county_code_value
where
code_desc_txt like :criteria
status_cd = 'A'
and code_desc_txt like :criteria
and parent_is_cd =:root
order by
indent_level_nbr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public class CountiesListFinder {
code_desc_txt as [name],
indent_level_nbr as [order]
from [NBS_SRTE].[dbo].state_county_code_value
where parent_is_cd = ?
where status_cd = 'A'
and parent_is_cd = ?
order by
indent_level_nbr,
code_desc_txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ where code in (:codes)
code,
code_desc_txt,
indent_level_nbr,
parent_is_cd
parent_is_cd,
status_cd
)
values (:identifier, :name, :order, :stateCode)
values (:identifier, :name, :order, :stateCode, :status)
""";

private final NamedParameterJdbcTemplate template;
Expand Down Expand Up @@ -62,6 +63,14 @@ void reset() {
}

void create(final String name, final String stateCode) {
create(name, stateCode, "A");
}

void createInactive(final String name, final String stateCode) {
create(name, stateCode, "I");
}

private void create(final String name, final String stateCode, final String status) {

String code = UUID.randomUUID().toString().replace("-", "").substring(0, 20);

Expand All @@ -73,7 +82,8 @@ void create(final String name, final String stateCode) {
"identifier", code,
"name", name,
"stateCode", stateCode,
"order", order);
"order", order,
"status", status);

template.execute(
CREATE, new MapSqlParameterSource(parameters), PreparedStatement::executeUpdate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ public void the_county_exists_in_the_value_set_for_state(final String name, fina
mother.create(name, state);
}

@Given("there is an inactive {string} county for {state} state")
public void an_inactive_county_exists_in_the_value_set_for_state(
final String name, final String state) {
mother.createInactive(name, state);
}

@ParameterType(name = "state", value = ".+")
public String state(final String value) {
return stateResolver.resolve(value).orElse(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,18 @@ Feature: County Options REST API
Scenario: I cannot find specific counties in the wrong state
When I am trying to find counties that start with "reg" for Missouri state
Then there aren't any options available

Scenario: Inactive counties are not listed for a state
Given there is a "Sterling County" county for Missouri state
And there is an inactive "Surrey Borough" county for Missouri state
When I am trying to find counties for Missouri state
Then there are options available
And the option named "Sterling County" is included
And the option named "Surrey Borough" is not included

Scenario: Inactive counties are excluded from autocomplete
Given there is an inactive "regalia" county for New York state
When I am trying to find counties that start with "reg" for New York state
Then there are options available
And the option named "regrate" is included
And the option named "regalia" is not included
Loading