use of org.talend.components.netsuite.client.model.TypeDesc in project components by Talend.
the class MetaDataSourceTest method testGetTypeInfoByClass.
@Test
public void testGetTypeInfoByClass() {
TypeDesc typeDesc = metaDataSource.getTypeInfo(Account.class);
assertNotNull(typeDesc);
}
use of org.talend.components.netsuite.client.model.TypeDesc 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());
}
use of org.talend.components.netsuite.client.model.TypeDesc 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());
}
use of org.talend.components.netsuite.client.model.TypeDesc 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());
}
use of org.talend.components.netsuite.client.model.TypeDesc 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());
}
Aggregations