Search in sources :

Example 1 with ReadResponseList

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

the class NetSuitePortTypeMockAdapterImpl method getList.

public GetListResponse getList(GetListRequest parameters) throws InvalidSessionFault, ExceededUsageLimitFault, UnexpectedErrorFault, ExceededRequestLimitFault, ExceededRequestSizeFault, ExceededConcurrentRequestLimitFault, InvalidCredentialsFault, InsufficientPermissionFault, ExceededRecordCountFault {
    GetListResponse response = null;
    if (port != null) {
        response = port.getList(parameters);
    }
    if (response == null) {
        response = new GetListResponse();
        ReadResponseList readResponseList = new ReadResponseList();
        readResponseList.setStatus(createSuccessStatus());
        response.setReadResponseList(readResponseList);
    }
    return response;
}
Also used : GetListResponse(com.netsuite.webservices.test.platform.messages.GetListResponse) ReadResponseList(com.netsuite.webservices.test.platform.messages.ReadResponseList)

Example 2 with ReadResponseList

use of com.netsuite.webservices.test.platform.messages.ReadResponseList 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;
}
Also used : ReadResponse(com.netsuite.webservices.test.platform.messages.ReadResponse) ReadResponseList(com.netsuite.webservices.test.platform.messages.ReadResponseList) Record(com.netsuite.webservices.test.platform.core.Record)

Example 3 with ReadResponseList

use of com.netsuite.webservices.test.platform.messages.ReadResponseList 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;
        }
    });
}
Also used : NetSuitePortType(com.netsuite.webservices.test.platform.NetSuitePortType) GetListResponse(com.netsuite.webservices.test.platform.messages.GetListResponse) ReadResponse(com.netsuite.webservices.test.platform.messages.ReadResponse) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ReadResponseList(com.netsuite.webservices.test.platform.messages.ReadResponseList) GetListRequest(com.netsuite.webservices.test.platform.messages.GetListRequest)

Aggregations

ReadResponseList (com.netsuite.webservices.test.platform.messages.ReadResponseList)3 GetListResponse (com.netsuite.webservices.test.platform.messages.GetListResponse)2 ReadResponse (com.netsuite.webservices.test.platform.messages.ReadResponse)2 NetSuitePortType (com.netsuite.webservices.test.platform.NetSuitePortType)1 Record (com.netsuite.webservices.test.platform.core.Record)1 GetListRequest (com.netsuite.webservices.test.platform.messages.GetListRequest)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1