Search in sources :

Example 1 with UpsertListResponse

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

the class NetSuiteClientServiceTest method testUpsertList.

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

Aggregations

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