use of org.pentaho.di.imp.rules.TransformationHasDescriptionImportRule in project pentaho-kettle by pentaho.
the class TransformationHasDescriptionImportRuleComposite method setCompositeData.
public void setCompositeData(ImportRuleInterface importRule) {
TransformationHasDescriptionImportRule rule = (TransformationHasDescriptionImportRule) importRule;
text.setText(Integer.toString(rule.getMinLength()));
}
use of org.pentaho.di.imp.rules.TransformationHasDescriptionImportRule 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.TransformationHasDescriptionImportRule in project pentaho-kettle by pentaho.
the class TransformationHasDescriptionImportRuleComposite method getCompositeData.
public void getCompositeData(ImportRuleInterface importRule) {
TransformationHasDescriptionImportRule rule = (TransformationHasDescriptionImportRule) importRule;
rule.setMinLength(Const.toInt(text.getText(), 0));
}
use of org.pentaho.di.imp.rules.TransformationHasDescriptionImportRule in project pentaho-kettle by pentaho.
the class TransformationHasDescriptionImportRuleIT method testRule.
public void testRule() throws Exception {
TransMeta transMeta = new TransMeta();
transMeta.setDescription("This transformation is used for testing an import rule");
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.findPluginWithId(ImportRulePluginType.class, "TransformationHasDescription");
assertNotNull("The 'transformation has description' rule could not be found in the plugin registry!", plugin);
TransformationHasDescriptionImportRule rule = (TransformationHasDescriptionImportRule) registry.loadClass(plugin);
assertNotNull("The 'transformation has description rule' class could not be loaded by the plugin registry!", plugin);
rule.setMinLength(20);
rule.setEnabled(true);
List<ImportValidationFeedback> feedback = rule.verifyRule(transMeta);
assertTrue("We didn't get any feedback from the 'transformation 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(transMeta);
assertTrue("We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty());
assertTrue("An error ruling was expected", feedback.get(0).getResultType() == ImportValidationResultType.ERROR);
rule.setEnabled(false);
feedback = rule.verifyRule(transMeta);
assertTrue("We didn't expect any feedback from the 'transformation has description rule' while disabled", feedback.isEmpty());
}
Aggregations