本文整理汇总了Java中org.easyrec.model.plugin.NamedConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java NamedConfiguration类的具体用法?Java NamedConfiguration怎么用?Java NamedConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NamedConfiguration类属于org.easyrec.model.plugin包,在下文中一共展示了NamedConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConfiguration
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@Override
public int createConfiguration(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());
if (namedConfiguration.isActive())
updateAllInactive.update(namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId());
namedConfiguration.getConfiguration().setConfigurationName(namedConfiguration.getName());
return createConfiguration.update(namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(),
namedConfiguration.getPluginId().getUri().toASCIIString(),
namedConfiguration.getPluginId().getVersion().toString(), namedConfiguration.getName(),
namedConfiguration.getConfiguration().marshal(false), namedConfiguration.isActive());
}
示例2: readActiveConfiguration_shouldGetActiveConfigurationOrNull
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@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());
}
示例3: makeARMConfiguration
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
private void makeARMConfiguration(Generator<GeneratorConfiguration, GeneratorStatistics> generator, int tenantId,
String assocType, int assocTypeId, String actionType) {
GeneratorConfiguration generatorConfiguration = generator.newConfiguration();
generatorConfiguration.setAssociationType(assocType);
try {
Field actionTypeField = generatorConfiguration.getClass().getDeclaredField("actionType");
actionTypeField.setAccessible(true);
actionTypeField.set(generatorConfiguration, actionType);
} catch (Exception e) {
logger.warn("Failed to set action type on ARM config", e);
}
NamedConfiguration namedConfiguration = new NamedConfiguration(tenantId, assocTypeId,
new PluginId("http://www.easyrec.org/plugins/ARM", easyrecSettings.getVersion()),
"Default Configuration", generatorConfiguration, true);
namedConfigurationDAO.createConfiguration(namedConfiguration);
}
示例4: runGeneratorsForTenant
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
public List<LogEntry> runGeneratorsForTenant(int tenantId, Predicate<GeneratorStatistics> writeLog,
boolean writeLogLast) {
Map<String, Integer> assocTypes = assocTypeDAO.getMapping(tenantId);
List<LogEntry> result = Lists.newArrayList();
for (Integer assocTypeId : assocTypes.values()) {
NamedConfiguration namedConfiguration = namedConfigurationDAO.readActiveConfiguration(tenantId,
assocTypeId);
if (namedConfiguration == null) continue;
result.add(runGenerator(namedConfiguration, writeLog, writeLogLast));
}
return result;
}
示例5: createConfiguration
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
public int createConfiguration(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());
if (namedConfiguration.isActive())
updateAllInactive.update(namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId());
namedConfiguration.getConfiguration().setConfigurationName(namedConfiguration.getName());
return createConfiguration.update(namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(),
namedConfiguration.getPluginId().getUri().toASCIIString(),
namedConfiguration.getPluginId().getVersion().toString(), namedConfiguration.getName(),
namedConfiguration.getConfiguration().marshal(false), namedConfiguration.isActive());
}
示例6: runGeneratorsForTenant
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
public List<LogEntry> runGeneratorsForTenant(int tenantId, Predicate<GeneratorStatistics> writeLog,
boolean writeLogLast, boolean forceRun) {
List<NamedConfiguration> configurations = namedConfigurationDAO.readActiveConfigurations(tenantId);
List<LogEntry> result = Lists.newArrayList();
for (NamedConfiguration namedConfiguration : configurations) {
if (namedConfiguration == null) continue;
LogEntry le = runGenerator(namedConfiguration, writeLog, writeLogLast, forceRun);
if (le != null) result.add(le);
}
return result;
}
示例7: updateConfiguration
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@Override
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;
}
示例8: deleteConfiguration
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@Override
public int deleteConfiguration(NamedConfiguration namedConfiguration) {
Preconditions.checkNotNull(namedConfiguration);
Preconditions.checkNotNull(namedConfiguration.getName());
Preconditions.checkNotNull(namedConfiguration.getPluginId());
Preconditions.checkNotNull(namedConfiguration.getPluginId().getUri());
Preconditions.checkNotNull(namedConfiguration.getPluginId().getVersion());
return deleteConfiguration.update(namedConfiguration.getTenantId(), namedConfiguration.getAssocTypeId(),
namedConfiguration.getPluginId().getUri().toASCIIString(),
namedConfiguration.getPluginId().getVersion().toString(), namedConfiguration.getName());
}
示例9: readConfiguration
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@Override
public NamedConfiguration readConfiguration(int tenantId, int assocTypeId, PluginId pluginId, String name) {
Preconditions.checkNotNull(pluginId);
Preconditions.checkNotNull(pluginId.getUri());
Preconditions.checkNotNull(pluginId.getVersion());
Preconditions.checkNotNull(name);
return readConfiguration.findObject(tenantId, assocTypeId, pluginId.getUri().toASCIIString(),
pluginId.getVersion().toString(), name);
}
示例10: readConfigurations
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@Override
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());
}
示例11: readConfiguration_shouldReturnUnmarshalFailedConfiguration
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@Test
@DataSet("/dbunit/pluginContainer/plugin_configuration+erronous_name_config.xml")
public void readConfiguration_shouldReturnUnmarshalFailedConfiguration() {
NamedConfiguration config;
config = namedConfigurationDAO.readConfiguration(1, 1, waitingGenerator.getId(), "Configuration 1");
assertThat(config, is(not(nullValue())));
assertThat(config.getName(), is("Configuration 1"));
assertThat(config.getConfiguration(), is(GeneratorConfigurationConstants.CONF_UNMARSHAL_FAILED));
// this should print a warning in the log
config = namedConfigurationDAO.readConfiguration(1, 1, waitingGenerator.getId(), "XXXX");
}
示例12: readConfiguration_getsConfigurationOrNull
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@Test
public void readConfiguration_getsConfigurationOrNull() {
NamedConfiguration config;
config = namedConfigurationDAO.readConfiguration(1, 1, waitingGenerator.getId(), "Configuration 1");
assertThat(config, is(not(nullValue())));
assertThat(config.getName(), is("Configuration 1"));
assertThat(config.getConfiguration().getAssociationType(), is("1-1-1"));
config = namedConfigurationDAO.readConfiguration(1, 1, waitingGenerator.getId(), "Configuration 2");
assertThat(config, is(not(nullValue())));
assertThat(config.getName(), is("Configuration 2"));
assertThat(config.getConfiguration().getAssociationType(), is("1-1-2"));
config = namedConfigurationDAO.readConfiguration(1, 1, waitingGenerator.getId(), "Configuration 3");
assertThat(config, is(nullValue()));
config = namedConfigurationDAO.readConfiguration(1, 2, waitingGenerator.getId(), "Configuration 1");
assertThat(config, is(not(nullValue())));
assertThat(config.getName(), is("Configuration 1"));
assertThat(config.getConfiguration().getAssociationType(), is("1-2-1"));
config = namedConfigurationDAO.readConfiguration(2, 1, waitingGenerator.getId(), "Configuration 1");
assertThat(config, is(not(nullValue())));
assertThat(config.getName(), is("Configuration 1"));
assertThat(config.getConfiguration().getAssociationType(), is("2-1-1"));
}
示例13: updateConfiguration_shouldIgnoreWhenNotFound
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@Test
@ExpectedDataSet("/dbunit/pluginContainer/plugin_configuration.xml")
public void updateConfiguration_shouldIgnoreWhenNotFound() {
NamedConfiguration config =
new NamedConfiguration(1, 1, waitingGenerator.getId(), "Configuration 3", CONFIG_1_1_3, false);
int rowsModified = namedConfigurationDAO.updateConfiguration(config);
assertThat(rowsModified, is(0));
}
示例14: updateConfiguration_shouldThrowOnExistingName
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@Test(expected = DuplicateKeyException.class)
@ExpectedDataSet("/dbunit/pluginContainer/plugin_configuration.xml")
public void updateConfiguration_shouldThrowOnExistingName() {
WaitingGeneratorConfiguration config_1_1_2 = new WaitingGeneratorConfiguration();
config_1_1_2.setConfigurationName("Configuration 2");
config_1_1_2.setAssociationType("1-1-2");
config_1_1_2.setTimeout(2000);
NamedConfiguration config =
new NamedConfiguration(1, 1, waitingGenerator.getId(), "Configuration 1", config_1_1_2, false);
namedConfigurationDAO.updateConfiguration(config);
}
示例15: createConfiguration_shouldSave
import org.easyrec.model.plugin.NamedConfiguration; //导入依赖的package包/类
@Test
@ExpectedDataSet("/dbunit/pluginContainer/plugin_configuration+saved.xml")
public void createConfiguration_shouldSave() {
NamedConfiguration namedConfiguration =
new NamedConfiguration(1, 1, waitingGenerator.getId(), "Configuration 3", CONFIG_1_1_3, false);
int rowsAffected = namedConfigurationDAO.createConfiguration(namedConfiguration);
assertThat(rowsAffected, is(1));
}