use of org.talend.components.marketo.runtime.client.type.ListOperationParameters in project components by Talend.
the class MarketoSOAPClientTest method testListOperations.
@Test
public void testListOperations() throws Exception {
doReturn(getListOperation(true, "added")).when(port).listOperation(any(ParamsListOperation.class), any(AuthenticationHeader.class));
lprops.afterListOperation();
ListOperationParameters parms = new ListOperationParameters();
parms.setApiMode(SOAP.name());
parms.setListKeyValue("test_list");
parms.setLeadKeyValue(new String[] { "12345" });
mktoSR = client.addToList(parms);
assertNotNull(mktoSR);
assertTrue(mktoSR.isSuccess());
doReturn(getListOperation(false, "skipped")).when(port).listOperation(any(ParamsListOperation.class), any(AuthenticationHeader.class));
mktoSR = client.removeFromList(parms);
assertTrue(mktoSR.isSuccess());
assertNotNull(mktoSR.getErrorsString());
doReturn(getListOperation(true, "memberof")).when(port).listOperation(any(ParamsListOperation.class), any(AuthenticationHeader.class));
mktoSR = client.isMemberOfList(parms);
assertTrue(mktoSR.isSuccess());
assertNotNull(mktoSR.getRecords().get(0));
doThrow(new RuntimeException("error")).when(port).listOperation(any(ParamsListOperation.class), any(AuthenticationHeader.class));
mktoSR = client.isMemberOfList(parms);
assertFalse(mktoSR.isSuccess());
assertNotNull(mktoSR.getRecords());
}
Aggregations