NamedConfigurationDAOMysqlImpl extends AbstractTableCreatingDAOImpl implements NamedConfigurationDAO { public NamedConfiguration readActiveConfiguration(int tenantId, int assocTypeId) { return readActiveConfiguration.findObject(tenantId, assocTypeId); } 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 readActiveConfiguration_shouldGetActiveConfigurationOrNull() { NamedConfiguration config; config = namedConfigurationDAO.readActiveConfiguration(1, 1); assertThat(config, not(nullValue())); assertThat(config.getName(), is("Configuration 1")); assertThat(config.getConfiguration().getAssociationType(), is("1-1-1")); config = namedConfigurationDAO.readActiveConfiguration(1, 2); assertThat(config, not(nullValue())); assertThat(config.getName(), is("Configuration 1")); assertThat(config.getConfiguration().getAssociationType(), is("1-2-1")); config = namedConfigurationDAO.readActiveConfiguration(1, 3); assertThat(config, nullValue()); config = namedConfigurationDAO.readActiveConfiguration(2, 1); assertThat(config, not(nullValue())); assertThat(config.getName(), is("Configuration 1")); assertThat(config.getConfiguration().getAssociationType(), is("2-1-1")); config = namedConfigurationDAO.readActiveConfiguration(3, 1); assertThat(config, nullValue()); }