Examples of FetchOptions


Examples of org.infinispan.query.FetchOptions

         public Void call() throws Exception {
            cache1.remove("1");   // cache will now be out of sync with the index
            searchManager = Search.getSearchManager(cache1);

            Query query = createQueryBuilder().keyword().onField("bar").matching("1").createQuery();
            ResultIterator iterator = searchManager.getQuery(query).iterator(new FetchOptions().fetchMode(EAGER));
            assertFalse("Iterator should not have elements.", iterator.hasNext());
            try {
               iterator.next();
               fail("Expected NoSuchElementException");
            } catch (NoSuchElementException e) {
View Full Code Here

Examples of org.infinispan.query.FetchOptions

         public Void call() throws Exception {
            cache2.remove("2");   // cache will now be out of sync with the index
            searchManager = Search.getSearchManager(cache1);

            Query query = createQueryBuilder().keyword().onField("bar").matching("2").createQuery();
            ResultIterator iterator = searchManager.getQuery(query).iterator(new FetchOptions().fetchMode(LAZY));
            assertFalse(iterator.hasNext());
            try {
               iterator.next();
               fail("Expected NoSuchElementException");
            } catch (NoSuchElementException e) {
View Full Code Here

Examples of org.infinispan.query.FetchOptions

            cache1.remove("1");   // cache will now be out of sync with the index
            searchManager = Search.getSearchManager(cache1);

            Query query = createQueryBuilder().keyword().onField("bar").matching("1").createQuery();
            ResultIterator iterator = searchManager.getQuery(query).projection(ProjectionConstants.VALUE, "bar")
                  .iterator(new FetchOptions().fetchMode(LAZY));
            assertTrue("Expected an element in iterator.", iterator.hasNext());
            Object[] projection = (Object[]) iterator.next();
            assertNull(projection[0]);
            assertEquals("1", projection[1]);
            return null;
View Full Code Here

Examples of org.infinispan.query.FetchOptions

   public void testEagerIterator() throws ParseException {
      loadTestingData();
      CacheQuery cacheQuery = createCacheQuery(cache, "blurb", "playing" );

      ResultIterator found = cacheQuery.iterator(new FetchOptions().fetchMode(FetchOptions.FetchMode.EAGER));

      try {
         assert found.hasNext();
         found.next();
         assert !found.hasNext();
View Full Code Here

Examples of org.infinispan.query.FetchOptions

   @Test(expectedExceptions = UnsupportedOperationException.class)
   public void testEagerIteratorRemove() throws ParseException {
      loadTestingData();
      CacheQuery cacheQuery = createCacheQuery(cache, "blurb", "playing" );

      ResultIterator found = cacheQuery.iterator(new FetchOptions().fetchMode(FetchOptions.FetchMode.EAGER));

      try {
         assert found.hasNext();
         found.remove();
      } finally {
View Full Code Here

Examples of org.infinispan.query.FetchOptions

   @Test(expectedExceptions = NoSuchElementException.class)
   public void testEagerIteratorExCase() throws ParseException {
      loadTestingData();
      CacheQuery cacheQuery = createCacheQuery(cache, "blurb", "playing" );

      ResultIterator found = cacheQuery.iterator(new FetchOptions().fetchMode(FetchOptions.FetchMode.EAGER));

      try {
         assert found.hasNext();
         found.next();
         assert !found.hasNext();
View Full Code Here

Examples of org.infinispan.query.FetchOptions

      loadTestingData();
      queryParser = createQueryParser("blurb");
      Query luceneQuery = queryParser.parse("playing");
      CacheQuery cacheQuery = Search.getSearchManager(cache).getQuery(luceneQuery);

      ResultIterator found = cacheQuery.iterator(new FetchOptions().fetchMode(FetchOptions.FetchMode.LAZY));

      try {
         assert found.hasNext();
         found.next();
         assert !found.hasNext();
View Full Code Here

Examples of org.infinispan.query.FetchOptions

      loadTestingData();
      queryParser = createQueryParser("blurb");
      Query luceneQuery = queryParser.parse("playing");
      CacheQuery cacheQuery = Search.getSearchManager(cache).getQuery(luceneQuery);

      ResultIterator found = cacheQuery.iterator(new FetchOptions(){
         public FetchOptions fetchMode(FetchMode fetchMode) {
            return null;
         }
      });
View Full Code Here

Examples of org.infinispan.query.FetchOptions

      loadTestingData();
      queryParser = createQueryParser("blurb");
      Query luceneQuery = queryParser.parse("Eats");
      CacheQuery cacheQuery = Search.getSearchManager(cache).getQuery(luceneQuery).firstResult(1);

      ResultIterator iterator = cacheQuery.iterator(new FetchOptions().fetchMode(FetchOptions.FetchMode.LAZY));
      try {
         Assert.assertEquals(2, countElements(iterator));
      } finally {
         iterator.close();
      }
View Full Code Here

Examples of org.infinispan.query.FetchOptions

      loadTestingData();
      queryParser = createQueryParser("blurb");
      Query luceneQuery = queryParser.parse("Eats");
      CacheQuery cacheQuery = Search.getSearchManager(cache).getQuery(luceneQuery).firstResult(1);

      ResultIterator found = cacheQuery.iterator(new FetchOptions().fetchMode(FetchOptions.FetchMode.LAZY).fetchSize(0));
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.