Search in sources :

Example 1 with AddListResponse

use of com.netsuite.webservices.test.platform.messages.AddListResponse in project components by Talend.

the class NetSuiteClientServiceTest method testAddList.

@Test
public void testAddList() throws Exception {
    TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("PurchaseOrder");
    List<PurchaseOrder> recordList = makeNsObjects(new NsObjectComposer<PurchaseOrder>(clientService.getMetaDataSource(), typeDesc), 10);
    AddListResponse response = new AddListResponse();
    response.setWriteResponseList(createSuccessWriteResponseList(recordList.size()));
    when(port.addList(notNull(AddListRequest.class))).thenReturn(response);
    clientService.addList(recordList);
    verify(port, times(1)).login(notNull(LoginRequest.class));
    verify(port, times(1)).addList(notNull(AddListRequest.class));
    List<NsWriteResponse<RecordRef>> writeResponses = clientService.addList(null);
    assertTrue(writeResponses.isEmpty());
}
Also used : AddListResponse(com.netsuite.webservices.test.platform.messages.AddListResponse) AddListRequest(com.netsuite.webservices.test.platform.messages.AddListRequest) TypeDesc(org.talend.components.netsuite.client.model.TypeDesc) PurchaseOrder(com.netsuite.webservices.test.transactions.purchases.PurchaseOrder) LoginRequest(com.netsuite.webservices.test.platform.messages.LoginRequest) Test(org.junit.Test)

Aggregations

AddListRequest (com.netsuite.webservices.test.platform.messages.AddListRequest)1 AddListResponse (com.netsuite.webservices.test.platform.messages.AddListResponse)1 LoginRequest (com.netsuite.webservices.test.platform.messages.LoginRequest)1 PurchaseOrder (com.netsuite.webservices.test.transactions.purchases.PurchaseOrder)1 Test (org.junit.Test)1 TypeDesc (org.talend.components.netsuite.client.model.TypeDesc)1