Esempio n. 1
0
  @Test
  public void shouldDoAsyncConversionGivenConverterName() throws IOException {
    File file = FileUtils.getResourceFileFromContext("test-data/hello.doc");
    Blob blob = Blobs.createBlob(file, "application/msword", null, "hello.doc");
    BlobHolder bh = new SimpleBlobHolder(blob);

    String id = conversionService.scheduleConversion("identity", bh, null);
    assertNotNull(id);

    eventService.waitForAsyncCompletion();

    BlobHolder result = conversionService.getConversionResult(id, true);
    assertNotNull(result);
    List<Blob> blobs = result.getBlobs();
    assertEquals(1, blobs.size());
    Blob resultBlob = blobs.get(0);
    assertEquals(blob.getFilename(), resultBlob.getFilename());
    assertEquals(blob.getMimeType(), resultBlob.getMimeType());
  }
 protected void waitForAsyncCompletion() {
   nextTransaction();
   eventService.waitForAsyncCompletion();
 }