use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoSOAPClientTestIT method testAddToListFail.
@Test
public void testAddToListFail() throws Exception {
MarketoSource source = new MarketoSource();
source.initialize(null, listProperties);
MarketoClientService client = source.getClientService(null);
//
ListOperationParameters parms = new ListOperationParameters();
parms.setApiMode(SOAP.name());
parms.setListKeyValue(UNDX_TEST_LIST_SMALL);
parms.setLeadKeyValue(new String[] { "12345" });
// first make sure to remove lead
MarketoSyncResult result;
List<SyncStatus> changes;
result = client.addToList(parms);
LOG.debug("result = {}.", result);
changes = result.getRecords();
assertTrue(changes.size() > 0);
for (SyncStatus r : changes) {
assertNotNull(r);
assertNotNull(r.getId());
assertFalse(Boolean.parseBoolean(r.getStatus()));
assertEquals("[20103] Lead Not Found.", r.getAvailableReason());
LOG.debug("r = {}.", r);
}
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoSOAPClientTestIT method testGetMultipleLeadsLeadKeyWithInputComponent.
@Test
public void testGetMultipleLeadsLeadKeyWithInputComponent() throws Exception {
inputProperties.inputOperation.setValue(getMultipleLeads);
inputProperties.leadKeyTypeSOAP.setValue(EMAIL);
inputProperties.afterInputOperation();
inputProperties.batchSize.setValue(100);
inputProperties.leadKeyValues.setValue("undx00@undx.net,undx10@undx.net,undx20@undx.net,undx30@undx.net");
MarketoSource source = new MarketoSource();
source.initialize(null, inputProperties);
MarketoClientService client = source.getClientService(null);
//
MarketoRecordResult result = client.getMultipleLeads(inputProperties, null);
LOG.debug("{}", result);
List<IndexedRecord> records = result.getRecords();
assertEquals(4, records.size());
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoSOAPClientTestIT method testRemoveFromList.
@Test
public void testRemoveFromList() throws Exception {
MarketoSource source = new MarketoSource();
source.initialize(null, listProperties);
MarketoClientService client = source.getClientService(null);
//
ListOperationParameters parms = new ListOperationParameters();
parms.setApiMode(SOAP.name());
parms.setListKeyValue(UNDX_TEST_LIST_SMALL);
parms.setLeadKeyValue(new String[] { createdLeads.get(20).toString() });
// first subscribe lead
MarketoSyncResult result = client.addToList(parms);
List<SyncStatus> changes = result.getRecords();
assertTrue(changes.size() > 0);
for (SyncStatus r : changes) {
assertNotNull(r);
assertNotNull(r.getId());
assertTrue(Boolean.parseBoolean(r.getStatus()));
LOG.debug("r = {}.", r);
}
// then remove it
result = client.removeFromList(parms);
LOG.debug("result = {}.", result);
changes = result.getRecords();
assertTrue(changes.size() > 0);
for (SyncStatus r : changes) {
assertNotNull(r);
assertNotNull(r.getId());
assertTrue(Boolean.parseBoolean(r.getStatus()));
LOG.debug("r = {}.", r);
}
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoSOAPClientTestIT method testGetLeadsChangesIncludeFilter.
@Test
public void testGetLeadsChangesIncludeFilter() throws Exception {
inputProperties.inputOperation.setValue(getLeadChanges);
inputProperties.updateSchemaRelated();
inputProperties.batchSize.setValue(1000);
//
inputProperties.oldestCreateDate.setValue(DATE_OLDEST_CREATE);
inputProperties.latestCreateDate.setValue(DATE_LATEST_CREATE);
inputProperties.setIncludeTypes.setValue(true);
inputProperties.includeTypes.type.getValue().add(NewLead.toString());
inputProperties.includeTypes.type.getValue().add(ChangeDataValue.toString());
MarketoSource source = new MarketoSource();
source.initialize(null, inputProperties);
MarketoClientService client = source.getClientService(null);
//
MarketoRecordResult result = client.getLeadChanges(inputProperties, null);
List<IndexedRecord> changes = result.getRecords();
assertTrue(changes.size() > 0);
for (IndexedRecord r : changes) {
assertTrue("New Lead".equals(r.get(2)) || "Change Data Value".equals(r.get(2)));
}
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoRESTClientTestIT method testGetLeadFailWrongHost.
@Test(expected = IOException.class)
public void testGetLeadFailWrongHost() throws Exception {
iprops.inputOperation.setValue(getLead);
iprops.leadKeyTypeREST.setValue(email);
iprops.connection.endpoint.setValue(ENDPOINT_URL_INEXISTANT);
iprops.afterInputOperation();
//
iprops.leadKeyValue.setValue(EMAIL_INEXISTANT);
MarketoSource source = new MarketoSource();
source.initialize(null, iprops);
MarketoClientService client = null;
client = source.getClientService(null);
//
MarketoRecordResult result = client.getLead(iprops, null);
LOG.debug("{}", result);
List<IndexedRecord> records = result.getRecords();
assertEquals(emptyList(), records);
}
Aggregations