Search in sources :

Example 1 with UpsertResponse

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

the class NetSuiteClientServiceTest method testUpsert.

@Test
public void testUpsert() throws Exception {
    TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("PurchaseOrder");
    PurchaseOrder record = new NsObjectComposer<PurchaseOrder>(clientService.getMetaDataSource(), typeDesc).composeObject();
    UpsertResponse response = new UpsertResponse();
    response.setWriteResponse(createSuccessWriteResponse());
    when(port.upsert(notNull(UpsertRequest.class))).thenReturn(response);
    clientService.upsert(record);
    verify(port, times(1)).login(notNull(LoginRequest.class));
    verify(port, times(1)).upsert(notNull(UpsertRequest.class));
    NsWriteResponse writeResponse = clientService.upsert(null);
    assertNull(writeResponse.getStatus());
    assertNull(writeResponse.getRef());
}
Also used : UpsertResponse(com.netsuite.webservices.test.platform.messages.UpsertResponse) TypeDesc(org.talend.components.netsuite.client.model.TypeDesc) UpsertRequest(com.netsuite.webservices.test.platform.messages.UpsertRequest) PurchaseOrder(com.netsuite.webservices.test.transactions.purchases.PurchaseOrder) LoginRequest(com.netsuite.webservices.test.platform.messages.LoginRequest) Test(org.junit.Test)

Aggregations

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