Search in sources :

Example 6 with TMarketoListOperationProperties

use of org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties in project components by Talend.

the class MarketoLeadClientTest 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();
    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();
    lprops = new TMarketoListOperationProperties("test");
    lprops.schemaInput.setupProperties();
    lprops.schemaInput.setupLayout();
    lprops.connection.setupProperties();
    lprops.connection.setupLayout();
    lprops.connection.setupProperties();
    lprops.connection.endpoint.setValue("https://fake.io/rest");
    lprops.connection.clientAccessId.setValue("clientaccess");
    lprops.connection.secretKey.setValue("sekret");
    // shorten interval for tests
    lprops.connection.attemptsIntervalTime.setValue(200);
    lprops.setupProperties();
    lprops.setupLayout();
    client = spy(new MarketoRESTClient(iprops.connection));
    doNothing().when(client).getToken();
    doReturn("000123456").when(client).getPageToken(anyString());
    client.connect();
}
Also used : TMarketoOutputProperties(org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties) TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties) TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) Before(org.junit.Before)

Example 7 with TMarketoListOperationProperties

use of org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties in project components by Talend.

the class MarketoSOAPClientTest method setUp.

@Before
public void setUp() throws Exception {
    iprops = new TMarketoInputProperties("test");
    iprops.schemaInput.setupProperties();
    iprops.schemaInput.setupLayout();
    iprops.connection.setupProperties();
    iprops.connection.setupLayout();
    iprops.connection.setupProperties();
    iprops.connection.apiMode.setValue(APIMode.SOAP);
    iprops.connection.endpoint.setValue("https://fake.io");
    iprops.connection.clientAccessId.setValue("clientaccess");
    iprops.connection.secretKey.setValue("sekret");
    iprops.setupProperties();
    iprops.setupLayout();
    oprops = new TMarketoOutputProperties("test");
    oprops.schemaInput.setupProperties();
    oprops.schemaInput.setupLayout();
    oprops.connection.setupProperties();
    oprops.connection.setupLayout();
    oprops.connection.setupProperties();
    oprops.connection.apiMode.setValue(APIMode.SOAP);
    oprops.connection.endpoint.setValue("https://fake.io");
    oprops.connection.clientAccessId.setValue("clientaccess");
    oprops.connection.secretKey.setValue("sekret");
    oprops.setupProperties();
    oprops.setupLayout();
    lprops = new TMarketoListOperationProperties("test");
    lprops.schemaInput.setupProperties();
    lprops.schemaInput.setupLayout();
    lprops.connection.setupProperties();
    lprops.connection.setupLayout();
    lprops.connection.setupProperties();
    lprops.connection.apiMode.setValue(APIMode.SOAP);
    lprops.connection.endpoint.setValue("https://fake.io");
    lprops.connection.clientAccessId.setValue("clientaccess");
    lprops.connection.secretKey.setValue("sekret");
    lprops.setupProperties();
    lprops.setupLayout();
    client = spy(new MarketoSOAPClient(iprops.connection));
    port = mock(MktowsPort.class);
    AuthenticationHeader header = mock(AuthenticationHeader.class);
    doReturn(port).when(client).getMktowsApiSoapPort();
    doReturn(header).when(client).getAuthentificationHeader();
    doReturn(null).when(port).listMObjects(any(ParamsListMObjects.class), any(AuthenticationHeader.class));
    client.connect();
    objectFactory = new ObjectFactory();
    factory = DatatypeFactory.newInstance();
    Date dateTest = MarketoUtils.parseDateString(DATE_EXPECTED);
    gcDateTest = new GregorianCalendar();
    gcDateTest.setTime(dateTest);
}
Also used : AuthenticationHeader(com.marketo.mktows.AuthenticationHeader) ObjectFactory(com.marketo.mktows.ObjectFactory) TMarketoOutputProperties(org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties) TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties) GregorianCalendar(java.util.GregorianCalendar) TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) ParamsListMObjects(com.marketo.mktows.ParamsListMObjects) MktowsPort(com.marketo.mktows.MktowsPort) Date(java.util.Date) Before(org.junit.Before)

Example 8 with TMarketoListOperationProperties

use of org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties in project components by Talend.

the class MarketoWriteOperationTest method testCreateWriter.

@Test
public void testCreateWriter() throws Exception {
    MarketoSink sink = new MarketoSink();
    TMarketoListOperationProperties plist = new TMarketoListOperationProperties("test");
    plist.init();
    TMarketoOutputProperties pout = new TMarketoOutputProperties("test");
    pout.init();
    TMarketoInputProperties pin = new TMarketoInputProperties("test");
    pin.init();
    sink.initialize(null, null);
    wop = new MarketoWriteOperation(sink);
    assertNull(wop.createWriter(null));
    sink.initialize(null, plist);
    wop = new MarketoWriteOperation(sink);
    assertEquals(MarketoListOperationWriter.class, wop.createWriter(null).getClass());
    sink.initialize(null, pout);
    wop = new MarketoWriteOperation(sink);
    assertEquals(MarketoOutputWriter.class, wop.createWriter(null).getClass());
    sink.initialize(null, pin);
    wop = new MarketoWriteOperation(sink);
    assertEquals(MarketoInputWriter.class, wop.createWriter(null).getClass());
}
Also used : TMarketoOutputProperties(org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties) TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties) TMarketoInputProperties(org.talend.components.marketo.tmarketoinput.TMarketoInputProperties) Test(org.junit.Test)

Example 9 with TMarketoListOperationProperties

use of org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties in project components by Talend.

the class MarketoSinkTest method testCreateWriteOperation.

@Test
public void testCreateWriteOperation() throws Exception {
    assertNotNull(new MarketoSink().createWriteOperation());
    sink.properties = new TMarketoListOperationProperties("test");
    assertTrue(sink.createWriteOperation() instanceof MarketoWriteOperation);
    sink.properties = new TMarketoOutputProperties("test");
    assertTrue(sink.createWriteOperation() instanceof MarketoWriteOperation);
}
Also used : TMarketoOutputProperties(org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties) TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties) Test(org.junit.Test)

Example 10 with TMarketoListOperationProperties

use of org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties in project components by Talend.

the class MarketoListOperationWriterTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    props = new TMarketoListOperationProperties("test");
    props.connection.setupProperties();
    props.setupProperties();
    when(sink.getProperties()).thenReturn(props);
    writer = new MarketoListOperationWriter(new MarketoWriteOperation(sink), null);
    assertNotNull(writer);
}
Also used : TMarketoListOperationProperties(org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties) Before(org.junit.Before)

Aggregations

TMarketoListOperationProperties (org.talend.components.marketo.tmarketolistoperation.TMarketoListOperationProperties)10 TMarketoOutputProperties (org.talend.components.marketo.tmarketooutput.TMarketoOutputProperties)7 TMarketoInputProperties (org.talend.components.marketo.tmarketoinput.TMarketoInputProperties)6 Before (org.junit.Before)5 Test (org.junit.Test)2 AuthenticationHeader (com.marketo.mktows.AuthenticationHeader)1 MktowsPort (com.marketo.mktows.MktowsPort)1 ObjectFactory (com.marketo.mktows.ObjectFactory)1 ParamsListMObjects (com.marketo.mktows.ParamsListMObjects)1 Date (java.util.Date)1 GregorianCalendar (java.util.GregorianCalendar)1 LeadSelector (org.talend.components.marketo.tmarketoinput.TMarketoInputProperties.LeadSelector)1 ValidationResultMutable (org.talend.daikon.properties.ValidationResultMutable)1