@Test(expected = NullPointerException.class) public void updateConfiguration_shouldThrowOnNullConfiguration() { NamedConfiguration config = new NamedConfiguration(1, 1, waitingGenerator.getId(), "Configuration 1", null, false); namedConfigurationDAO.updateConfiguration(config); }
public int updateConfiguration(NamedConfiguration namedConfiguration) { Preconditions.checkNotNull(namedConfiguration); Preconditions.checkNotNull(namedConfiguration.getPluginId()); Preconditions.checkNotNull(namedConfiguration.getPluginId().getUri()); Preconditions.checkNotNull(namedConfiguration.getPluginId().getVersion()); Preconditions.checkNotNull(namedConfiguration.getName()); Preconditions.checkNotNull(namedConfiguration.getConfiguration()); Preconditions.checkNotNull(namedConfiguration.getConfiguration().getConfigurationName()); String oldName = namedConfiguration.getName(); String newName = namedConfiguration.getConfiguration().getConfigurationName(); int rowsAffected; if (namedConfiguration.isActive()) { updateAllInactive.update(namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId()); rowsAffected = updateConfigurationActive.update(newName, namedConfiguration.getConfiguration().marshal(false), namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(), namedConfiguration.getPluginId().getUri(), namedConfiguration.getPluginId().getVersion(), oldName); } else rowsAffected = updateConfigurationInactive.update(newName, namedConfiguration.getConfiguration().marshal(false), namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(), namedConfiguration.getPluginId().getUri(), namedConfiguration.getPluginId().getVersion(), oldName); namedConfiguration.setName(newName); return rowsAffected; }
NamedConfigurationDAOMysqlImpl extends AbstractTableCreatingDAOImpl implements NamedConfigurationDAO { public int updateConfiguration(NamedConfiguration namedConfiguration) { Preconditions.checkNotNull(namedConfiguration); Preconditions.checkNotNull(namedConfiguration.getPluginId()); Preconditions.checkNotNull(namedConfiguration.getPluginId().getUri()); Preconditions.checkNotNull(namedConfiguration.getPluginId().getVersion()); Preconditions.checkNotNull(namedConfiguration.getName()); Preconditions.checkNotNull(namedConfiguration.getConfiguration()); Preconditions.checkNotNull(namedConfiguration.getConfiguration().getConfigurationName()); String oldName = namedConfiguration.getName(); String newName = namedConfiguration.getConfiguration().getConfigurationName(); int rowsAffected; if (namedConfiguration.isActive()) { updateAllInactive.update(namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId()); rowsAffected = updateConfigurationActive.update(newName, namedConfiguration.getConfiguration().marshal(false), namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(), namedConfiguration.getPluginId().getUri(), namedConfiguration.getPluginId().getVersion(), oldName); } else rowsAffected = updateConfigurationInactive.update(newName, namedConfiguration.getConfiguration().marshal(false), namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(), namedConfiguration.getPluginId().getUri(), namedConfiguration.getPluginId().getVersion(), oldName); namedConfiguration.setName(newName); return rowsAffected; } }
NamedConfigurationDAOMysqlImpl extends AbstractTableCreatingDAOImpl implements NamedConfigurationDAO { public int updateConfiguration(NamedConfiguration namedConfiguration) { Preconditions.checkNotNull(namedConfiguration); Preconditions.checkNotNull(namedConfiguration.getPluginId()); Preconditions.checkNotNull(namedConfiguration.getPluginId().getUri()); Preconditions.checkNotNull(namedConfiguration.getPluginId().getVersion()); Preconditions.checkNotNull(namedConfiguration.getName()); Preconditions.checkNotNull(namedConfiguration.getConfiguration()); Preconditions.checkNotNull(namedConfiguration.getConfiguration().getConfigurationName()); String oldName = namedConfiguration.getName(); String newName = namedConfiguration.getConfiguration().getConfigurationName(); int rowsAffected; if (namedConfiguration.isActive()) { updateAllInactive.update(namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId()); rowsAffected = updateConfigurationActive.update(newName, namedConfiguration.getConfiguration().marshal(false), namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(), namedConfiguration.getPluginId().getUri(), namedConfiguration.getPluginId().getVersion(), oldName); } else rowsAffected = updateConfigurationInactive.update(newName, namedConfiguration.getConfiguration().marshal(false), namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(), namedConfiguration.getPluginId().getUri(), namedConfiguration.getPluginId().getVersion(), oldName); namedConfiguration.setName(newName); return rowsAffected; } NamedConfigurationDAOMysqlImpl(DataSource dataSource, SqlScriptService sqlScriptService,
                                          PluginRegistry pluginRegistry); }
NamedConfigurationDAOMysqlImpl extends AbstractTableCreatingDAOImpl implements NamedConfigurationDAO { public int updateConfiguration(NamedConfiguration namedConfiguration) { Preconditions.checkNotNull(namedConfiguration); Preconditions.checkNotNull(namedConfiguration.getPluginId()); Preconditions.checkNotNull(namedConfiguration.getPluginId().getUri()); Preconditions.checkNotNull(namedConfiguration.getPluginId().getVersion()); Preconditions.checkNotNull(namedConfiguration.getName()); Preconditions.checkNotNull(namedConfiguration.getConfiguration()); Preconditions.checkNotNull(namedConfiguration.getConfiguration().getConfigurationName()); String oldName = namedConfiguration.getName(); String newName = namedConfiguration.getConfiguration().getConfigurationName(); int rowsAffected; if (namedConfiguration.isActive()) { updateAllInactive.update(namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId()); rowsAffected = updateConfigurationActive.update(newName, namedConfiguration.getConfiguration().marshal(false), namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(), namedConfiguration.getPluginId().getUri(), namedConfiguration.getPluginId().getVersion(), oldName); } else rowsAffected = updateConfigurationInactive.update(newName, namedConfiguration.getConfiguration().marshal(false), namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(), namedConfiguration.getPluginId().getUri(), namedConfiguration.getPluginId().getVersion(), oldName); namedConfiguration.setName(newName); return rowsAffected; } 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); }
NamedConfigurationDAOMysqlImpl extends AbstractTableCreatingDAOImpl implements NamedConfigurationDAO { public int updateConfiguration(NamedConfiguration namedConfiguration) { Preconditions.checkNotNull(namedConfiguration); Preconditions.checkNotNull(namedConfiguration.getPluginId()); Preconditions.checkNotNull(namedConfiguration.getPluginId().getUri()); Preconditions.checkNotNull(namedConfiguration.getPluginId().getVersion()); Preconditions.checkNotNull(namedConfiguration.getName()); Preconditions.checkNotNull(namedConfiguration.getConfiguration()); Preconditions.checkNotNull(namedConfiguration.getConfiguration().getConfigurationName()); String oldName = namedConfiguration.getName(); String newName = namedConfiguration.getConfiguration().getConfigurationName(); int rowsAffected; if (namedConfiguration.isActive()) { updateAllInactive.update(namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId()); rowsAffected = updateConfigurationActive.update(newName, namedConfiguration.getConfiguration().marshal(false), namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(), namedConfiguration.getPluginId().getUri(), namedConfiguration.getPluginId().getVersion(), oldName); } else rowsAffected = updateConfigurationInactive.update(newName, namedConfiguration.getConfiguration().marshal(false), namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(), namedConfiguration.getPluginId().getUri(), namedConfiguration.getPluginId().getVersion(), oldName); namedConfiguration.setName(newName); return rowsAffected; } 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);  }