<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic My simple PDF2ImageConverter unit test is failing. Is it my mistake or a bug? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/my-simple-pdf2imageconverter-unit-test-is-failing-is-it-my/m-p/318259#M5260</link>
    <description>&lt;P&gt;I expect the following to not crash, but instead it results in a stack trace when I attempt to call ConversionService.convert().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;java.lang.NullPointerException
	at org.nuxeo.ecm.platform.convert.plugins.PDF2ImageConverter.getCmdStringParameters(PDF2ImageConverter.java:89)
	at org.nuxeo.ecm.platform.convert.plugins.CommandLineBasedConverter.convert(CommandLineBasedConverter.java:91)
	at org.nuxeo.ecm.core.convert.service.ConversionServiceImpl.convert(ConversionServiceImpl.java:203)
	at com.example.PDFToJPEGConverterTest.testConverter(PDFToJPEGConverterTest.java:36)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the unit test code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;package com.example;

import com.google.inject.Inject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nuxeo.common.utils.FileUtils;
import org.nuxeo.ecm.core.api.blobholder.BlobHolder;
import org.nuxeo.ecm.core.api.blobholder.SimpleBlobHolder;
import org.nuxeo.ecm.core.api.impl.blob.FileBlob;
import org.nuxeo.ecm.core.convert.api.ConversionService;
import org.nuxeo.ecm.platform.test.PlatformFeature;
import org.nuxeo.runtime.test.runner.Deploy;
import org.nuxeo.runtime.test.runner.Features;
import org.nuxeo.runtime.test.runner.FeaturesRunner;

import java.io.File;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@RunWith(FeaturesRunner.class)
@Features({PlatformFeature.class})
@Deploy({"org.nuxeo.ecm.platform.convert", "org.nuxeo.ecm.platform.commandline.executor"})
public class PDFToJPEGConverterTest {

    @Inject
    ConversionService service;

    @Test
    public void testConverter() {
        String converterName = service.getConverterName(
                "application/pdf", "image/jpeg");
        File pdfInput = FileUtils.getResourceFileFromContext("Chapter 14.pdf");
        assertTrue(pdfInput.length() &amp;gt; 0);
        BlobHolder blobHolder = new SimpleBlobHolder(new FileBlob(pdfInput));
        Object result = service.convert(converterName, blobHolder, null);
        assertNotNull(result);
    }


}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 16 Mar 2015 21:02:04 GMT</pubDate>
    <dc:creator>Steven_Huwig1</dc:creator>
    <dc:date>2015-03-16T21:02:04Z</dc:date>
    <item>
      <title>My simple PDF2ImageConverter unit test is failing. Is it my mistake or a bug?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/my-simple-pdf2imageconverter-unit-test-is-failing-is-it-my/m-p/318259#M5260</link>
      <description>&lt;P&gt;I expect the following to not crash, but instead it results in a stack trace when I attempt to call ConversionService.convert().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;java.lang.NullPointerException
	at org.nuxeo.ecm.platform.convert.plugins.PDF2ImageConverter.getCmdStringParameters(PDF2ImageConverter.java:89)
	at org.nuxeo.ecm.platform.convert.plugins.CommandLineBasedConverter.convert(CommandLineBasedConverter.java:91)
	at org.nuxeo.ecm.core.convert.service.ConversionServiceImpl.convert(ConversionServiceImpl.java:203)
	at com.example.PDFToJPEGConverterTest.testConverter(PDFToJPEGConverterTest.java:36)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the unit test code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;package com.example;

import com.google.inject.Inject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nuxeo.common.utils.FileUtils;
import org.nuxeo.ecm.core.api.blobholder.BlobHolder;
import org.nuxeo.ecm.core.api.blobholder.SimpleBlobHolder;
import org.nuxeo.ecm.core.api.impl.blob.FileBlob;
import org.nuxeo.ecm.core.convert.api.ConversionService;
import org.nuxeo.ecm.platform.test.PlatformFeature;
import org.nuxeo.runtime.test.runner.Deploy;
import org.nuxeo.runtime.test.runner.Features;
import org.nuxeo.runtime.test.runner.FeaturesRunner;

import java.io.File;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@RunWith(FeaturesRunner.class)
@Features({PlatformFeature.class})
@Deploy({"org.nuxeo.ecm.platform.convert", "org.nuxeo.ecm.platform.commandline.executor"})
public class PDFToJPEGConverterTest {

    @Inject
    ConversionService service;

    @Test
    public void testConverter() {
        String converterName = service.getConverterName(
                "application/pdf", "image/jpeg");
        File pdfInput = FileUtils.getResourceFileFromContext("Chapter 14.pdf");
        assertTrue(pdfInput.length() &amp;gt; 0);
        BlobHolder blobHolder = new SimpleBlobHolder(new FileBlob(pdfInput));
        Object result = service.convert(converterName, blobHolder, null);
        assertNotNull(result);
    }


}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Mar 2015 21:02:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/my-simple-pdf2imageconverter-unit-test-is-failing-is-it-my/m-p/318259#M5260</guid>
      <dc:creator>Steven_Huwig1</dc:creator>
      <dc:date>2015-03-16T21:02:04Z</dc:date>
    </item>
  </channel>
</rss>

