use of com.netsuite.webservices.test.transactions.purchases.PurchaseOrder in project components by Talend.
the class NetSuiteClientServiceTest method testGet.
@Test
public void testGet() throws Exception {
TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("PurchaseOrder");
TypeDesc refTypeDesc = clientService.getMetaDataSource().getTypeInfo("RecordRef");
PurchaseOrder record = new NsObjectComposer<PurchaseOrder>(clientService.getMetaDataSource(), typeDesc).composeObject();
RecordRef recordRef = new NsObjectComposer<RecordRef>(clientService.getMetaDataSource(), refTypeDesc).composeObject();
GetResponse response = new GetResponse();
response.setReadResponse(createSuccessReadResponse(record));
when(port.get(notNull(GetRequest.class))).thenReturn(response);
clientService.get(recordRef);
verify(port, times(1)).login(notNull(LoginRequest.class));
verify(port, times(1)).get(notNull(GetRequest.class));
NsReadResponse readResponse = clientService.get(null);
assertNull(readResponse.getStatus());
assertNull(readResponse.getRecord());
}
use of com.netsuite.webservices.test.transactions.purchases.PurchaseOrder 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());
}
use of com.netsuite.webservices.test.transactions.purchases.PurchaseOrder in project components by Talend.
the class NetSuiteClientServiceTest method testAdd.
@Test
public void testAdd() throws Exception {
TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("PurchaseOrder");
PurchaseOrder record = new NsObjectComposer<PurchaseOrder>(clientService.getMetaDataSource(), typeDesc).composeObject();
AddResponse response = new AddResponse();
response.setWriteResponse(createSuccessWriteResponse());
when(port.add(notNull(AddRequest.class))).thenReturn(response);
clientService.add(record);
verify(port, times(1)).login(notNull(LoginRequest.class));
verify(port, times(1)).add(notNull(AddRequest.class));
NsWriteResponse writeResponse = clientService.add(null);
assertNull(writeResponse.getStatus());
assertNull(writeResponse.getRef());
}
Aggregations