@Test public void testSkipToken() throws Exception { TeiidServiceHandler handler = new TeiidServiceHandler("foo"); assertEquals("$skiptoken=xxx", handler.buildNextToken("$skiptoken=sdhhdd--23", "xxx")); assertEquals("$filter=e1 eq '1'&$skiptoken=xxx", handler.buildNextToken("$filter=e1 eq '1'&$skiptoken=sdhhdd--23", "xxx")); assertEquals("$filter=e1 eq '1'&$top=23&$skiptoken=xxx", handler.buildNextToken("$filter=e1 eq '1'&$skiptoken=sdhhdd--23&$top=23", "xxx")); }
String buildNextToken(final String queryPath, String nextToken) { StringBuilder sb = new StringBuilder(); if (queryPath != null) { String[] pairs = queryPath.split("&"); for (String pair : pairs) { int idx = pair.indexOf("="); String key = pair.substring(0, idx); if (!key.equals("$skiptoken")) { if (sb.length()>0) { sb.append("&"); } sb.append(pair); } } } if (sb.length() > 0) { sb.append("&$skiptoken=").append(nextToken); } else { sb.append("$skiptoken=").append(nextToken); } return sb.toString(); }
TeiidServiceHandler implements ServiceHandler { String buildNextToken(final String queryPath, String nextToken) { StringBuilder sb = new StringBuilder(); if (queryPath != null) { String[] pairs = queryPath.split("&"); for (String pair : pairs) { int idx = pair.indexOf("="); String key = pair.substring(0, idx); if (!key.equals("$skiptoken")) { if (sb.length()>0) { sb.append("&"); } sb.append(pair); } } } if (sb.length() > 0) { sb.append("&$skiptoken=").append(nextToken); } else { sb.append("$skiptoken=").append(nextToken); } return sb.toString(); } }
TeiidServiceHandler implements ServiceHandler { String buildNextToken(final String queryPath, String nextToken) { StringBuilder sb = new StringBuilder(); if (queryPath != null) { String[] pairs = queryPath.split("&"); for (String pair : pairs) { int idx = pair.indexOf("="); String key = pair.substring(0, idx); if (!key.equals("$skiptoken")) { if (sb.length()>0) { sb.append("&"); } sb.append(pair); } } } if (sb.length() > 0) { sb.append("&$skiptoken=").append(nextToken); } else { sb.append("$skiptoken=").append(nextToken); } return sb.toString(); } TeiidServiceHandler(String schemaName); }
TeiidServiceHandler implements ServiceHandler { String buildNextToken(final String queryPath, String nextToken) { StringBuilder sb = new StringBuilder(); if (queryPath != null) { String[] pairs = queryPath.split("&"); for (String pair : pairs) { int idx = pair.indexOf("="); String key = pair.substring(0, idx); if (!key.equals("$skiptoken")) { if (sb.length()>0) { sb.append("&"); } sb.append(pair); } } } if (sb.length() > 0) { sb.append("&$skiptoken=").append(nextToken); } else { sb.append("$skiptoken=").append(nextToken); } return sb.toString(); } TeiidServiceHandler(String schemaName); static Client getClient(); static void setClient(Client client); @Override void init(OData odata, ServiceMetadata serviceMetadata); void setPrepared(boolean flag); @Override void readMetadata(MetadataRequest request, MetadataResponse response); @Override void readServiceDocument(ServiceDocumentRequest request,
            ServiceDocumentResponse response); @Override void read(final DataRequest request, T response); @Override void createEntity(DataRequest request, Entity entity,
            EntityResponse response); @Override void updateEntity(DataRequest request, Entity entity, boolean merge,
            String entityETag, EntityResponse response); @Override void deleteEntity(DataRequest request, String entityETag,
            EntityResponse response); @Override void updateProperty(DataRequest request, Property property, boolean rawValue,
            boolean merge, String entityETag, PropertyResponse response); @Override void upsertStreamProperty(DataRequest request, String entityETag,
            InputStream streamContent, NoContentResponse response); @Override void invoke(final FunctionRequest request,
            HttpMethod method, T response); @Override void invoke(final ActionRequest request,
            String eTag, T response); @Override void readMediaStream(MediaRequest request, StreamResponse response); @Override void upsertMediaStream(MediaRequest request, String entityETag,
            InputStream mediaContent, NoContentResponse response); @Override void anyUnsupported(ODataRequest request, ODataResponse response); @Override void addReference(DataRequest request, String entityETag,
            URI referenceId, NoContentResponse response); @Override void updateReference(DataRequest request, String entityETag,
            URI referenceId, NoContentResponse response); @Override void deleteReference(DataRequest request, URI deleteId,
            String entityETag, NoContentResponse response); @Override String startTransaction(); @Override void commit(String txnId); @Override void rollback(String txnId); @Override void crossJoin(DataRequest request, List<String> entitySetNames,
            ODataResponse response); void apply(DataRequest request, ODataResponse response); @Override void upsertEntity(DataRequest request, Entity entity, boolean merge,
            String entityETag, EntityResponse response); @Override boolean supportsDataIsolation(); @Override void processError(ODataServerError error, ErrorResponse response); }
