@Test public void test_FILE_selectRequestType() { String[] pathTokens = "/db/mybucket.files/123".split("/"); assertEquals(RequestContext.TYPE.FILE, RequestContext.selectRequestType(pathTokens)); pathTokens = "/db/mybucket.files/123/binary".split("/"); assertEquals(RequestContext.TYPE.FILE_BINARY, RequestContext.selectRequestType(pathTokens)); pathTokens = "/db/mybucket.files/123/456".split("/"); assertEquals(RequestContext.TYPE.FILE, RequestContext.selectRequestType(pathTokens)); }
@Test public void testSelectRequestType() { String[] pathTokens = "/".split("/"); assertEquals(RequestContext.TYPE.ROOT, RequestContext.selectRequestType(pathTokens)); pathTokens = "/db".split("/"); assertEquals(RequestContext.TYPE.DB, RequestContext.selectRequestType(pathTokens)); pathTokens = "/db/collection".split("/"); assertEquals(RequestContext.TYPE.COLLECTION, RequestContext.selectRequestType(pathTokens)); pathTokens = "/db/collection/document".split("/"); assertEquals(RequestContext.TYPE.DOCUMENT, RequestContext.selectRequestType(pathTokens)); pathTokens = "/db/collection/_indexes".split("/"); assertEquals( RequestContext.TYPE.COLLECTION_INDEXES, RequestContext.selectRequestType(pathTokens)); pathTokens = "/db/collection/_indexes/123".split("/"); assertEquals(RequestContext.TYPE.INDEX, RequestContext.selectRequestType(pathTokens)); pathTokens = "/db/collection/_aggrs/test".split("/"); assertEquals(RequestContext.TYPE.AGGREGATION, RequestContext.selectRequestType(pathTokens)); }
@Test public void test_COLLECTION_FILES_selectRequestType() { String[] pathTokens = "/db/mybucket.files".split("/"); assertEquals(RequestContext.TYPE.FILES_BUCKET, RequestContext.selectRequestType(pathTokens)); }