Package org.elasticsearch.action.view

Examples of org.elasticsearch.action.view.ViewResponse.content()


    }

    @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"));
    }

    @Test
    public void testFullView() throws Exception {
        ViewResponse response = esSetup.client().execute(ViewAction.INSTANCE, new ViewRequest("catalog", "product", "2").format("full")).get();
View Full Code Here


    }

    @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"));
    }

    @Test
    public void testBinaryView() throws Exception {
        ViewResponse response = esSetup.client().execute(ViewAction.INSTANCE, new ViewRequest("catalog", "product", "1").format("logo")).get();
View Full Code Here

    }

    @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

    @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

        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);
    }

    @Test
    public void testUndefinedView() throws Exception {
View Full Code Here

        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);
    }

    @Test
    public void testUndefinedView() throws Exception {
        try {
View Full Code Here

                        "    }\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"));
    }

    @Test
    public void testCustomViewWithMultipleQueries() throws Exception {
View Full Code Here

                                "    }\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"));
    }


    @After
    public void tearDown() throws Exception {
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.