diff --git a/core/src/main/java/org/mapfish/print/servlet/job/PrintJob.java b/core/src/main/java/org/mapfish/print/servlet/job/PrintJob.java index 33c1f6f42..7d2564736 100644 --- a/core/src/main/java/org/mapfish/print/servlet/job/PrintJob.java +++ b/core/src/main/java/org/mapfish/print/servlet/job/PrintJob.java @@ -126,7 +126,7 @@ protected abstract PrintJobResult createResult( throws URISyntaxException, IOException; @Override - public final PrintJobResult call() throws Exception { + public PrintJobResult call() throws Exception { SecurityContextHolder.setContext(this.securityContext); final Timer.Context timer = this.metricRegistry diff --git a/core/src/test/java/org/mapfish/print/servlet/job/ClusteringTaskTest.java b/core/src/test/java/org/mapfish/print/servlet/job/ClusteringTaskTest.java index cdfdae2ea..6ba014c18 100644 --- a/core/src/test/java/org/mapfish/print/servlet/job/ClusteringTaskTest.java +++ b/core/src/test/java/org/mapfish/print/servlet/job/ClusteringTaskTest.java @@ -3,14 +3,11 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.util.HashMap; import org.json.JSONObject; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.mapfish.print.AbstractMapfishSpringTest; import org.mapfish.print.config.access.AlwaysAllowAssertion; -import org.mapfish.print.processor.AbstractProcessor; import org.mapfish.print.servlet.ClusteredMapPrinterServletTest; import org.mapfish.print.servlet.MapPrinterServlet; import org.mapfish.print.servlet.job.impl.PrintJobEntryImpl; @@ -22,7 +19,6 @@ import org.springframework.test.context.ContextConfiguration; @ContextConfiguration(locations = {ClusteredMapPrinterServletTest.CLUSTERED_CONTEXT}) -@Ignore // db must be set up to run this test public class ClusteringTaskTest extends AbstractMapfishSpringTest { TestJobManager jobMan1; @@ -79,8 +75,7 @@ public void testRun() throws Exception { } private class TestJobManager extends ThreadPoolJobManager { - private String name; - + private final String name; private int jobsRun; public TestJobManager(String name) { @@ -94,18 +89,16 @@ protected PrintJob createJob(final PrintJobEntry entry) { PrintJob job = new PrintJob() { @Override - protected PrintResult withOpenOutputStream(PrintAction function) throws Exception { - System.out.println(getEntry().getReferenceId() + " is being run by jobman " + name); - TestJobManager.this.jobsRun++; - Thread.sleep(1000); - return new PrintResult( - 42, new AbstractProcessor.Context(new HashMap())); + protected PrintJobResult createResult( + String fileName, String fileExtension, String mimeType) { + return null; } @Override - protected PrintJobResult createResult( - final String fileName, final String fileExtension, final String mimeType) { - return null; + public PrintJobResult call() throws Exception { + System.out.println(getEntry().getReferenceId() + " is being run by jobman " + name); + jobsRun++; + return super.call(); } }; job.initForTesting(ClusteringTaskTest.this.context);