Skip to content

Commit

Permalink
Enabled cluster test
Browse files Browse the repository at this point in the history
  • Loading branch information
sebr72 committed Oct 30, 2024
1 parent 8caf357 commit 30bc3fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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<String, String>()));
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);
Expand Down

0 comments on commit 30bc3fa

Please sign in to comment.