Package com.gentics.cr

Examples of com.gentics.cr.CRResolvableBean


  GenericConfiguration config;
  ContentTransformer t;

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

    config = new GenericConfiguration();
    config.set("attribute", "content");
    config.set("langattribute", "lang");
    t = new LanguageIdentifyer(config);
View Full Code Here


      JSONObject json = (JSONObject) JSONSerializer.toJSON(method.getResponseBodyAsString());
      JSONArray arr = json.getJSONArray("results");
      for (Object o : arr) {
        JSONObject item = (JSONObject) o;
        CRResolvableBean bean = createBean(item);
        resultlist.add(bean);
      }

    } catch (HttpException e) {
      System.err.println("Fatal protocol violation: " + e.getMessage());
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  private CRResolvableBean createBean(JSONObject item) {
    Set<Map.Entry> entrySet = item.entrySet();
    CRResolvableBean bean = new CRResolvableBean();
    for (Map.Entry entry : entrySet) {
      bean.set((String) entry.getKey(), entry.getValue());
    }
    return bean;
  }
View Full Code Here

  Collection<CRResolvableBean> beanCollection = new Vector<CRResolvableBean>();

  @Before
  public void setUp() throws CRException {
    CRResolvableBean b1 = new CRResolvableBean();
    b1.set(YoungestTimestampContentRepository.UPDATE_TIMESTAMP_KEY, new Long(111111111L));
    beanCollection.add(b1);

    CRResolvableBean b2 = new CRResolvableBean();
    b2.set(YoungestTimestampContentRepository.UPDATE_TIMESTAMP_KEY, new Long(111211111L));
    beanCollection.add(b2);

    CRResolvableBean b3 = new CRResolvableBean();
    b3.set(YoungestTimestampContentRepository.UPDATE_TIMESTAMP_KEY, new Long(131111011L));
    beanCollection.add(b3);

    CRResolvableBean b4 = new CRResolvableBean();
    b4.set(YoungestTimestampContentRepository.UPDATE_TIMESTAMP_KEY, new Long(111111011L));
    beanCollection.add(b4);
  }
View Full Code Here

  Collection<CRResolvableBean> beanCollection = new Vector<CRResolvableBean>();

  @Before
  public void setUp() throws CRException {
    CRResolvableBean b1 = new CRResolvableBean();
    b1.set(YoungestTimestampContentRepository.UPDATE_TIMESTAMP_KEY, new Long(111111111L));
    beanCollection.add(b1);

    CRResolvableBean b2 = new CRResolvableBean();
    b2.set(YoungestTimestampContentRepository.UPDATE_TIMESTAMP_KEY, new Long(111211111L));
    beanCollection.add(b2);

    CRResolvableBean b3 = new CRResolvableBean();
    b3.set(YoungestTimestampContentRepository.UPDATE_TIMESTAMP_KEY, new Long(131111011L));
    beanCollection.add(b3);

    CRResolvableBean b4 = new CRResolvableBean();
    b4.set(YoungestTimestampContentRepository.UPDATE_TIMESTAMP_KEY, new Long(111111011L));
    beanCollection.add(b4);

    Collection<CRResolvableBean> children = new Vector<CRResolvableBean>();
    CRResolvableBean c1 = new CRResolvableBean();
    c1.set(YoungestTimestampContentRepository.UPDATE_TIMESTAMP_KEY, new Long(141111011L));
    children.add(c1);

    CRResolvableBean c2 = new CRResolvableBean();
    c2.set(YoungestTimestampContentRepository.UPDATE_TIMESTAMP_KEY, new Long(151111011L));
    children.add(c2);
    b3.setChildRepository(children);
  }
View Full Code Here

    CRConfigUtil config = HSQLTestConfigFactory.getDefaultHSQLConfiguration(RESTBinaryContainerTest.class.getName());
    config.set("rp.1.rpClass", "com.gentics.cr.CRRequestProcessor");
    container = new RESTBinaryContainer(config);
    testHandler = new HSQLTestHandler(config.getRequestProcessorConfig(1));
   
    CRResolvableBean testBean = new CRResolvableBean();
    testBean.setObj_type("10008");
   
    byte[] file = testHandler.getFileAsByteArray("picture.png");
    testBean.set("filename", "picture.png");
    testBean.set("binarycontent", file);
    testBean.set("mimetype", "image/png");
   
    testHandler.createBean(testBean);
   
    CRResolvableBean testBean2 = new CRResolvableBean();
    testBean2.setObj_type("10008");
   
    byte[] file2 = testHandler.getFileAsByteArray("file.txt");
    testBean2.set("filename", "file.txt");
    testBean2.set("binarycontent", file2);
    testBean2.set("mimetype", "text/plain");
   
    testHandler.createBean(testBean2);
  }
