private SectionContentEntity createSectionContent(ContentKey contentKey, String contentName) {

    ContentEntity content = new ContentEntity();
    content.setKey(contentKey);
    content.setName(contentName);

    SectionContentEntity sectionContent = new SectionContentEntity();
    sectionContent.setKey(new SectionContentKey(contentKey.toString()));
    sectionContent.setContent(content);

    return sectionContent;
  }
예제 #2
0
  @Test
  @Ignore
  public void request_content_image_with_label_small() throws Exception {
    byte[] bytes = loadImage("Arn.JPG");
    ContentKey contentKey =
        createImageContent(
            "MyImage.jpg", 2, bytes, "ImageCategory", new DateTime(2011, 6, 27, 10, 0, 0, 0), null);

    String imageRequestPath = "_image/" + contentKey.toString() + "/label/small";
    setPathInfoAndRequestURI(httpServletRequest, imageRequestPath);
    httpServletRequest.setParameter("_background", "0xffffff");
    httpServletRequest.setParameter("_quality", "100");
    imageController.handleRequestInternal(httpServletRequest, httpServletResponse);

    assertEquals("image/png", httpServletResponse.getContentType());
    assertEquals(HttpServletResponse.SC_OK, httpServletResponse.getStatus());
  }