Skip to content

Commit

Permalink
Github issue #75 (Transient field "future" cannot have any JAXB annot…
Browse files Browse the repository at this point in the history
…ations XmlTransient).
  • Loading branch information
chengfang committed Jun 8, 2016
1 parent 0349d9f commit cf033fa
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
Expand Up @@ -21,7 +21,6 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
* Represents a job schedule. Instances of this class may be transferred
Expand Down Expand Up @@ -99,7 +98,6 @@ public enum Status {
* Some {@link JobScheduler} implementations may not need or support
* {@code Future}, and in that case, this field is not used.
*/
@XmlTransient
private transient Future<?> future;

/**
Expand Down
Expand Up @@ -385,6 +385,47 @@ public void scheduleSingleAction() throws Exception {
batchClient.getJobExecution(jobSchedule.getJobExecutionIds().get(0)).getBatchStatus());
}

/**
* Test that schedules a single-action job execution with XML request and response media type.
* This test is similar to {@link #scheduleSingleAction()}, except the request & response
* media type.
*
* @throws Exception if errors occur
* @see #scheduleSingleAction()
*/
@Test
public void scheduleSingleActionXml() throws Exception {
final JobScheduleConfig scheduleConfig = JobScheduleConfigBuilder.newInstance()
.jobName(jobName1)
.initialDelay(initialDelayMinute)
.build();

URI uri = batchClient.getJobUriBuilder("schedule")
.resolveTemplate("jobXmlName", scheduleConfig.getJobName()).build();
WebTarget target = batchClient.target(uri);
JobSchedule jobSchedule = target.request().accept(MediaType.APPLICATION_XML_TYPE)
.post(Entity.entity(scheduleConfig, MediaType.APPLICATION_XML_TYPE), JobSchedule.class);

System.out.printf("Scheduled job schedule %s: %s%n", jobSchedule.getId(), jobSchedule);
Thread.sleep(sleepTimeMillis);

uri = batchClient.getJobScheduleUriBuilder("getJobSchedule")
.resolveTemplate("scheduleId", jobSchedule.getId()).build();
target = batchClient.target(uri);
jobSchedule = target.request().accept(MediaType.APPLICATION_XML_TYPE).get(JobSchedule.class);

assertEquals(JobSchedule.Status.DONE, jobSchedule.getStatus());
assertEquals(1, jobSchedule.getJobExecutionIds().size());

uri = batchClient.getJobExecutionUriBuilder(null)
.path(String.valueOf(jobSchedule.getJobExecutionIds().get(0))).build();
target = batchClient.target(uri);
JobExecutionEntity jobExecutionEntity = target.request().accept(MediaType.APPLICATION_XML_TYPE)
.get(JobExecutionEntity.class);

assertEquals(BatchStatus.COMPLETED, jobExecutionEntity.getBatchStatus());
}

@Test
public void scheduleInterval() throws Exception {
final JobScheduleConfig scheduleConfig = JobScheduleConfigBuilder.newInstance()
Expand Down

0 comments on commit cf033fa

Please sign in to comment.