Hi Isomorphic,
how do you create a mocked DSReponse serverside?
There is no constructor taking a DataSource name as String, only ones taking DataSource objects.
I have this code, which is missing a DataSourceManager.free(). Can I put it just before the return? Or will this somehow affect the DSResponse as well?
This hint from RPCManager.getDataSource() does not apply, as I don't have such constructor on DSResponse, that is available on DSRequest:
Thank you & Best regards
Blama
how do you create a mocked DSReponse serverside?
There is no constructor taking a DataSource name as String, only ones taking DataSource objects.
I have this code, which is missing a DataSourceManager.free(). Can I put it just before the return? Or will this somehow affect the DSResponse as well?
Code:
DSResponse fakeRemoveResponse = new DSResponse(DataSourceManager.get(DatasourceEnum.T_CHAT.getValue())); fakeRemoveResponse.setSuccess(); fakeRemoveResponse.setAffectedRows(1); fakeRemoveResponse.setOperationType(DataSource.OP_REMOVE); Map<String, Object> returnValueMap = new LinkedHashMap<String, Object>(); returnValueMap.put(DatasourceFieldEnum.T_CHAT__ID.getValue(), chatId); fakeRemoveResponse.setData(returnValueMap); // Faked response of self-removal return new DSResponse().setSuccess().addRelatedUpdate(fakeRemoveResponse);
Also, if you are trying to access some arbitrary DataSource purely because you need to run a DSRequest on it (another very common use case), consider just creating the DSRequest instead, using one of the constructors that accepts a DataSource name.
Blama
Comment