use of org.talend.components.marketo.tmarketoinput.TMarketoInputProperties in project components by Talend.
the class MarketoSourceOrSinkTest method getTestProps.
public TMarketoInputProperties getTestProps() {
TMarketoInputProperties props = new TMarketoInputProperties("test");
props.connection.endpoint.setValue("http://fake.io");
props.connection.clientAccessId.setValue("client");
props.connection.secretKey.setValue("sekret");
return props;
}
use of org.talend.components.marketo.tmarketoinput.TMarketoInputProperties in project components by Talend.
the class MarketoSourceOrSinkTest method testValidate.
@Test
public void testValidate() throws Exception {
TMarketoInputProperties props = new TMarketoInputProperties("test");
sos.initialize(null, props);
assertEquals(Result.ERROR, sos.validate(null).getStatus());
props.connection.endpoint.setValue("http://fake.io");
sos.initialize(null, props);
assertEquals(Result.ERROR, sos.validate(null).getStatus());
props.connection.clientAccessId.setValue("client");
sos.initialize(null, props);
assertEquals(Result.ERROR, sos.validate(null).getStatus());
props.connection.secretKey.setValue("sekret");
sos.initialize(null, props);
assertEquals(Result.ERROR, sos.validate(null).getStatus());
}
use of org.talend.components.marketo.tmarketoinput.TMarketoInputProperties in project components by Talend.
the class MarketoCustomObjectClientTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
iprops = new TMarketoInputProperties("test");
iprops.schemaInput.setupProperties();
iprops.schemaInput.setupLayout();
iprops.connection.setupProperties();
iprops.connection.setupLayout();
iprops.connection.setupProperties();
iprops.connection.endpoint.setValue("https://fake.io/rest");
iprops.connection.clientAccessId.setValue("clientaccess");
iprops.connection.secretKey.setValue("sekret");
// shorten interval for tests
iprops.connection.attemptsIntervalTime.setValue(200);
iprops.setupProperties();
iprops.setupLayout();
iprops.customObjectName.setValue("car_c");
iprops.inputOperation.setValue(InputOperation.CustomObject);
oprops = new TMarketoOutputProperties("test");
oprops.schemaInput.setupProperties();
oprops.schemaInput.setupLayout();
oprops.connection.setupProperties();
oprops.connection.setupLayout();
oprops.connection.setupProperties();
oprops.connection.endpoint.setValue("https://fake.io/rest");
oprops.connection.clientAccessId.setValue("clientaccess");
oprops.connection.secretKey.setValue("sekret");
// shorten interval for tests
oprops.connection.attemptsIntervalTime.setValue(200);
oprops.setupProperties();
oprops.setupLayout();
oprops.customObjectName.setValue("car_c");
}
use of org.talend.components.marketo.tmarketoinput.TMarketoInputProperties in project components by Talend.
the class MarketoInputReaderTest method getReaderForRetryOperation.
public MarketoInputReader getReaderForRetryOperation(boolean die) {
TMarketoInputProperties props = new TMarketoInputProperties("test");
props.connection.setupProperties();
props.setupProperties();
props.inputOperation.setValue(InputOperation.getMultipleLeads);
props.updateSchemaRelated();
props.dieOnError.setValue(die);
source.initialize(null, props);
when(source.createReader(null)).thenReturn(new MarketoInputReader(null, source, props));
reader = (MarketoInputReader) source.createReader(null);
return reader;
}
use of org.talend.components.marketo.tmarketoinput.TMarketoInputProperties in project components by Talend.
the class MarketoInputReaderTest method testExecuteOperation.
@Test
public void testExecuteOperation() throws Exception {
TMarketoInputProperties props = new TMarketoInputProperties("test");
props.connection.init();
props.init();
props.inputOperation.setValue(InputOperation.getLeadChanges);
props.updateSchemaRelated();
props.schemaInput.schema.setValue(getFullDynamicSchema());
props.dieOnError.setValue(false);
source.initialize(null, props);
when(source.createReader(null)).thenReturn(new MarketoInputReader(null, source, props));
reader = (MarketoInputReader) source.createReader(null);
assertFalse(reader.start());
//
props.inputOperation.setValue(InputOperation.getMultipleLeads);
props.updateSchemaRelated();
props.schemaInput.schema.setValue(getFullDynamicSchema());
source.initialize(null, props);
when(source.createReader(null)).thenReturn(new MarketoInputReader(null, source, props));
when(source.getDynamicSchema(any(String.class), any(Schema.class))).thenReturn(MarketoConstants.getRESTSchemaForGetLeadOrGetMultipleLeads());
reader = (MarketoInputReader) source.createReader(null);
assertFalse(reader.start());
//
props.inputOperation.setValue(InputOperation.CustomObject);
props.customObjectAction.setValue(CustomObjectAction.describe);
props.updateSchemaRelated();
props.schemaInput.schema.setValue(getFullDynamicSchema());
source.initialize(null, props);
when(source.createReader(null)).thenReturn(new MarketoInputReader(null, source, props));
when(source.getDynamicSchema(any(String.class), any(Schema.class))).thenReturn(MarketoConstants.getRESTSchemaForGetLeadOrGetMultipleLeads());
reader = (MarketoInputReader) source.createReader(null);
assertFalse(reader.start());
//
props.customObjectAction.setValue(CustomObjectAction.get);
props.updateSchemaRelated();
props.schemaInput.schema.setValue(getFullDynamicSchema());
source.initialize(null, props);
when(source.createReader(null)).thenReturn(new MarketoInputReader(null, source, props));
when(source.getDynamicSchema(any(String.class), any(Schema.class))).thenReturn(MarketoConstants.getRESTSchemaForGetLeadOrGetMultipleLeads());
reader = (MarketoInputReader) source.createReader(null);
assertFalse(reader.start());
//
props.customObjectAction.setValue(CustomObjectAction.list);
props.updateSchemaRelated();
props.schemaInput.schema.setValue(getFullDynamicSchema());
source.initialize(null, props);
when(source.createReader(null)).thenReturn(new MarketoInputReader(null, source, props));
when(source.getDynamicSchema(any(String.class), any(Schema.class))).thenReturn(MarketoConstants.getRESTSchemaForGetLeadOrGetMultipleLeads());
reader = (MarketoInputReader) source.createReader(null);
assertFalse(reader.start());
//
props.customObjectAction.setValue(CustomObjectAction.get);
props.updateSchemaRelated();
props.schemaInput.schema.setValue(getFullDynamicSchema());
source.initialize(null, props);
when(source.createReader(null)).thenReturn(new MarketoInputReader(null, source, props));
when(source.getDynamicSchema(any(String.class), any(Schema.class))).thenThrow(new IOException("error"));
reader = (MarketoInputReader) source.createReader(null);
try {
assertFalse(reader.start());
fail("Should not be here");
} catch (IOException e) {
}
//
}
Aggregations