CollectionQueryEngine implements QueryEngineInternal<O> { @Override public boolean isMutable() { return immutableIndexes.isEmpty(); } CollectionQueryEngine(); @Override void init(final ObjectStore<O> objectStore, final QueryOptions queryOptions); @Override void destroy(QueryOptions queryOptions); @Override void addIndex(Index<O> index, QueryOptions queryOptions); @Override void removeIndex(Index<O> index, QueryOptions queryOptions); @Override Iterable<Index<O>> getIndexes(); @Override ResultSet<O> retrieve(final Query<O> query, final QueryOptions queryOptions); @Override boolean addAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions); @Override boolean removeAll(final ObjectSet<O> objectSet, final QueryOptions queryOptions); @Override void clear(final QueryOptions queryOptions); @Override boolean isMutable(); static final String ROOT_QUERY; }
@Test public void testIsMutable() { CollectionQueryEngine<Car> queryEngine = new CollectionQueryEngine<Car>(); queryEngine.init(emptyObjectStore(), queryOptionsWithOnHeapPersistence()); Assert.assertTrue(queryEngine.isMutable()); queryEngine.addIndex(createImmutableIndex(), noQueryOptions()); Assert.assertFalse(queryEngine.isMutable()); }