NamedConfigurationDAOMysqlImpl extends AbstractTableCreatingDAOImpl implements NamedConfigurationDAO { public List<NamedConfiguration> readConfigurations(int tenantId, int assocTypeId, PluginId pluginId) { Preconditions.checkNotNull(pluginId); Preconditions.checkNotNull(pluginId.getUri()); Preconditions.checkNotNull(pluginId.getVersion()); return readConfigurations.execute(tenantId, assocTypeId, pluginId.getUri().toASCIIString(), pluginId.getVersion().toString()); } NamedConfigurationDAOMysqlImpl(DataSource dataSource, SqlScriptService sqlScriptService,
                                          PluginRegistry pluginRegistry); @Override String getDefaultTableName(); @Override String getTableCreatingSQLScriptName(); int updateConfiguration(NamedConfiguration namedConfiguration); int createConfiguration(NamedConfiguration namedConfiguration); int deleteConfiguration(NamedConfiguration namedConfiguration); NamedConfiguration readConfiguration(int tenantId, int assocTypeId, PluginId pluginId, String name); List<NamedConfiguration> readConfigurations(int tenantId, int assocTypeId, PluginId pluginId); NamedConfiguration readActiveConfiguration(int tenantId, int assocTypeId); int deactivateByPlugin(PluginId pluginId); int deactivateByAssocType(Integer tenantId, Integer assocTypeId);  }
@Test public void readConfigurations_getsConfigurationsOrEmptyList() { List<NamedConfiguration> configs; configs = namedConfigurationDAO.readConfigurations(1, 1, waitingGenerator.getId()); assertThat(configs, is(not(nullValue()))); assertThat(configs.size(), is(2)); configs = namedConfigurationDAO.readConfigurations(1, 2, waitingGenerator.getId()); assertThat(configs, is(not(nullValue()))); assertThat(configs.size(), is(1)); configs = namedConfigurationDAO.readConfigurations(1, 3, waitingGenerator.getId()); assertThat(configs, is(not(nullValue()))); assertThat(configs.size(), is(0)); configs = namedConfigurationDAO.readConfigurations(2, 1, waitingGenerator.getId()); assertThat(configs, is(not(nullValue()))); assertThat(configs.size(), is(1)); }
@Test(expected = NullPointerException.class) public void readConfigurations_shouldThrowOnNullPluginId() { namedConfigurationDAO.readConfigurations(1, 1, null); }