private PropertyDto findById(List<PropertyDto> properties, int id) { for (PropertyDto property : properties) { if (property.getId() == id) { return property; } } return null; }
@Test public void selectProjectProperties() { setupData("selectProjectProperties"); List<PropertyDto> properties = dao.selectProjectProperties("org.struts:struts"); assertThat(properties.size(), is(1)); PropertyDto first = properties.get(0); assertThat(first.getKey(), is("struts.one")); assertThat(first.getValue(), is("one")); }
@Test public void selectGlobalProperties() { setupData("selectGlobalProperties"); List<PropertyDto> properties = dao.selectGlobalProperties(); assertThat(properties.size(), is(2)); PropertyDto first = findById(properties, 1); assertThat(first.getKey(), is("global.one")); assertThat(first.getValue(), is("one")); PropertyDto second = findById(properties, 2); assertThat(second.getKey(), is("global.two")); assertThat(second.getValue(), is("two")); }
private Integer getJmsBrokerPort() { PropertyDto properties = configurationAccess.getProperties(); Integer jmsBrokerPort = properties.getJmsBrokerPort(); return jmsBrokerPort; }
private String getJmsBrokerHost() { PropertyDto properties = configurationAccess.getProperties(); String jmsBrokerHost = properties.getJmsBrokerHost(); return jmsBrokerHost; }