PrimitiveRenderer extends AbstractRenderer { @Override public int score(ODataRequestContext requestContext, QueryResult data) { int operationScore = DEFAULT_SCORE; if (ODataUriUtil.isValuePathUri(requestContext.getUri()) || ODataUriUtil.isCountPathUri(requestContext.getUri())) { operationScore = DEFAULT_PRIMITIVE_SCORE; } LOG.debug("Renderer score is {}", operationScore); return operationScore; }  @Override int score(ODataRequestContext requestContext, QueryResult data); @Override void render(ODataRequestContext requestContext, QueryResult data, ODataResponse.Builder responseBuilder); @Override ChunkedActionRenderResult renderStart(ODataRequestContext requestContext, QueryResult result,
                                                 OutputStream outputStream); @Override ChunkedActionRenderResult renderBody(ODataRequestContext requestContext, QueryResult result,
                                                ChunkedActionRenderResult previousResult); @Override void renderEnd(ODataRequestContext requestContext, QueryResult result,
                          ChunkedActionRenderResult previousResult);  }
@Test public void testCountPathScore() throws UnsupportedEncodingException { ODataUri countPathODataUri = TestUtils.createODataCountEntitiesUri(SERVICE_ROOT, "Customer"); ODataRequestContext oDataRequestContext = TestUtils.createODataRequestContext( createODataRequest(ODataRequest.Method.GET), countPathODataUri, entityDataModel); int score = primitiveRenderer.score(oDataRequestContext, QueryResult.from(5L)); assertTrue(score > 0); }
@Test public void testValuePathScore() throws UnsupportedEncodingException { ODataUri countPathODataUri = TestUtils.createODataValueEntitiesUri(SERVICE_ROOT, "Customer", Customer.PHONE); ODataRequestContext oDataRequestContext = TestUtils.createODataRequestContext( createODataRequest(ODataRequest.Method.GET), countPathODataUri, entityDataModel); int score = primitiveRenderer.score(oDataRequestContext, QueryResult.from(5L)); assertTrue(score > 0); }