TeiidServiceHandler implements ServiceHandler { String buildNextToken(final String queryPath, String nextToken) { StringBuilder sb = new StringBuilder(); if (queryPath != null) { String[] pairs = queryPath.split("&"); for (String pair : pairs) { int idx = pair.indexOf("="); String key = pair.substring(0, idx); if (!key.equals("$skiptoken")) { if (sb.length()>0) { sb.append("&"); } sb.append(pair); } } } if (sb.length() > 0) { sb.append("&$skiptoken=").append(nextToken); } else { sb.append("$skiptoken=").append(nextToken); } return sb.toString(); } TeiidServiceHandler(String schemaName); static Client getClient(); static void setClient(Client client); @Override void init(OData odata, ServiceMetadata serviceMetadata); void setPrepared(boolean flag); @Override void readMetadata(MetadataRequest request, MetadataResponse response); @Override void readServiceDocument(ServiceDocumentRequest request,
            ServiceDocumentResponse response); @Override void read(final DataRequest request, T response); @Override void createEntity(DataRequest request, Entity entity,
            EntityResponse response); @Override void updateEntity(DataRequest request, Entity entity, boolean merge,
            String entityETag, EntityResponse response); @Override void deleteEntity(DataRequest request, String entityETag,
            EntityResponse response); @Override void updateProperty(DataRequest request, Property property, boolean rawValue,
            boolean merge, String entityETag, PropertyResponse response); @Override void upsertStreamProperty(DataRequest request, String entityETag,
            InputStream streamContent, NoContentResponse response); @Override void invoke(final FunctionRequest request,
            HttpMethod method, T response); @Override void invoke(final ActionRequest request,
            String eTag, T response); @Override void readMediaStream(MediaRequest request, StreamResponse response); @Override void upsertMediaStream(MediaRequest request, String entityETag,
            InputStream mediaContent, NoContentResponse response); @Override void anyUnsupported(ODataRequest request, ODataResponse response); @Override void addReference(DataRequest request, String entityETag,
            URI referenceId, NoContentResponse response); @Override void updateReference(DataRequest request, String entityETag,
            URI referenceId, NoContentResponse response); @Override void deleteReference(DataRequest request, URI deleteId,
            String entityETag, NoContentResponse response); @Override String startTransaction(); @Override void commit(String txnId); @Override void rollback(String txnId); @Override void crossJoin(DataRequest request, List<String> entitySetNames,
            ODataResponse response); void apply(DataRequest request, ODataResponse response); @Override void upsertEntity(DataRequest request, Entity entity, boolean merge,
            String entityETag, EntityResponse response); @Override boolean supportsDataIsolation(); @Override void processError(ODataServerError error, ErrorResponse response);  }