use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoRESTClientTestIT method testGetMultipleLeadsListId.
@Test
public void testGetMultipleLeadsListId() throws Exception {
iprops.inputOperation.setValue(getMultipleLeads);
iprops.afterInputOperation();
iprops.batchSize.setValue(10);
//
iprops.leadSelectorREST.setValue(StaticListSelector);
iprops.listParam.setValue(STATIC_LIST_ID);
iprops.listParamListId.setValue(UNDX_TEST_LIST_SMALL_ID);
MarketoSource source = new MarketoSource();
source.initialize(null, iprops);
MarketoClientService client = source.getClientService(null);
//
MarketoRecordResult result = client.getMultipleLeads(iprops, null);
LOG.debug("{}", result);
assertTrue(result.isSuccess());
assertNotNull(result.getErrors());
assertNotEquals(0, result.getRecordCount());
assertNotEquals(0, result.getRemainCount());
assertTrue(result.getRecordCount() > 4);
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoRESTClientTestIT method testGetMultipleLeadsListNamePagination.
@Test
public void testGetMultipleLeadsListNamePagination() throws Exception {
iprops.inputOperation.setValue(getMultipleLeads);
iprops.afterInputOperation();
iprops.batchSize.setValue(104);
iprops.leadSelectorREST.setValue(StaticListSelector);
iprops.listParam.setValue(STATIC_LIST_NAME);
iprops.listParamListName.setValue(UNDX_TEST_LIST_SMALL);
MarketoSource source = new MarketoSource();
source.initialize(null, iprops);
MarketoClientService client = source.getClientService(null);
//
MarketoRecordResult result = client.getMultipleLeads(iprops, null);
int counted = result.getRecordCount();
assertTrue(result.getRecordCount() > 0);
while (result.getRemainCount() > 0) {
result = client.getMultipleLeads(iprops, result.getStreamPosition());
assertNotNull(result.getRecords().get(0).get(0));
LOG.debug("{}", result);
counted += result.getRecordCount();
}
LOG.debug(result.getRecords().get(0).getSchema().toString());
assertEquals("int", result.getRecords().get(0).getSchema().getField("id").schema().getTypes().get(0).getName());
assertTrue(counted > 4);
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoRESTClientTestIT method testGetLeadsChangesPagination.
@Test
public void testGetLeadsChangesPagination() throws Exception {
iprops.afterInputOperation();
iprops.batchSize.setValue(300);
iprops.sinceDateTime.setValue(DATE_OLDEST_CREATE);
iprops.fieldList.setValue("id,email,firstName,lastName,company");
//
MarketoSource source = new MarketoSource();
source.initialize(null, iprops);
MarketoClientService client = source.getClientService(null);
//
MarketoRecordResult result = client.getLeadChanges(iprops, null);
LOG.debug("{}", result);
List<IndexedRecord> changes = null;
int counted = 0;
result = client.getLeadChanges(iprops, null);
counted = result.getRecordCount();
while (result.getRemainCount() > 0) {
result = client.getLeadChanges(iprops, result.getStreamPosition());
counted += result.getRecordCount();
changes = result.getRecords();
}
assertTrue(iprops.batchSize.getValue() < counted);
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoRESTClientTestIT method testGetLeadMany.
@Test
public void testGetLeadMany() throws Exception {
iprops.inputOperation.setValue(getLead);
iprops.leadKeyTypeREST.setValue(linkedInId);
iprops.afterInputOperation();
iprops.leadKeyValue.setValue(COMMON_LINKEDIN_ID.toString());
MarketoSource source = new MarketoSource();
source.initialize(null, iprops);
MarketoClientService client = source.getClientService(null);
//
MarketoRecordResult result = client.getLead(iprops, null);
LOG.debug("{}", result);
List<IndexedRecord> records = result.getRecords();
int count = 0;
assertNotEquals(emptyList(), records);
for (IndexedRecord record : records) {
count++;
assertNotNull(record);
// id
assertNotNull(record.get(0));
assertTrue(record.get(1).toString().startsWith(EMAIL_PREFIX));
}
assertEquals(50, count);
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoRESTClientTestIT method testGetMultipleLeadsLeadKeyFail.
@Test
public void testGetMultipleLeadsLeadKeyFail() throws Exception {
iprops.inputOperation.setValue(getMultipleLeads);
iprops.afterInputOperation();
iprops.batchSize.setValue(100);
iprops.leadKeyTypeREST.setValue(email);
iprops.leadKeyValues.setValue("i-dont-exist@mail.com,bad-email@dot.net");
MarketoSource source = new MarketoSource();
source.initialize(null, iprops);
MarketoClientService client = source.getClientService(null);
MarketoRecordResult result = client.getMultipleLeads(iprops, null);
LOG.debug("{}", result);
// but no leads
assertTrue(result.isSuccess());
assertEquals(0, result.getRecordCount());
assertEquals(0, result.getRemainCount());
}
Aggregations