Search in sources :

Example 1 with PurchaseOrder

use of com.netsuite.webservices.test.transactions.purchases.PurchaseOrder in project components by Talend.

the class NetSuiteClientServiceTest method testGetList.

@Test
public void testGetList() throws Exception {
    TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("PurchaseOrder");
    TypeDesc refTypeDesc = clientService.getMetaDataSource().getTypeInfo("RecordRef");
    List<PurchaseOrder> recordList = makeNsObjects(new NsObjectComposer<PurchaseOrder>(clientService.getMetaDataSource(), typeDesc), 10);
    List<RecordRef> recordRefList = makeNsObjects(new NsObjectComposer<RecordRef>(clientService.getMetaDataSource(), refTypeDesc), 10);
    GetListResponse response = new GetListResponse();
    response.setReadResponseList(createSuccessReadResponseList(recordList));
    when(port.getList(notNull(GetListRequest.class))).thenReturn(response);
    clientService.getList(recordRefList);
    verify(port, times(1)).login(notNull(LoginRequest.class));
    verify(port, times(1)).getList(notNull(GetListRequest.class));
    List<NsReadResponse<Record>> readResponses = clientService.getList(null);
    assertTrue(readResponses.isEmpty());
}
Also used : GetListResponse(com.netsuite.webservices.test.platform.messages.GetListResponse) TypeDesc(org.talend.components.netsuite.client.model.TypeDesc) RecordRef(com.netsuite.webservices.test.platform.core.RecordRef) PurchaseOrder(com.netsuite.webservices.test.transactions.purchases.PurchaseOrder) LoginRequest(com.netsuite.webservices.test.platform.messages.LoginRequest) GetListRequest(com.netsuite.webservices.test.platform.messages.GetListRequest) Test(org.junit.Test)

Example 2 with PurchaseOrder

use of com.netsuite.webservices.test.transactions.purchases.PurchaseOrder 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)

Example 3 with PurchaseOrder

use of com.netsuite.webservices.test.transactions.purchases.PurchaseOrder in project components by Talend.

the class NetSuiteClientServiceTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("PurchaseOrder");
    PurchaseOrder record = new NsObjectComposer<PurchaseOrder>(clientService.getMetaDataSource(), typeDesc).composeObject();
    UpdateResponse response = new UpdateResponse();
    response.setWriteResponse(createSuccessWriteResponse());
    when(port.update(notNull(UpdateRequest.class))).thenReturn(response);
    clientService.update(record);
    verify(port, times(1)).login(notNull(LoginRequest.class));
    verify(port, times(1)).update(notNull(UpdateRequest.class));
    NsWriteResponse writeResponse = clientService.update(null);
    assertNull(writeResponse.getStatus());
    assertNull(writeResponse.getRef());
}
Also used : UpdateResponse(com.netsuite.webservices.test.platform.messages.UpdateResponse) UpdateRequest(com.netsuite.webservices.test.platform.messages.UpdateRequest) 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)

Example 4 with PurchaseOrder

use of com.netsuite.webservices.test.transactions.purchases.PurchaseOrder in project components by Talend.

the class NetSuiteClientServiceTest method testUpdateList.

@Test
public void testUpdateList() throws Exception {
    TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("PurchaseOrder");
    List<PurchaseOrder> recordList = makeNsObjects(new NsObjectComposer<PurchaseOrder>(clientService.getMetaDataSource(), typeDesc), 10);
    UpdateListResponse response = new UpdateListResponse();
    response.setWriteResponseList(createSuccessWriteResponseList(recordList.size()));
    when(port.updateList(notNull(UpdateListRequest.class))).thenReturn(response);
    clientService.updateList(recordList);
    verify(port, times(1)).login(notNull(LoginRequest.class));
    verify(port, times(1)).updateList(notNull(UpdateListRequest.class));
    List<NsWriteResponse<RecordRef>> writeResponses = clientService.updateList(null);
    assertTrue(writeResponses.isEmpty());
}
Also used : UpdateListResponse(com.netsuite.webservices.test.platform.messages.UpdateListResponse) UpdateListRequest(com.netsuite.webservices.test.platform.messages.UpdateListRequest) 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)

Example 5 with PurchaseOrder

use of com.netsuite.webservices.test.transactions.purchases.PurchaseOrder 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)8 PurchaseOrder (com.netsuite.webservices.test.transactions.purchases.PurchaseOrder)8 Test (org.junit.Test)8 TypeDesc (org.talend.components.netsuite.client.model.TypeDesc)8 RecordRef (com.netsuite.webservices.test.platform.core.RecordRef)2 AddListRequest (com.netsuite.webservices.test.platform.messages.AddListRequest)1 AddListResponse (com.netsuite.webservices.test.platform.messages.AddListResponse)1 AddRequest (com.netsuite.webservices.test.platform.messages.AddRequest)1 AddResponse (com.netsuite.webservices.test.platform.messages.AddResponse)1 GetListRequest (com.netsuite.webservices.test.platform.messages.GetListRequest)1 GetListResponse (com.netsuite.webservices.test.platform.messages.GetListResponse)1 GetRequest (com.netsuite.webservices.test.platform.messages.GetRequest)1 GetResponse (com.netsuite.webservices.test.platform.messages.GetResponse)1 UpdateListRequest (com.netsuite.webservices.test.platform.messages.UpdateListRequest)1 UpdateListResponse (com.netsuite.webservices.test.platform.messages.UpdateListResponse)1 UpdateRequest (com.netsuite.webservices.test.platform.messages.UpdateRequest)1 UpdateResponse (com.netsuite.webservices.test.platform.messages.UpdateResponse)1 UpsertListRequest (com.netsuite.webservices.test.platform.messages.UpsertListRequest)1 UpsertListResponse (com.netsuite.webservices.test.platform.messages.UpsertListResponse)1 UpsertRequest (com.netsuite.webservices.test.platform.messages.UpsertRequest)1