AnsweredAssumed Answered

Is it possible to setup selected fields when using the ConnectorTester to test query operation connector code?

Question asked by amelia.ross on Nov 12, 2013
Latest reply on Nov 13, 2013 by jplater
We have been able to supply inputs that would alter the filter data that is passed to the query operation code like in the following example:
 
CustomConnector connector = new CustomConnector();
ConnectorTester tester = new ConnectorTester(connector);
Map<String, Object> connInfo = GetConnectionInfo();
tester.setOperationContext(OperationType.QUERY, connInfo, null, "Object", null);
             
QueryFilter filter = new QueryFilter();
SimpleExpression expression = new SimpleExpression();
expression.withProperty("object_id").withOperator("EQUALS").withArguments("1");
filter.withExpression(expression);
List<SimpleOperationResult> results = tester.executeQueryOperation(filter);
/* snip assertions */
 
However, I haven’t been able to find any way via the ConnectorTester’s setup methods to supply test configuration as to what fields would be selected, so our query operation code which gets selected fields like this will actually have a limited set:
 
protected void executeQuery(QueryRequest request, OperationResponse response) {
  String objectType = getContext().getObjectTypeId();
  FilterData input = request.getFilter();
  List<String> fields = getContext().getSelectedFields();
 
/* snip remaining */
 
Is this this possible with the current testing framework?
 
 

Outcomes