use of com.netsuite.webservices.test.platform.core.RecordRef in project components by Talend.
the class NetSuiteClientServiceTest method testDelete.
@Test
public void testDelete() throws Exception {
TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("RecordRef");
RecordRef recordRef = new NsObjectComposer<RecordRef>(clientService.getMetaDataSource(), typeDesc).composeObject();
DeleteResponse response = new DeleteResponse();
response.setWriteResponse(createSuccessWriteResponse());
when(port.delete(notNull(DeleteRequest.class))).thenReturn(response);
clientService.delete(recordRef);
verify(port, times(1)).login(notNull(LoginRequest.class));
verify(port, times(1)).delete(notNull(DeleteRequest.class));
NsWriteResponse writeResponse = clientService.delete(null);
assertNull(writeResponse.getStatus());
assertNull(writeResponse.getRef());
}
use of com.netsuite.webservices.test.platform.core.RecordRef in project components by Talend.
the class NetSuiteClientServiceTest method createSuccessWriteResponse.
private WriteResponse createSuccessWriteResponse() {
WriteResponse writeResponse = new WriteResponse();
writeResponse.setStatus(NetSuitePortTypeMockAdapterImpl.createSuccessStatus());
RecordRef recordRef = new RecordRef();
recordRef.setInternalId(Integer.valueOf(10000 + rnd.nextInt()).toString());
writeResponse.setBaseRef(recordRef);
return writeResponse;
}
use of com.netsuite.webservices.test.platform.core.RecordRef in project components by Talend.
the class NetSuiteClientServiceTest method testLogin.
@Test
public void testLogin() throws Exception {
clientService.login();
verify(port, times(1)).login(argThat(new AssertMatcher<LoginRequest>() {
@Override
protected void doAssert(LoginRequest request) throws Exception {
assertNotNull(request);
Passport passport = request.getPassport();
assertNotNull(passport);
}
}));
// Verify that logging in not performed for already logged in client
TypeDesc typeDesc = clientService.getMetaDataSource().getTypeInfo("RecordRef");
RecordRef recordRef = new NsObjectComposer<RecordRef>(clientService.getMetaDataSource(), typeDesc).composeObject();
DeleteResponse response = new DeleteResponse();
response.setWriteResponse(createSuccessWriteResponse());
when(port.delete(notNull(DeleteRequest.class))).thenReturn(response);
clientService.delete(recordRef);
verify(port, times(1)).login(any(LoginRequest.class));
}
Aggregations