use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoSOAPClientTestIT method testBadConnectionString.
@Test(expected = IOException.class)
public void testBadConnectionString() throws Exception {
inputProperties.connection.endpoint.setValue("htps://marketo.com/rest/v1");
MarketoSource source = new MarketoSource();
source.initialize(null, inputProperties);
MarketoClientService client = source.getClientService(null);
fail("Shouldn't be here");
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoSOAPClientTestIT method testGetLeadMany.
@Test
public void testGetLeadMany() throws Exception {
inputProperties.inputOperation.setValue(getMultipleLeads);
inputProperties.leadKeyTypeSOAP.setValue(LeadKeyTypeSOAP.IDNUM);
inputProperties.leadKeyValues.setValue(createdLeads.toString().replaceAll("\\]|\\[|\\s", ""));
inputProperties.afterInputOperation();
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();
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 MarketoSOAPClientTestIT method testSyncLead.
@Test
public void testSyncLead() throws Exception {
MarketoSource source = new MarketoSource();
outProperties.outputOperation.setValue(OutputOperation.syncLead);
outProperties.updateSchemaRelated();
source.initialize(null, listProperties);
MarketoClientService client = source.getClientService(null);
// test attributes
List<Field> fields = new ArrayList<>();
Field field = new Schema.Field("FirstName", Schema.create(Schema.Type.STRING), null, (Object) null);
fields.add(field);
field = new Schema.Field("LastName", Schema.create(Schema.Type.STRING), null, (Object) null);
fields.add(field);
field = new Schema.Field("AccountType", Schema.create(Schema.Type.STRING), null, (Object) null);
fields.add(field);
Schema s = MarketoUtils.newSchema(outProperties.schemaInput.schema.getValue(), "leadAttribute", fields);
IndexedRecord record = new GenericData.Record(s);
record.put(0, null);
record.put(1, "undx@undx.net");
record.put(2, "ForeignPersonSysId");
// CUSTOM, SFDC, NETSUITE;
record.put(3, "SFDC");
record.put(4, "My firstName");
record.put(5, "My lastName");
record.put(6, "Conservative customer");
outProperties.schemaInput.schema.setValue(s);
outProperties.beforeMappingInput();
//
MarketoSyncResult result = client.syncLead(outProperties, record);
assertEquals("UPDATED", result.getRecords().get(0).getStatus());
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoSOAPClientTestIT method testGetMultipleLeadsListNamePagination.
@Test
public void testGetMultipleLeadsListNamePagination() throws Exception {
inputProperties.inputOperation.setValue(getMultipleLeads);
inputProperties.leadSelectorSOAP.setValue(StaticListSelector);
inputProperties.afterInputOperation();
inputProperties.batchSize.setValue(4);
inputProperties.listParam.setValue(STATIC_LIST_NAME);
inputProperties.listParamListName.setValue(UNDX_TEST_LIST_SMALL);
MarketoSource source = new MarketoSource();
source.initialize(null, inputProperties);
MarketoClientService client = source.getClientService(null);
//
MarketoRecordResult result = client.getMultipleLeads(inputProperties, null);
int counted = result.getRecordCount();
assertTrue(result.getRecordCount() > 0);
while (result.getRemainCount() > 0) {
result = client.getMultipleLeads(inputProperties, 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 MarketoSOAPClientTestIT method testBUG_TDI38439_MarketoWizardConnection.
@Test
public void testBUG_TDI38439_MarketoWizardConnection() throws Exception {
inputProperties.connection.endpoint.setValue(ENDPOINT_SOAP);
inputProperties.connection.clientAccessId.setValue(USERID_SOAP);
inputProperties.connection.secretKey.setValue(SECRETKEY_SOAP);
MarketoSource source = new MarketoSource();
source.initialize(null, inputProperties);
MarketoClientService client = source.getClientService(null);
assertNotNull(client);
}
Aggregations