use of com.netsuite.webservices.test.platform.messages.ReadResponse in project components by Talend.
the class NetSuiteClientServiceTest method createSuccessReadResponseList.
private ReadResponseList createSuccessReadResponseList(List<? extends Record> recordList) {
ReadResponseList readResponseList = new ReadResponseList();
readResponseList.setStatus(NetSuitePortTypeMockAdapterImpl.createSuccessStatus());
for (int i = 0; i < recordList.size(); i++) {
Record record = recordList.get(i);
ReadResponse readResponse = createSuccessReadResponse(record);
readResponseList.getReadResponse().add(readResponse);
}
return readResponseList;
}
use of com.netsuite.webservices.test.platform.messages.ReadResponse in project components by Talend.
the class NetSuiteClientServiceTest method createSuccessReadResponse.
private ReadResponse createSuccessReadResponse(Record record) {
ReadResponse readResponse = new ReadResponse();
readResponse.setStatus(NetSuitePortTypeMockAdapterImpl.createSuccessStatus());
readResponse.setRecord(record);
return readResponse;
}
use of com.netsuite.webservices.test.platform.messages.ReadResponse in project components by Talend.
the class NetSuiteMockTestBase method mockGetRequestResults.
protected <T extends Record> void mockGetRequestResults(final T record) throws Exception {
final NetSuitePortType port = webServiceMockTestFixture.getPortMock();
when(port.get(any(GetRequest.class))).then(new Answer<GetResponse>() {
@Override
public GetResponse answer(InvocationOnMock invocationOnMock) throws Throwable {
GetResponse response = new GetResponse();
ReadResponse readResponse = new ReadResponse();
if (record != null) {
readResponse.setStatus(createSuccessStatus());
} else {
readResponse.setStatus(createNotFoundStatus());
}
readResponse.setRecord(record);
response.setReadResponse(readResponse);
return response;
}
});
}
use of com.netsuite.webservices.test.platform.messages.ReadResponse in project components by Talend.
the class NetSuiteMockTestBase method mockGetListRequestResults.
protected <T extends Record> void mockGetListRequestResults(final List<T> records) throws Exception {
final NetSuitePortType port = webServiceMockTestFixture.getPortMock();
when(port.getList(any(GetListRequest.class))).then(new Answer<GetListResponse>() {
@Override
public GetListResponse answer(InvocationOnMock invocationOnMock) throws Throwable {
GetListRequest request = (GetListRequest) invocationOnMock.getArguments()[0];
GetListResponse response = new GetListResponse();
ReadResponseList readResponseList = new ReadResponseList();
int count = request.getBaseRef().size();
for (int i = 0; i < count; i++) {
ReadResponse readResponse = new ReadResponse();
T record = records != null ? records.get(i) : null;
if (record != null) {
readResponse.setStatus(createSuccessStatus());
} else {
readResponse.setStatus(createNotFoundStatus());
}
readResponse.setRecord(record);
readResponseList.getReadResponse().add(readResponse);
}
response.setReadResponseList(readResponseList);
return response;
}
});
}
Aggregations