@Test public void getBinding(){ BindingConfiguration[] bindings = dao.getBindings(); Assert.assertThat(bindings,not(nullValue())); Assert.assertThat(bindings.length,is(1)); }
public BindingConfiguration getBinding(String identifier){ JabbotConfiguration jabbotConfiguration; try { jabbotConfiguration = mapper.readValue(resource,JabbotConfiguration.class); } catch (IOException e) { return null; } if(jabbotConfiguration == null || jabbotConfiguration.getServerList() == null){ return null; } for (BindingConfiguration bindingConfiguration : jabbotConfiguration.getServerList()) { if(bindingConfiguration.getId().equals(identifier)){ return bindingConfiguration; } } return null; }
FileConfigurationDao implements ConfigurationDao { public BindingConfiguration getBinding(String identifier){ JabbotConfiguration jabbotConfiguration; try { jabbotConfiguration = mapper.readValue(resource,JabbotConfiguration.class); } catch (IOException e) { return null; } if(jabbotConfiguration == null || jabbotConfiguration.getServerList() == null){ return null; } for (BindingConfiguration bindingConfiguration : jabbotConfiguration.getServerList()) { if(bindingConfiguration.getId().equals(identifier)){ return bindingConfiguration; } } return null; } }
FileConfigurationDao implements ConfigurationDao { public BindingConfiguration getBinding(String identifier){ JabbotConfiguration jabbotConfiguration; try { jabbotConfiguration = mapper.readValue(resource,JabbotConfiguration.class); } catch (IOException e) { return null; } if(jabbotConfiguration == null || jabbotConfiguration.getServerList() == null){ return null; } for (BindingConfiguration bindingConfiguration : jabbotConfiguration.getServerList()) { if(bindingConfiguration.getId().equals(identifier)){ return bindingConfiguration; } } return null; } FileConfigurationDao(File configFile); }
FileConfigurationDao implements ConfigurationDao { public BindingConfiguration getBinding(String identifier){ JabbotConfiguration jabbotConfiguration; try { jabbotConfiguration = mapper.readValue(resource,JabbotConfiguration.class); } catch (IOException e) { return null; } if(jabbotConfiguration == null || jabbotConfiguration.getServerList() == null){ return null; } for (BindingConfiguration bindingConfiguration : jabbotConfiguration.getServerList()) { if(bindingConfiguration.getId().equals(identifier)){ return bindingConfiguration; } } return null; } FileConfigurationDao(File configFile); JabbotConfiguration getConfiguration(); JabbotConfiguration saveConfiguration(JabbotConfiguration configuration); BindingConfiguration[] getBindings(); BindingConfiguration getBinding(String identifier); BindingConfiguration addBinding(BindingConfiguration configuration); }
FileConfigurationDao implements ConfigurationDao { public BindingConfiguration getBinding(String identifier){ JabbotConfiguration jabbotConfiguration; try { jabbotConfiguration = mapper.readValue(resource,JabbotConfiguration.class); } catch (IOException e) { return null; } if(jabbotConfiguration == null || jabbotConfiguration.getServerList() == null){ return null; } for (BindingConfiguration bindingConfiguration : jabbotConfiguration.getServerList()) { if(bindingConfiguration.getId().equals(identifier)){ return bindingConfiguration; } } return null; } FileConfigurationDao(File configFile); JabbotConfiguration getConfiguration(); JabbotConfiguration saveConfiguration(JabbotConfiguration configuration); BindingConfiguration[] getBindings(); BindingConfiguration getBinding(String identifier); BindingConfiguration addBinding(BindingConfiguration configuration);  }