Search in sources :

Example 1 with FieldRequest

use of org.dotwebstack.framework.core.query.model.FieldRequest in project dotwebstack-framework by dotwebstack.

the class PostgresBackendLoaderTest method initObjectRequest.

private ObjectRequest initObjectRequest() {
    PostgresObjectType objectType = mock(PostgresObjectType.class);
    when(objectType.getTable()).thenReturn("anyTable");
    Map<String, Object> mapValues = Map.of("a", "bbb");
    ContextCriteria contextCriteria = mock(ContextCriteria.class);
    Context context = mock(Context.class);
    when(context.getFields()).thenReturn(Map.of("a", mock(ContextField.class)));
    when(contextCriteria.getContext()).thenReturn(context);
    when(contextCriteria.getValues()).thenReturn(mapValues);
    when(contextCriteria.getName()).thenReturn("Brewery");
    Map<FieldRequest, ObjectRequest> objectFields = Map.of();
    return ObjectRequest.builder().objectType(objectType).objectFields(objectFields).contextCriteria(contextCriteria).build();
}
Also used : RequestContext(org.dotwebstack.framework.core.query.model.RequestContext) Context(org.dotwebstack.framework.core.model.Context) ObjectRequest(org.dotwebstack.framework.core.query.model.ObjectRequest) PostgresObjectType(org.dotwebstack.framework.backend.postgres.model.PostgresObjectType) FieldRequest(org.dotwebstack.framework.core.query.model.FieldRequest) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ContextCriteria(org.dotwebstack.framework.core.query.model.ContextCriteria)

Example 2 with FieldRequest

use of org.dotwebstack.framework.core.query.model.FieldRequest in project dotwebstack-framework by dotwebstack.

the class QueryTest method initObjectRequest.

private ObjectRequest initObjectRequest() {
    PostgresObjectType objectType = mock(PostgresObjectType.class);
    when(objectType.getTable()).thenReturn("anyTable");
    Map<FieldRequest, ObjectRequest> objectFields = Map.of();
    return ObjectRequest.builder().objectType(objectType).objectFields(objectFields).build();
}
Also used : ObjectRequest(org.dotwebstack.framework.core.query.model.ObjectRequest) PostgresObjectType(org.dotwebstack.framework.backend.postgres.model.PostgresObjectType) FieldRequest(org.dotwebstack.framework.core.query.model.FieldRequest)

Aggregations

PostgresObjectType (org.dotwebstack.framework.backend.postgres.model.PostgresObjectType)2 FieldRequest (org.dotwebstack.framework.core.query.model.FieldRequest)2 ObjectRequest (org.dotwebstack.framework.core.query.model.ObjectRequest)2 Context (org.dotwebstack.framework.core.model.Context)1 ContextCriteria (org.dotwebstack.framework.core.query.model.ContextCriteria)1 RequestContext (org.dotwebstack.framework.core.query.model.RequestContext)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1