use of com.netsuite.webservices.v2016_2.platform.core.CustomizationRefList in project components by Talend.
the class NetSuiteMockTestBase method mockCustomizationRequestResults.
protected void mockCustomizationRequestResults(final Map<String, CustomFieldSpec<RecordType, CustomizationFieldType>> customFieldSpecs) throws Exception {
final NetSuitePortType port = webServiceMockTestFixture.getPortMock();
when(port.getCustomizationId(any(GetCustomizationIdRequest.class))).then(new Answer<GetCustomizationIdResponse>() {
@Override
public GetCustomizationIdResponse answer(InvocationOnMock invocationOnMock) throws Throwable {
GetCustomizationIdRequest request = (GetCustomizationIdRequest) invocationOnMock.getArguments()[0];
CustomizationType customizationType = request.getCustomizationType();
GetCustomizationIdResult result = new GetCustomizationIdResult();
result.setCustomizationRefList(new CustomizationRefList());
result.setStatus(createSuccessStatus());
Map<String, CustomizationRef> customizationRefMap = createCustomFieldCustomizationRefs(customFieldSpecs);
for (String scriptId : customFieldSpecs.keySet()) {
RecordType recordType = RecordType.fromValue(customizationType.getGetCustomizationType().value());
CustomizationRef customizationRef = customizationRefMap.get(scriptId);
if (recordType == customizationRef.getType()) {
result.getCustomizationRefList().getCustomizationRef().add(customizationRef);
}
}
result.setTotalRecords(result.getCustomizationRefList().getCustomizationRef().size());
GetCustomizationIdResponse response = new GetCustomizationIdResponse();
response.setGetCustomizationIdResult(result);
return response;
}
});
when(port.getList(any(GetListRequest.class))).then(new Answer<GetListResponse>() {
@Override
public GetListResponse answer(InvocationOnMock invocationOnMock) throws Throwable {
GetListRequest request = (GetListRequest) invocationOnMock.getArguments()[0];
ReadResponseList readResponseList = new ReadResponseList();
readResponseList.setStatus(createSuccessStatus());
Map<String, CustomFieldType> customFieldTypeMap = createCustomFieldTypes(customFieldSpecs);
for (BaseRef ref : request.getBaseRef()) {
if (ref instanceof CustomizationRef) {
CustomizationRef customizationRef = (CustomizationRef) ref;
if (customFieldTypeMap.containsKey(customizationRef.getScriptId())) {
CustomFieldType fieldType = customFieldTypeMap.get(customizationRef.getScriptId());
ReadResponse readResponse = new ReadResponse();
readResponse.setRecord(fieldType);
readResponse.setStatus(createSuccessStatus());
readResponseList.getReadResponse().add(readResponse);
}
}
}
GetListResponse response = new GetListResponse();
response.setReadResponseList(readResponseList);
return response;
}
});
}
use of com.netsuite.webservices.v2016_2.platform.core.CustomizationRefList in project components by Talend.
the class NetSuitePortTypeMockAdapterImpl method getCustomizationId.
public GetCustomizationIdResponse getCustomizationId(GetCustomizationIdRequest parameters) throws InvalidSessionFault, ExceededUsageLimitFault, UnexpectedErrorFault, ExceededRequestLimitFault, ExceededRequestSizeFault, InvalidCredentialsFault, InsufficientPermissionFault, ExceededRecordCountFault {
GetCustomizationIdResponse response = null;
if (port != null) {
response = port.getCustomizationId(parameters);
}
if (response == null) {
response = new GetCustomizationIdResponse();
GetCustomizationIdResult result = new GetCustomizationIdResult();
result.setStatus(createSuccessStatus());
result.setTotalRecords(0);
result.setCustomizationRefList(new CustomizationRefList());
response.setGetCustomizationIdResult(result);
}
return response;
}
use of com.netsuite.webservices.v2016_2.platform.core.CustomizationRefList in project components by Talend.
the class NetSuitePortTypeMockAdapterImpl method getCustomizationId.
public GetCustomizationIdResponse getCustomizationId(GetCustomizationIdRequest parameters) throws InvalidSessionFault, ExceededUsageLimitFault, UnexpectedErrorFault, ExceededRequestLimitFault, ExceededRequestSizeFault, ExceededConcurrentRequestLimitFault, InvalidCredentialsFault, InsufficientPermissionFault, ExceededRecordCountFault {
GetCustomizationIdResponse response = null;
if (port != null) {
response = port.getCustomizationId(parameters);
}
if (response == null) {
response = new GetCustomizationIdResponse();
GetCustomizationIdResult result = new GetCustomizationIdResult();
result.setStatus(createSuccessStatus());
result.setTotalRecords(0);
result.setCustomizationRefList(new CustomizationRefList());
response.setGetCustomizationIdResult(result);
}
return response;
}
use of com.netsuite.webservices.v2016_2.platform.core.CustomizationRefList in project components by Talend.
the class NetSuiteMockTestBase method mockCustomizationRequestResults.
protected void mockCustomizationRequestResults(final Map<String, CustomFieldSpec<RecordType, CustomizationFieldType>> customFieldSpecs) throws Exception {
final NetSuitePortType port = webServiceMockTestFixture.getPortMock();
when(port.getCustomizationId(any(GetCustomizationIdRequest.class))).then(new Answer<GetCustomizationIdResponse>() {
@Override
public GetCustomizationIdResponse answer(InvocationOnMock invocationOnMock) throws Throwable {
GetCustomizationIdRequest request = (GetCustomizationIdRequest) invocationOnMock.getArguments()[0];
CustomizationType customizationType = request.getCustomizationType();
GetCustomizationIdResult result = new GetCustomizationIdResult();
result.setCustomizationRefList(new CustomizationRefList());
result.setStatus(createSuccessStatus());
Map<String, CustomizationRef> customizationRefMap = createCustomFieldCustomizationRefs(customFieldSpecs);
for (String scriptId : customFieldSpecs.keySet()) {
RecordType recordType = RecordType.fromValue(customizationType.getGetCustomizationType().value());
CustomizationRef customizationRef = customizationRefMap.get(scriptId);
if (recordType == customizationRef.getType()) {
result.getCustomizationRefList().getCustomizationRef().add(customizationRef);
}
}
result.setTotalRecords(result.getCustomizationRefList().getCustomizationRef().size());
GetCustomizationIdResponse response = new GetCustomizationIdResponse();
response.setGetCustomizationIdResult(result);
return response;
}
});
when(port.getList(any(GetListRequest.class))).then(new Answer<GetListResponse>() {
@Override
public GetListResponse answer(InvocationOnMock invocationOnMock) throws Throwable {
GetListRequest request = (GetListRequest) invocationOnMock.getArguments()[0];
ReadResponseList readResponseList = new ReadResponseList();
readResponseList.setStatus(createSuccessStatus());
Map<String, CustomFieldType> customFieldTypeMap = createCustomFieldTypes(customFieldSpecs);
for (BaseRef ref : request.getBaseRef()) {
if (ref instanceof CustomizationRef) {
CustomizationRef customizationRef = (CustomizationRef) ref;
if (customFieldTypeMap.containsKey(customizationRef.getScriptId())) {
CustomFieldType fieldType = customFieldTypeMap.get(customizationRef.getScriptId());
ReadResponse readResponse = new ReadResponse();
readResponse.setRecord(fieldType);
readResponse.setStatus(createSuccessStatus());
readResponseList.getReadResponse().add(readResponse);
}
}
}
GetListResponse response = new GetListResponse();
response.setReadResponseList(readResponseList);
return response;
}
});
}
Aggregations