Examples of ViewResponse


Examples of com.couchbase.client.protocol.views.ViewResponse

    }
    if (query.willReduce()) {
      query.setReduce(false);
    }

    final ViewResponse response = queryView(designName, viewName, query);

    final List<T> result = new ArrayList<T>(response.size());
    for (final ViewRow row : response) {
      result.add(findById(row.getId(), entityClass));
    }

    return result;
View Full Code Here

Examples of com.couchbase.client.protocol.views.ViewResponse

  public long count() {
    Query query = new Query();
    query.setReduce(true);

    final ResolvedView resolvedView = determineView();
    ViewResponse response = couchbaseOperations.queryView(resolvedView.getDesignDocument(), resolvedView.getViewName(), query);

    long count = 0;
    for (ViewRow row : response) {
      count += Long.parseLong(row.getValue());
    }
View Full Code Here

Examples of com.couchbase.client.protocol.views.ViewResponse

  public void deleteAll() {
    Query query = new Query();
    query.setReduce(false);

    final ResolvedView resolvedView = determineView();
    ViewResponse response = couchbaseOperations.queryView(resolvedView.getDesignDocument(), resolvedView.getViewName(), query);
    for (ViewRow row : response) {
      couchbaseOperations.remove(row.getId());
    }
  }
View Full Code Here

Examples of org.elasticsearch.action.view.ViewResponse

        );
    }

    @Test
    public void testDefaultView() throws Exception {
        ViewResponse response = esSetup.client().execute(ViewAction.INSTANCE, new ViewRequest("catalog", "product", "1")).get();
        assertEquals("Rendering the document #1 in version 1 of type product from index catalog", new String(response.content(), "UTF-8"));
    }
View Full Code Here

Examples of org.elasticsearch.action.view.ViewResponse

        assertEquals("Rendering the document #1 in version 1 of type product from index catalog", new String(response.content(), "UTF-8"));
    }

    @Test
    public void testFullView() throws Exception {
        ViewResponse response = esSetup.client().execute(ViewAction.INSTANCE, new ViewRequest("catalog", "product", "2").format("full")).get();
        assertEquals("<div id=\"product-2\"><h2>Detail of 1952 ALPINE RENAULT 1300</h2><p>Year: 1952, price: 98.58€</p><p>Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis.</p><p>© Copyright Renault</p></div>", new String(response.content(), "UTF-8"));
    }
View Full Code Here

Examples of org.elasticsearch.action.view.ViewResponse

        assertEquals("<div id=\"product-2\"><h2>Detail of 1952 ALPINE RENAULT 1300</h2><p>Year: 1952, price: 98.58€</p><p>Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis.</p><p>© Copyright Renault</p></div>", new String(response.content(), "UTF-8"));
    }

    @Test
    public void testBinaryView() throws Exception {
        ViewResponse response = esSetup.client().execute(ViewAction.INSTANCE, new ViewRequest("catalog", "product", "1").format("logo")).get();
        assertNotNull(response.content());
        assertEquals(0, response.content().length);

        response = esSetup.client().execute(ViewAction.INSTANCE, new ViewRequest("catalog", "product", "2").format("logo")).get();
        assertNotNull(response.content());
        assertEquals(61752, response.content().length);
    }
View Full Code Here

Examples of org.elasticsearch.action.view.ViewResponse

    }

    @Test
    public void testUndefinedView() throws Exception {
        try {
            ViewResponse response = esSetup.client().execute(ViewAction.INSTANCE, new ViewRequest("catalog", "product", "1").format("undefined")).get();
            fail("Exception expected!");
        } catch (Exception e) {
            assertEquals("org.elasticsearch.view.exception.ElasticSearchViewNotFoundException: No view [undefined] found for document type [product]", e.getMessage());
        }
    }
View Full Code Here

Examples of org.elasticsearch.action.view.ViewResponse

                        "        }\n" +
                        "    }\n" +
                        "}")
        );

        ViewResponse response = esSetup.client().execute(ViewAction.INSTANCE, new ViewRequest("catalog", "list-of-products-by-size", "1:10")).get();
        assertEquals(fromClassPath("org/elasticsearch/test/integration/views/config/views/list-of-products.html").toString(), new String(response.content(), "UTF-8"));
    }
View Full Code Here

Examples of org.elasticsearch.action.view.ViewResponse

                                "        }\n" +
                                "    }\n" +
                                "}")
        );

        ViewResponse response = esSetup.client().execute(ViewAction.INSTANCE, new ViewRequest("web", "pages", "home")).get();
        assertEquals(fromClassPath("org/elasticsearch/test/integration/views/config/views/list-of-products-with-brands.html").toString(), new String(response.content(), "UTF-8"));
    }
View Full Code Here

Examples of org.sonatype.nexus.componentviews.ViewResponse

    final ImmutableMap<String, String> fetchParameters = ImmutableMap.of("path", PATH);
    final ComponentRequest fetchRequest = new ComponentRequest(fetchParameters);
    when(source.fetchComponents(eq(fetchRequest))).thenReturn(fetchedComponents);

    final ViewResponse handle = handler.handle(context);

    verify(source).fetchComponents(eq(fetchRequest));
  }
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.