Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pom.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>spring-batch-admin</artifactId>
<name>Spring Batch Admin</name>
<description>A set of services (Java, JSON) and a UI (webapp) for managing and launching Spring Batch jobs.</description>
<version>1.3.0.BUILD-SNAPSHOT</version>
<version>2.0.0.RELEASE-esta1</version>
<packaging>pom</packaging>
<scm>
<url>http://github.com/SpringSource/spring-batch-admin</url>
Expand Down Expand Up @@ -279,6 +279,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<junitArtifactName>junit:junit</junitArtifactName>
<!-- some tests did only work in IDE without this -->
<forkMode>true</forkMode>
</configuration>
</plugin>
<plugin>
Expand Down
10 changes: 5 additions & 5 deletions spring-batch-admin-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ visualization of Batch meta data, and also launching and stopping jobs inside th
<parent>
<artifactId>spring-batch-admin-parent</artifactId>
<groupId>org.springframework.batch</groupId>
<version>1.3.0.BUILD-SNAPSHOT</version>
<version>2.0.0.RELEASE-esta1</version>
<relativePath>../spring-batch-admin-parent</relativePath>
</parent>
<name>Manager</name>
Expand Down Expand Up @@ -71,7 +71,7 @@ visualization of Batch meta data, and also launching and stopping jobs inside th
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-integration</artifactId>
<version>1.3.0.BUILD-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
Expand Down Expand Up @@ -160,7 +160,7 @@ visualization of Batch meta data, and also launching and stopping jobs inside th
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-admin-resources</artifactId>
<version>1.3.0.BUILD-SNAPSHOT</version>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
Expand All @@ -182,8 +182,8 @@ visualization of Batch meta data, and also launching and stopping jobs inside th
<artifactId>com.springsource.bundlor.maven</artifactId>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<contextPath>/steps</contextPath>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<bean class="org.springframework.batch.admin.integration.MultipartToJobConfigurationRequestTransformer" />
</integration:transformer>

<http:inbound-channel-adapter name="/job-configuration" channel="job-configuration-multipart"
<http:inbound-channel-adapter path="/job-configuration" channel="job-configuration-multipart"
request-payload-type="org.springframework.batch.admin.integration.MultipartJobConfigurationRequest" view-name="redirect:jobs"
supported-methods="POST" message-converters="multipartJobConfigurationRequestHttpMessageConverter" />