View Full Code Here

public class CRResolvableBeanTest {
 
  @Test
  public void testContentidConstructor() {
    CRResolvableBean bean = new CRResolvableBean("3.4");
    assertEquals("Contentid not correct.", "3.4", bean.getContentid());
    assertEquals("obj_id not correct.", "4", bean.getObj_id());
    assertEquals("obj_type not correct.", "3", bean.getObj_type());
  }
View Full Code Here

    String s1 = renderString(CONTENT_2, renderer, true);
    assertEquals("Testing ContentRenderer with PLink and velocity", EXPECTED_2 , s1);
  }
 
  private String renderString(String content, IContentRenderer renderer, boolean doVelocity) throws CRException, IOException {
    CRResolvableBean bean = new CRResolvableBean();
    bean.set("content", content);
    return renderer.renderContent(bean, "content", true, replacer, doVelocity, null);
  }
View Full Code Here

  private static final String UPDATE_TIMESTAMP_KEY = "updatetimestamp";

  @Before
  public void setUp() throws CRException {
   
    CRResolvableBean mr = new CRResolvableBean("10001.1");
    mr.set(PHPContentRepositoryTest.UPDATE_TIMESTAMP_KEY, new Long(111111111L));
    Map<String, String[]> suggestions = new HashMap<String, String[]>();
    suggestions.put("tst", new String[]{"test", "tess"});
    mr.set("suggestions", suggestions);
    beanCollection.add(mr);
   
    CRResolvableBean b1 = new CRResolvableBean("10002.1");
    b1.set(PHPContentRepositoryTest.UPDATE_TIMESTAMP_KEY, new Long(111111111L));
    beanCollection.add(b1);

    CRResolvableBean b2 = new CRResolvableBean("10002.2");
    b2.set(PHPContentRepositoryTest.UPDATE_TIMESTAMP_KEY, new Long(111211111L));
    beanCollection.add(b2);

    CRResolvableBean b3 = new CRResolvableBean("10002.3");
    b3.set(PHPContentRepositoryTest.UPDATE_TIMESTAMP_KEY, new Long(131111011L));
    beanCollection.add(b3);

    CRResolvableBean b4 = new CRResolvableBean("10002.4");
    b4.set(PHPContentRepositoryTest.UPDATE_TIMESTAMP_KEY, new Long(111111011L));
    beanCollection.add(b4);

    Collection<CRResolvableBean> children = new Vector<CRResolvableBean>();
    CRResolvableBean c1 = new CRResolvableBean("10002.5");
    c1.set(PHPContentRepositoryTest.UPDATE_TIMESTAMP_KEY, new Long(141111011L));
    children.add(c1);

    CRResolvableBean c2 = new CRResolvableBean("10002.6");
    c2.set(PHPContentRepositoryTest.UPDATE_TIMESTAMP_KEY, new Long(151111011L));
    c2.set("permissions", new String[] { "mar, sal, soc" });
    children.add(c2);
    b3.setChildRepository(children);
  }
View Full Code Here

        bean.get("string"));
      if (id.equals(1)) {
        Collection<?> values = (Collection<Object>) bean.get("values");
        assertEquals("Didn't get all 3 values", 3, values.size());
      } else if (id.equals(2)) {
        CRResolvableBean child = bean.getObject("child", null);
        Integer childId = (Integer) child.get("id");
        assertEquals(
          "Attribute string was not the String equaling the id of object " + childId,
          childId.toString(),
          child.get("string"));
      } else if (id.equals(3)) {
        Collection<CRResolvableBean> children = bean.getMultipleObjects("children", null);
        assertEquals("Didn't get all 2 children", 2, children.size());
      }
    }
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.