Package org.elasticsearch.common.xcontent

Examples of org.elasticsearch.common.xcontent.XContentBuilder.string()


    @Test
    public void shouldParseRssGeoInformation() throws Exception {
        final SyndEntryImpl entry = buildEntry();
        final XContentBuilder xContentBuilder = RssToJson.toJson(entry, null, null, true);
        assertThat(xContentBuilder.string(), equalTo(JSON));
    }

    private SyndEntryImpl buildEntry() throws FeedException, IOException {
        SyndFeedInput input = new SyndFeedInput();
        SyndFeed feed = input.build(new XmlReader(getClass().getResource("/reuters/rss.xml")));
View Full Code Here


    @Test
    public void mappingShouldNotfail() throws Exception {
        XContentBuilder page = RssToJson.buildRssMapping("page", true);
        assertThat(page, notNullValue());
        logger.info("mapping is: {}", page.string());
    }

    @Test
    public void shouldHaveRawContent() throws Exception {
        SyndFeedInput input = new SyndFeedInput();
View Full Code Here

        assertThat(feed.getEntries().size(), greaterThan(0));
        for (Object o : feed.getEntries()) {
            SyndEntryImpl message = (SyndEntryImpl) o;
            XContentBuilder xcb = toJson(message, null, null, true);
            assertThat(xcb, notNullValue());
            assertThat(xcb.string(), containsString("<p>"));
            logger.info(xcb.string());
        }
    }

    @Test
View Full Code Here

        for (Object o : feed.getEntries()) {
            SyndEntryImpl message = (SyndEntryImpl) o;
            XContentBuilder xcb = toJson(message, null, null, true);
            assertThat(xcb, notNullValue());
            assertThat(xcb.string(), containsString("<p>"));
            logger.info(xcb.string());
        }
    }

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

        assertThat(feed.getEntries().size(), greaterThan(0));
        for (Object o : feed.getEntries()) {
            SyndEntryImpl message = (SyndEntryImpl) o;
            XContentBuilder xcb = toJson(message, null, null, false);
            assertThat(xcb, notNullValue());
            assertThat(xcb.string(), new SubstringMatcher("<p>") {
                @Override
                protected boolean evalSubstringOf(String s) {
                    return s.indexOf(substring) < 0;
                }
View Full Code Here

                protected String relationship() {
                    return "not containing";
                }
            });

            logger.info(xcb.string());
        }
    }
}
View Full Code Here

        builder.endObject();
      }
      builder.endArray();
    }
    builder.endObject();
    return builder.string();
  }

  /**
   * @param spaceKey to get info for
   * @return spaces indexing info or null if not found.
View Full Code Here

    mapping.endObject();
    mapping.endObject();
    mapping.endObject();

    assertEquals(mapping.string(), generatedMapping.string());
  }

}
View Full Code Here

    mapping.endObject();
    mapping.endObject();
    mapping.endObject();

    assertEquals(mapping.string(), generatedMapping.string());
  }

  /**
   * Tests if a collection of objects mapping works
   *
 
View Full Code Here

    mapping.endObject();
    mapping.endObject();
    mapping.endObject();

    assertEquals(mapping.string(), generatedMapping.string());
  }

}
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.