<http:inbound-gateway name="/job-configuration.json" request-channel="job-configurations"
<http:inbound-gateway path="/job-configuration.json" request-channel="job-configurations"
reply-key="jobs" reply-channel="job-registrations" request-payload-type="org.springframework.core.io.Resource"
view-name="jobs" supported-methods="POST" message-converters="resourceHttpMessageConverter" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.BatchStatus;
Expand Down Expand Up @@ -85,6 +86,7 @@ public void testFakeRestart() throws Exception {

assertEquals(jobExecution.getJobId(), newExecution.getJobId());
Future<BatchStatus> poll = new DirectPoller<BatchStatus>(100L).poll(new Callable<BatchStatus>() {
@Override
public BatchStatus call() throws Exception {
JobExecution jobExecution = jobExplorer.getJobExecution(newExecution.getId());
BatchStatus status = jobExecution.getStatus();
Expand All @@ -98,7 +100,7 @@ public BatchStatus call() throws Exception {

}

@Test
@Test @Ignore // TODO: Fails (mvn only) under SF 4
public void testLaunchWithJobRunning() throws Exception {
JobExecution jobExecution;
jobExecution = jobRepositoryTestUtils.createJobExecutions("test-job", new String[0], 1).get(0);
Expand Down Expand Up @@ -152,6 +154,7 @@ public void testLaunchWithJobRunningButFails() throws Exception {

assertEquals(jobExecution.getJobId(), newExecution.getJobId());
Future<BatchStatus> poll = new DirectPoller<BatchStatus>(100L).poll(new Callable<BatchStatus>() {
@Override
public BatchStatus call() throws Exception {
JobExecution jobExecution = jobExplorer.getJobExecution(newExecution.getId());
BatchStatus status = jobExecution.getStatus();
Expand Down Expand Up @@ -204,6 +207,7 @@ public void testAbandonedWhenCheckJobDuringLaunchFails() throws Exception {

assertEquals(jobExecution.getJobId(), newExecution.getJobId());
Future<BatchStatus> poll = new DirectPoller<BatchStatus>(100L).poll(new Callable<BatchStatus>() {
@Override
public BatchStatus call() throws Exception {
JobExecution jobExecution = jobExplorer.getJobExecution(newExecution.getId());
BatchStatus status = jobExecution.getStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import org.springframework.batch.core.JobExecution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.Message;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.SubscribableChannel;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -51,9 +51,9 @@ public class FileDropJobIntegrationTests {
@Qualifier("job-operator")
private SubscribableChannel replies;

private BlockingQueue<JobExecution> receiver = new ArrayBlockingQueue<JobExecution>(1);
private final BlockingQueue<JobExecution> receiver = new ArrayBlockingQueue<JobExecution>(1);

private MessageHandler handler = new MessageHandler() {
private final MessageHandler handler = new MessageHandler() {
public void handleMessage(Message<?> message) {
receiver.add((JobExecution) message.getPayload());
}
Expand All @@ -63,14 +63,14 @@ public void handleMessage(Message<?> message) {
public void start() {
replies.subscribe(handler);
}

@BeforeClass
@AfterClass
public static void deleteOldFiles() throws Exception {
FileUtils.deleteDirectory(new File("target/data"));
new File("target/data").mkdirs();
new File("target/data").mkdirs();
}

@After
public void cleanup() {
replies.unsubscribe(handler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.io.ClassPathResource;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessagingException;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.core.SubscribableChannel;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -55,13 +55,13 @@ public class JobConfigurationRequestIntegrationTests {

private List<String> result;

private MessageHandler handler = new MessageHandler() {
private final MessageHandler handler = new MessageHandler() {
@SuppressWarnings("unchecked")
public void handleMessage(Message<?> message) throws MessagingException {
result = (List<String>) message.getPayload();
}
};

@Before
public void init() {
replies.subscribe(handler);
Expand All @@ -78,14 +78,13 @@ public void testRegisterFromSimpleRequestString() throws Exception {

MessagingTemplate gateway = new MessagingTemplate();
gateway.setReceiveTimeout(500L);
gateway.afterPropertiesSet();

JobConfigurationRequest request = new JobConfigurationRequest();
request.setXml(IOUtils.toString(new ClassPathResource("/staging-context.xml").getInputStream()));
gateway.convertAndSend(requests, request);
assertNotNull("Time out waiting for reply", result);
assertEquals("[staging]", result.toString());

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import org.springframework.batch.integration.launch.JobLaunchRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.core.SubscribableChannel;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import org.springframework.batch.test.JobRepositoryTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.core.SubscribableChannel;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -102,6 +102,7 @@ public boolean matchesSafely(Exception item) {
// JobParametersNotFoundException;
}

@Override
public void describeTo(Description description) {
description.appendText("exception has cause of JobParametersNotFoundException");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.springframework.batch.core.JobExecution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.core.SubscribableChannel;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@

import java.util.concurrent.atomic.AtomicReference;

import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessageDeliveryException;
import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.MessageRejectedException;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.SubscribableChannel;
import org.springframework.integration.message.GenericMessage;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageDeliveryException;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.support.GenericMessage;

/**
* @author Dave Syer
*
*
*/
public class TestMessagingGateway {

private AtomicReference<Object> reference = new AtomicReference<Object>();
private final AtomicReference<Object> reference = new AtomicReference<Object>();

private MessageChannel requestChannel;
private final MessageChannel requestChannel;

private SubscribableChannel replyChannel;
private final SubscribableChannel replyChannel;

private MessageHandler handler = new MessageHandler() {
private final MessageHandler handler = new MessageHandler() {
@Override
public void handleMessage(Message<?> message) throws MessageRejectedException, MessageHandlingException,
MessageDeliveryException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.io.Resource;
import org.springframework.integration.Message;
import org.springframework.integration.MessageDeliveryException;
import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.MessageRejectedException;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.SubscribableChannel;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageDeliveryException;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
public class LocalFileServiceIntegrationTests {

private static Log logger = LogFactory.getLog(LocalFileServiceIntegrationTests.class);

@Autowired
Expand All @@ -35,10 +35,11 @@ public class LocalFileServiceIntegrationTests {
@Autowired
@Qualifier("input-files")
private SubscribableChannel files;

private static File trigger;

private static MessageHandler handler = new MessageHandler() {
@Override
public void handleMessage(Message<?> message) throws MessageRejectedException, MessageHandlingException,
MessageDeliveryException {
logger.debug("Handled " + message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.io.Resource;
import org.springframework.integration.Message;
import org.springframework.integration.MessageDeliveryException;
import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.MessageRejectedException;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.SubscribableChannel;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageDeliveryException;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -32,19 +32,19 @@
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext(classMode=ClassMode.AFTER_CLASS)
public class LocalFileServiceJobIntegrationTests {

private static Log logger = LogFactory.getLog(LocalFileServiceJobIntegrationTests.class);

@Autowired
private LocalFileService service;

@Autowired
private JobLauncher jobLauncher;

@Autowired
@Qualifier("staging")
private Job job;

private JobExecution jobExecution;

@Autowired
Expand All @@ -59,6 +59,7 @@ public void setUp() throws Exception {
@Test
public void testTrigger() throws Exception {
operator.subscribe(new MessageHandler() {
@Override
public void handleMessage(Message<?> message) throws MessageRejectedException, MessageHandlingException,
MessageDeliveryException {
logger.debug(""+message);
Expand All @@ -72,7 +73,7 @@ public void handleMessage(Message<?> message) throws MessageRejectedException, M
assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
Thread.sleep(1000L);
}

@Test
public void testResourceConverter() throws Exception {
FileInfo info = service.createFile("foo/crap");
Expand Down
Loading