Esempio n. 1
0
  public void testReadBlob() throws Exception {
    commitBlob();

    getRepository().getRevisionManager().getCache().clear();

    CDOSession session = openSession();
    CDOView view = session.openView();
    CDOResource resource = view.getResource(getResourcePath("res"));

    Image image = (Image) resource.getContents().get(0);
    assertEquals(320, image.getWidth());
    assertEquals(200, image.getHeight());

    CDOBlob blob = image.getData();
    assertEquals(null, blob);
  }
Esempio n. 2
0
  private void commitBlob() throws Exception {
    InputStream inputStream = null;

    try {
      Image image = getModel3Factory().createImage();
      image.setWidth(320);
      image.setHeight(200);

      CDOSession session = openSession();
      CDOTransaction transaction = session.openTransaction();
      CDOResource resource = transaction.createResource(getResourcePath("res"));
      resource.getContents().add(image);

      transaction.commit();
    } finally {
      IOUtil.close(inputStream);
    }
  }