IndexMaintainerHelper { public static List<Index> getIndexForDocument(Session session, Document entity) { IndexRepositoryImpl indexRepo = new IndexRepositoryImpl(session); return indexRepo.readAllCached(entity.getId()); } private  IndexMaintainerHelper(); static List<BoundStatement> generateDocumentCreateIndexEntriesStatements(Session session, Document entity, BucketLocator bucketLocator); static BoundStatement generateDocumentCreateIndexEntryStatement(Session session, Index index, Document entity, BucketLocator bucketLocator); static List<BoundStatement> generateDocumentUpdateIndexEntriesStatements(Session session, Document entity, BucketLocator bucketLocator); static List<BoundStatement> generateDocumentDeleteIndexEntriesStatements(Session session, Document entity, BucketLocator bucketLocator); static List<Index> getIndexForDocument(Session session, Document entity); static boolean hasIndexedFieldChanged(BSONObject oldObject, Index index, Document entity); static BSONObject getOldObjectForUpdate(Session session, Document entity); static String getCQLStatementForInsert(Index index); static String generateCQLStatementForInsert(Index index); static String getCQLStatementForWhereClauses(String CQL, Index index); static String generateCQLStatementForWhereClauses(String CQL, Index index); static final String ITABLE_INSERT_CQL; static final String ITABLE_UPDATE_CQL; static final String ITABLE_DELETE_CQL; }
@Test public void testGetIndexForDocument() { System.out.println("getIndexForDocument"); Document entity = Fixtures.createTestDocument2(); ArrayList<Index> exp = new ArrayList<>(2); exp.add(index1); exp.add(index2); List<Index> result = IndexMaintainerHelper.getIndexForDocument(f.getSession(), entity); assertNotNull(result); assertTrue(!result.isEmpty()); assertEquals(2, result.size()); assertEquals(exp, result); }