Package com.gentics.cr

Examples of com.gentics.cr.CRResolvableBean


  CRResolvableBean bean;
  GenericConfiguration config;

  @Before
  public void setUp() throws Exception {
    bean = new CRResolvableBean();

    InputStream stream = RTFContentTransformerTest.class.getResourceAsStream("testdoc.rtf");
    byte[] arr = IOUtils.toByteArray(stream);
    bean.set("binarycontent", arr);
View Full Code Here


  public void testTransformerXLTX() throws Exception {
    testSpreadsheet("testdoc.xltx");
  }

  private void testSpreadsheet(String filename) throws IOException, CRException {
    CRResolvableBean bean = new CRResolvableBean();
    bean.set(BINARY_ATTRIBUTE, getContentFromFile(filename));
    t.processBean(bean);
    assertEquals("Tabelle1\n\ttesttext ÄÖÜäüö߀\n\n\nTabelle2\n\n\nTabelle3\n\n\n", bean.get(BINARY_ATTRIBUTE));
  }
View Full Code Here

  @Test
  public void testContentAttribute() throws URISyntaxException, IOException, CRException {
    CRConfigUtil config = new CRConfigUtil();
    config.set(HTMLContentTransformer.TRANSFORMER_ATTRIBUTE_KEY, "content");

    CRResolvableBean bean = new CRResolvableBean();
    bean.set("contentid", "10007.1");
    bean.set("content", readFile("test.html").toString());

    HTMLContentTransformer transformer = new HTMLContentTransformer(config);
    transformer.processBean(bean);

    assertEquals(readFile("testresult.html").toString(), bean.get("content"));
  }
View Full Code Here

  public void testNameAttribute() throws CRException {
    CRConfigUtil config = new CRConfigUtil();
    config.set(HTMLContentTransformer.TRANSFORMER_ATTRIBUTE_KEY, "name");
    HTMLContentTransformer transformer = new HTMLContentTransformer(config);

    CRResolvableBean bean1 = new CRResolvableBean();
    bean1.set("contentid", "10007.1");
    bean1.set("name", "Fußball");
    transformer.processBean(bean1);
    assertEquals("Fußball", bean1.get("name"));

    CRResolvableBean bean2 = new CRResolvableBean();
    bean2.set("name", "Über das USP");
    transformer.processBean(bean2);
    assertEquals("Über das USP", bean2.get("name"));

    CRResolvableBean bean3 = new CRResolvableBean();
    bean3.set("name", "<strong>das ist eine test überschrift</strong>");
    transformer.processBean(bean3);
    assertEquals("das ist eine test überschrift", bean3.get("name"));
  }
View Full Code Here

  public void testStrings() throws CRException {
    CRConfigUtil config = new CRConfigUtil();
    config.set(HTMLContentTransformer.TRANSFORMER_ATTRIBUTE_KEY, "name");
    HTMLContentTransformer transformer = new HTMLContentTransformer(config);

    CRResolvableBean bean = new CRResolvableBean();
    bean.set("name", "ASDF-lexikon\n\t\n\t\t\t<br class=\"aloha-end-br\"/>");
    transformer.processBean(bean);
    assertEquals("ASDF-lexikon", bean.get("name"));

    CRResolvableBean bean2 = new CRResolvableBean();
    bean2.set("name", "<abbr title=\"Informations- und Kommunikationstechnologie\">IKT</abbr>-Sicherheitslexikon  ");
    transformer.processBean(bean2);
    assertEquals("IKT-Sicherheitslexikon", bean2.get("name"));

    CRResolvableBean bean3 = new CRResolvableBean();
    bean3.set("name", "<abbr title=\"Informations- und Kommunikationstechnologie\">IKT</abbr>- Sicherheitslexikon  ");
    transformer.processBean(bean3);
    assertEquals("IKT- Sicherheitslexikon", bean3.get("name"));

    CRResolvableBean bean4 = new CRResolvableBean();
    bean4.set("name", "<br class=\"aloha-end-br\"/>");
    transformer.processBean(bean4);
    assertEquals("", bean4.get("name"));
  }
View Full Code Here

  Analyzer analyzer;
  Query query;

  @Before
  public void setUp() throws Exception {
    bean = new CRResolvableBean();

    InputStream stream = PDFHighlighterTest.class.getResourceAsStream("test.pdf");
    byte[] arr = IOUtils.toByteArray(stream);
    bean.set("binarycontent", arr);
View Full Code Here

  }

  public void testPhraseBolder2() throws Exception {
    System.out.println("PHRASE2");
    ContentHighlighter h = new PhraseBolder(new GenericConfiguration());
    CRResolvableBean crBean = new CRResolvableBean();
    crBean.set("binarycontent", "this is a test (AHSt)");
    String ret = h.highlight((String) crBean.get("binarycontent"), query);
    System.out.println(ret);

    assertTrue(ret != null && !"".equals(ret));
  }
View Full Code Here

TOP

Related Classes of com.gentics.cr.CRResolvableBean

Copyright © 2018 www.massapicom. 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.