use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoSOAPClientTestIT method testGetMultipleLeadsListIdFail.
@Test
public void testGetMultipleLeadsListIdFail() throws Exception {
inputProperties.inputOperation.setValue(getMultipleLeads);
inputProperties.leadSelectorSOAP.setValue(StaticListSelector);
inputProperties.updateSchemaRelated();
inputProperties.batchSize.setValue(200);
//
inputProperties.listParam.setValue(STATIC_LIST_ID);
inputProperties.listParamListName.setValue("-666");
MarketoSource source = new MarketoSource();
source.initialize(null, inputProperties);
MarketoClientService client = source.getClientService(null);
//
MarketoRecordResult result = client.getMultipleLeads(inputProperties, null);
LOG.debug("{}", result);
// but not leads
assertFalse(result.isSuccess());
assertNotNull(result.getErrors());
assertEquals(0, result.getRecordCount());
assertEquals(0, result.getRemainCount());
assertFalse(result.getRecordCount() > 0);
assertEquals(emptyList(), result.getRecords());
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoSOAPClientTestIT method testGetLeadActivityIncludeFilter.
@Test
public void testGetLeadActivityIncludeFilter() throws Exception {
inputProperties.inputOperation.setValue(getLeadActivity);
inputProperties.leadKeyTypeSOAP.setValue(EMAIL);
inputProperties.leadSelectorSOAP.setValue(LeadKeySelector);
inputProperties.updateSchemaRelated();
inputProperties.batchSize.setValue(11);
//
inputProperties.leadKeyValue.setValue(EMAIL_LEAD_MANY_INFOS);
inputProperties.setIncludeTypes.setValue(true);
inputProperties.includeTypes.type.getValue().add(NewLead.toString());
inputProperties.includeTypes.type.getValue().add(ChangeDataValue.toString());
// inputProperties.includeTypes.type.getValue().add(TMarketoInputProperties.IncludeExcludeFieldsSOAP.VisitWebpage.toString());
MarketoSource source = new MarketoSource();
source.initialize(null, inputProperties);
MarketoClientService client = source.getClientService(null);
//
MarketoRecordResult result = client.getLeadActivity(inputProperties, null);
List<IndexedRecord> activities = result.getRecords();
assertTrue(activities.size() > 0);
for (IndexedRecord r : activities) {
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 testGetCustomObjectDynamic.
@Test
public void testGetCustomObjectDynamic() throws Exception {
String coName = "smartphone_c";
String brand = "Samsung";
String models = "Galaxy S7,XCover";
iprops.inputOperation.setValue(CustomObject);
iprops.customObjectAction.setValue(CustomObjectAction.get);
iprops.batchSize.setValue(1);
iprops.afterCustomObjectAction();
iprops.customObjectName.setValue(coName);
iprops.customObjectFilterType.setValue("model");
iprops.customObjectFilterValues.setValue(models);
iprops.schemaInput.schema.setValue(SchemaBuilder.builder().record("test").prop(SchemaConstants.INCLUDE_ALL_FIELDS, "true").fields().endRecord());
MarketoSource source = new MarketoSource();
source.initialize(null, iprops);
Schema runtimeSchema = source.getDynamicSchema(coName, iprops.schemaInput.schema.getValue());
LOG.debug("runtimeSchema = {}.", runtimeSchema);
iprops.schemaInput.schema.setValue(runtimeSchema);
MarketoRESTClient client = (MarketoRESTClient) source.getClientService(null);
MarketoRecordResult result = client.getCustomObjects(iprops, null);
assertTrue(result.isSuccess());
for (IndexedRecord r : result.getRecords()) {
LOG.debug("r = {}.", r);
assertNotNull(r);
assertEquals(brand, r.get(runtimeSchema.getField("brand").pos()));
assertTrue(models.contains(r.get(runtimeSchema.getField("model").pos()).toString()));
assertNotNull(r.get(runtimeSchema.getField("customerId").pos()));
}
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoRESTClientTestIT method testGetLeadActivityExcludeFilter.
@Test
public void testGetLeadActivityExcludeFilter() throws Exception {
iprops.inputOperation.setValue(getLeadActivity);
iprops.afterInputOperation();
iprops.batchSize.setValue(300);
iprops.excludeTypes.type.getValue().add(IncludeExcludeFieldsSOAP.VisitWebpage.toString());
iprops.excludeTypes.type.getValue().add(ChangeDataValue.toString());
iprops.sinceDateTime.setValue(DATE_OLDEST_CREATE);
iprops.beforeMappingInput();
//
MarketoSource source = new MarketoSource();
source.initialize(null, iprops);
MarketoClientService client = source.getClientService(null);
//
MarketoRecordResult result = client.getLeadActivity(iprops, null);
LOG.debug("{}", result);
List<IndexedRecord> activities = result.getRecords();
assertTrue(activities.size() > 0);
for (IndexedRecord r : activities) {
assertTrue(!"Visit Webpage".equals(r.get(4)) && !"Change Data Value".equals(r.get(4)));
}
}
use of org.talend.components.marketo.runtime.MarketoSource in project components by Talend.
the class MarketoRESTClientTestIT method testSyncLead.
/*
*
*
* syncLeads
*
*/
@Test
public void testSyncLead() throws Exception {
outProperties.outputOperation.setValue(OutputOperation.syncLead);
outProperties.operationType.setValue(OperationType.createOrUpdate);
outProperties.lookupField.setValue(RESTLookupFields.email);
outProperties.deDupeEnabled.setValue(false);
outProperties.updateSchemaRelated();
outProperties.updateOutputSchemas();
MarketoSource source = new MarketoSource();
source.initialize(null, outProperties);
MarketoClientService client = source.getClientService(null);
//
// test attributes
List<Field> fields = new ArrayList<>();
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, "undx71@undx.net");
record.put(2, "ForeignPersonSysId");
// CUSTOM, SFDC, NETSUITE;
record.put(3, "SFDC");
record.put(4, "My firstName");
List<IndexedRecord> leads = Arrays.asList(record);
outProperties.schemaInput.schema.setValue(s);
outProperties.beforeMappingInput();
// /
MarketoSyncResult result = client.syncLead(outProperties, record);
LOG.debug("result = {}.", result);
List<SyncStatus> changes = result.getRecords();
assertTrue(changes.size() > 0);
for (SyncStatus r : changes) {
assertNotNull(r);
assertNotNull(r.getId());
LOG.debug("r = {}.", r);
}
}
Aggregations