use of org.pentaho.di.core.CheckResultInterface in project pentaho-kettle by pentaho.
the class MQTTConsumerMetaTest method testCheckDefaults.
@Test
public void testCheckDefaults() {
List<CheckResultInterface> remarks = new ArrayList<>();
meta.check(remarks, null, null, null, null, null, null, new Variables(), null, null);
assertEquals(0, remarks.size());
}
use of org.pentaho.di.core.CheckResultInterface in project pentaho-kettle by pentaho.
the class MQTTConsumerMetaTest method testCheckFailAll.
@Test
public void testCheckFailAll() {
List<CheckResultInterface> remarks = new ArrayList<>();
meta.setKeepAliveInterval("asdf");
meta.setMaxInflight("asdf");
meta.setConnectionTimeout("asdf");
meta.setCleanSession("asdf");
meta.setAutomaticReconnect("adsf");
meta.setMqttVersion("9");
meta.check(remarks, null, null, null, null, null, null, new Variables(), null, null);
assertEquals(6, remarks.size());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotANumber", BaseMessages.getString(PKG, "MQTTDialog.Options." + KEEP_ALIVE_INTERVAL)), remarks.get(0).getText());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotANumber", BaseMessages.getString(PKG, "MQTTDialog.Options." + MAX_INFLIGHT)), remarks.get(1).getText());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotANumber", BaseMessages.getString(PKG, "MQTTDialog.Options." + CONNECTION_TIMEOUT)), remarks.get(2).getText());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotABoolean", BaseMessages.getString(PKG, "MQTTDialog.Options." + CLEAN_SESSION)), remarks.get(3).getText());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotCorrectVersion", BaseMessages.getString(PKG, "MQTTDialog.Options." + MQTT_VERSION)), remarks.get(4).getText());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotABoolean", BaseMessages.getString(PKG, "MQTTDialog.Options." + AUTOMATIC_RECONNECT)), remarks.get(5).getText());
}
use of org.pentaho.di.core.CheckResultInterface in project pentaho-kettle by pentaho.
the class MQTTProducerMetaTest method testCheckOptionsFail.
@Test
public void testCheckOptionsFail() {
List<CheckResultInterface> remarks = new ArrayList<>();
MQTTProducerMeta meta = new MQTTProducerMeta();
meta.setMqttServer("theserver:1883");
meta.setClientId("client100");
meta.setTopic("newtopic");
meta.setQOS("2");
meta.setMessageField("Messages");
meta.setUsername("testuser");
meta.setKeepAliveInterval("asdf");
meta.setMaxInflight("asdf");
meta.setConnectionTimeout("asdf");
meta.setCleanSession("asdf");
meta.setAutomaticReconnect("adsf");
meta.setMqttVersion("asdf");
meta.check(remarks, null, null, null, null, null, null, new Variables(), null, null);
assertEquals(6, remarks.size());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotANumber", BaseMessages.getString(PKG, "MQTTDialog.Options." + KEEP_ALIVE_INTERVAL)), remarks.get(0).getText());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotANumber", BaseMessages.getString(PKG, "MQTTDialog.Options." + MAX_INFLIGHT)), remarks.get(1).getText());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotANumber", BaseMessages.getString(PKG, "MQTTDialog.Options." + CONNECTION_TIMEOUT)), remarks.get(2).getText());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotABoolean", BaseMessages.getString(PKG, "MQTTDialog.Options." + CLEAN_SESSION)), remarks.get(3).getText());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotCorrectVersion", BaseMessages.getString(PKG, "MQTTDialog.Options." + MQTT_VERSION)), remarks.get(4).getText());
assertEquals(BaseMessages.getString(PKG, "MQTTMeta.CheckResult.NotABoolean", BaseMessages.getString(PKG, "MQTTDialog.Options." + AUTOMATIC_RECONNECT)), remarks.get(5).getText());
}
use of org.pentaho.di.core.CheckResultInterface in project pentaho-kettle by pentaho.
the class SalesforceMetaTest method testBaseCheck.
@SuppressWarnings("deprecation")
@Test
public void testBaseCheck() {
SalesforceStepMeta meta = mock(SalesforceStepMeta.class, Mockito.CALLS_REAL_METHODS);
meta.setDefault();
List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
meta.check(remarks, null, null, null, null, null, null, null, null, null);
boolean hasError = false;
for (CheckResultInterface cr : remarks) {
if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
hasError = true;
}
}
assertFalse(remarks.isEmpty());
assertTrue(hasError);
remarks.clear();
meta.setDefault();
meta.setUsername("anonymous");
meta.check(remarks, null, null, null, null, null, null, null, null, null);
hasError = false;
for (CheckResultInterface cr : remarks) {
if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
hasError = true;
}
}
assertFalse(remarks.isEmpty());
assertFalse(hasError);
remarks.clear();
meta.setDefault();
meta.setTargetURL(null);
meta.setUserName("anonymous");
meta.setPassword("password");
meta.check(remarks, null, null, null, null, null, null, null, null, null);
hasError = false;
for (CheckResultInterface cr : remarks) {
if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
hasError = true;
}
}
assertFalse(remarks.isEmpty());
assertTrue(hasError);
remarks.clear();
meta.setDefault();
meta.setUsername("anonymous");
meta.setModule(null);
meta.check(remarks, null, null, null, null, null, null, null, null, null);
hasError = false;
for (CheckResultInterface cr : remarks) {
if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
hasError = true;
}
}
assertFalse(remarks.isEmpty());
assertTrue(hasError);
}
use of org.pentaho.di.core.CheckResultInterface in project pentaho-kettle by pentaho.
the class SalesforceInputMetaTest method testCheck.
@Test
public void testCheck() {
SalesforceInputMeta meta = new SalesforceInputMeta();
meta.setDefault();
List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
meta.check(remarks, null, null, null, null, null, null, null, null, null);
boolean hasError = false;
for (CheckResultInterface cr : remarks) {
if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
hasError = true;
}
}
assertFalse(remarks.isEmpty());
assertTrue(hasError);
remarks.clear();
meta.setDefault();
meta.setUsername("user");
meta.setInputFields(new SalesforceInputField[] { new SalesforceInputField("test") });
meta.check(remarks, null, null, null, null, null, null, null, null, null);
hasError = false;
for (CheckResultInterface cr : remarks) {
if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
hasError = true;
}
}
assertFalse(remarks.isEmpty());
assertFalse(hasError);
remarks.clear();
meta.setDefault();
meta.setUsername("user");
meta.setIncludeDeletionDate(true);
meta.setIncludeModule(true);
meta.setIncludeRowNumber(true);
meta.setIncludeSQL(true);
meta.setIncludeTargetURL(true);
meta.setIncludeTimestamp(true);
meta.setInputFields(new SalesforceInputField[] { new SalesforceInputField("test") });
meta.check(remarks, null, null, null, null, null, null, null, null, null);
hasError = false;
int errorCount = 0;
for (CheckResultInterface cr : remarks) {
if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
hasError = true;
errorCount++;
}
}
assertFalse(remarks.isEmpty());
assertTrue(hasError);
assertEquals(6, errorCount);
remarks.clear();
meta.setDefault();
meta.setUsername("user");
meta.setIncludeDeletionDate(true);
meta.setDeletionDateField("delDate");
meta.setIncludeModule(true);
meta.setModuleField("mod");
meta.setIncludeRowNumber(true);
meta.setRowNumberField("rownum");
meta.setIncludeSQL(true);
meta.setSQLField("theSQL");
meta.setIncludeTargetURL(true);
meta.setTargetURLField("theURL");
meta.setIncludeTimestamp(true);
meta.setTimestampField("ts_Field");
meta.setInputFields(new SalesforceInputField[] { new SalesforceInputField("test") });
meta.check(remarks, null, null, null, null, null, null, null, null, null);
hasError = false;
for (CheckResultInterface cr : remarks) {
if (cr.getType() == CheckResult.TYPE_RESULT_ERROR) {
hasError = true;
errorCount++;
}
}
assertFalse(remarks.isEmpty());
assertFalse(hasError);
}
Aggregations