use of org.pentaho.di.imp.rules.JobHasDescriptionImportRule in project pentaho-kettle by pentaho.
the class RepositoryExporterTest method getImportRules.
private ImportRules getImportRules() {
ImportRules imp = new ImportRules();
List<ImportRuleInterface> impRules = new ArrayList<ImportRuleInterface>(1);
JobHasDescriptionImportRule rule = new JobHasDescriptionImportRule();
rule.setEnabled(true);
rule.setMinLength(19000);
impRules.add(rule);
TransformationHasDescriptionImportRule trRule = new TransformationHasDescriptionImportRule() {
public String toString() {
return "stub to avoid call to Plugin registry";
}
};
trRule.setEnabled(true);
trRule.setMinLength(19001);
impRules.add(trRule);
imp.setRules(impRules);
return imp;
}
use of org.pentaho.di.imp.rules.JobHasDescriptionImportRule in project pentaho-kettle by pentaho.
the class JobHasDescriptionImportRuleComposite method getCompositeData.
public void getCompositeData(ImportRuleInterface importRule) {
JobHasDescriptionImportRule rule = (JobHasDescriptionImportRule) importRule;
rule.setMinLength(Const.toInt(text.getText(), 0));
}
use of org.pentaho.di.imp.rules.JobHasDescriptionImportRule in project pentaho-kettle by pentaho.
the class JobHasDescriptionImportRuleComposite method setCompositeData.
public void setCompositeData(ImportRuleInterface importRule) {
JobHasDescriptionImportRule rule = (JobHasDescriptionImportRule) importRule;
text.setText(Integer.toString(rule.getMinLength()));
}
use of org.pentaho.di.imp.rules.JobHasDescriptionImportRule in project pentaho-kettle by pentaho.
the class JobHasDescriptionImportRuleIT method testRule.
public void testRule() throws Exception {
JobMeta jobMeta = new JobMeta();
jobMeta.setDescription("This job is used for testing an import rule");
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.findPluginWithId(ImportRulePluginType.class, "JobHasDescription");
assertNotNull("The 'job has description' rule could not be found in the plugin registry!", plugin);
JobHasDescriptionImportRule rule = (JobHasDescriptionImportRule) registry.loadClass(plugin);
assertNotNull("The 'job has description rule' class could not be loaded by the plugin registry!", plugin);
rule.setMinLength(20);
rule.setEnabled(true);
List<ImportValidationFeedback> feedback = rule.verifyRule(jobMeta);
assertTrue("We didn't get any feedback from the 'job has description rule'", !feedback.isEmpty());
assertTrue("An approval ruling was expected", feedback.get(0).getResultType() == ImportValidationResultType.APPROVAL);
rule.setMinLength(2000);
rule.setEnabled(true);
feedback = rule.verifyRule(jobMeta);
assertTrue("We didn't get any feedback from the 'job has description rule'", !feedback.isEmpty());
assertTrue("An error ruling was expected", feedback.get(0).getResultType() == ImportValidationResultType.ERROR);
rule.setEnabled(false);
feedback = rule.verifyRule(jobMeta);
assertTrue("We didn't expect any feedback from the 'job has description rule' while disabled", feedback.isEmpty());
}
Aggregations