BareMetalRemovalUpdater { public String createUpdatedValue(final String value) { final String[] splitParts = value.split(VALUE_SEPARATOR); final List<String> filteredParts = new ArrayList<>(splitParts.length); for (final String part : splitParts) { if (!part.toLowerCase().equals(BARE_METAL)) { filteredParts.add(part); } } final String updatedValue = StringUtils.join(filteredParts, VALUE_SEPARATOR); logger.info("Updated value (without reference to BareMetal): " + updatedValue); return updatedValue; }  void updateConfigurationValuesThatReferenceBareMetal(final Connection conn); List<Map<String, String>> createUpdatedConfigurationItemValues(final Connection conn); void updateConfigurationItems(final Connection conn, final List<Map<String, String>> updatedRows); void updateConfigurationItem(final Connection conn, final String category, final String instance, final String component, final String name, final String value); void findAndUpdateRowsThatReferenceBareMetal(final ResultSet values, final List<Map<String, String>> updatedRows); String createUpdatedValue(final String value); boolean hasReferenceToBareMetal(final String value); static final String VALUE; static final String CATEGORY; static final String INSTANCE; static final String COMPONENT; static final String NAME; static final String SELECT_CONFIGURATION_ITEMS; static final String UPDATE_CONFIGURATION_ITEM; }
@Test public void test_createUpdatedValue_updatesWithSingleValue() throws Exception { assertThat(bareMetalRemovalUpdater.createUpdatedValue("baremetal"), is(equalTo(""))); assertThat(bareMetalRemovalUpdater.createUpdatedValue("baremetal,"), is(equalTo(""))); assertThat(bareMetalRemovalUpdater.createUpdatedValue(",baremetal,"), is(equalTo(""))); }
@Test public void test_createUpdatedValue_updatesWithMultipleValues() throws Exception { assertThat(bareMetalRemovalUpdater.createUpdatedValue("hypervisor_a,baremetal"), is(equalTo("hypervisor_a"))); assertThat(bareMetalRemovalUpdater.createUpdatedValue("baremetal,hypervisor_b"), is(equalTo("hypervisor_b"))); assertThat(bareMetalRemovalUpdater.createUpdatedValue("BAREMETAL,hypervisor_b"), is(equalTo("hypervisor_b"))); assertThat(bareMetalRemovalUpdater.createUpdatedValue("hypervisor_a,baremetal,hypervisor_b"), is(equalTo("hypervisor_a,hypervisor_b"))); }