You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@batchee.apache.org by rm...@apache.org on 2013/11/05 08:39:15 UTC
[38/62] importing batchee from github - a fork from the IBm RI
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/ClientTestBase.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/ClientTestBase.java b/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/ClientTestBase.java
new file mode 100644
index 0000000..b024add
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/ClientTestBase.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.client;
+
+import com.github.rmannibucau.featuredmock.http.FeaturedHttpServer;
+import com.github.rmannibucau.featuredmock.http.FeaturedHttpServerBuilder;
+import org.apache.batchee.jaxrs.client.impl.JobInstanceImpl;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.JobExecution;
+import javax.batch.runtime.JobInstance;
+import javax.batch.runtime.StepExecution;
+import javax.ws.rs.ext.RuntimeDelegate;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+public abstract class ClientTestBase {
+ private static int port;
+ private static FeaturedHttpServer mockServer;
+ private JobOperator client;
+
+ @BeforeClass
+ public static void startServer() throws IOException {
+ final ServerSocket server = new ServerSocket(0);
+ port = server.getLocalPort();
+ server.close();
+
+ mockServer = new FeaturedHttpServerBuilder().port(port).build().start();
+
+ RuntimeDelegate.setInstance(null); // reset
+ }
+
+ @BeforeMethod
+ public void createClient() {
+ client = newJobOperator(port);
+ }
+
+ protected abstract JobOperator newJobOperator(int port);
+
+ @AfterClass
+ public static void shutdown() {
+ mockServer.stop();
+ }
+
+ @Test
+ public void jobNames() {
+ final Set<String> names = client.getJobNames();
+ assertNotNull(names);
+ assertEquals(2, names.size());
+ assertTrue(names.contains("s2"));
+ assertTrue(names.contains("s1"));
+ }
+
+ @Test
+ public void jobInstancesCount() {
+ assertEquals(5, client.getJobInstanceCount("ajob"));
+ }
+
+ @Test
+ public void getJobInstances() {
+ final List<JobInstance> jobInstances = client.getJobInstances("anotherjob", 0, 30);
+ assertNotNull(jobInstances);
+ assertEquals(2, jobInstances.size());
+ assertEquals("owb", jobInstances.get(0).getJobName());
+ assertEquals(0, jobInstances.get(0).getInstanceId());
+ assertEquals("tomee", jobInstances.get(1).getJobName());
+ assertEquals(1, jobInstances.get(1).getInstanceId());
+ }
+
+ @Test
+ public void getRunningExecutions() {
+ final List<Long> running = client.getRunningExecutions("running");
+ assertNotNull(running);
+ assertEquals(2, running.size());
+ assertEquals(Long.valueOf(1), running.get(0));
+ assertEquals(Long.valueOf(2), running.get(1));
+ }
+
+ @Test
+ public void getJobInstance() {
+ final JobInstance jobInstance = client.getJobInstance(2);
+ assertNotNull(jobInstance);
+ assertEquals("ji", jobInstance.getJobName());
+ assertEquals(12, jobInstance.getInstanceId());
+ }
+
+ @Test
+ public void getParameters() {
+ final Properties params = client.getParameters(54);
+ assertNotNull(params);
+ assertEquals(2, params.size());
+ assertEquals("d", params.getProperty("c"));
+ assertEquals("b", params.getProperty("a"));
+ }
+
+ @Test
+ public void getJobExecution() {
+ final JobExecution execution = client.getJobExecution(159);
+ assertEquals(753, execution.getExecutionId());
+ assertEquals("COMPLETED", execution.getBatchStatus().name());
+ assertEquals("exit", execution.getExitStatus());
+ assertEquals("job", execution.getJobName());
+ }
+
+ @Test
+ public void getJobExecutions() {
+ final List<JobExecution> jobExecutions = client.getJobExecutions(new JobInstanceImpl("job", 45896));
+ assertNotNull(jobExecutions);
+ assertEquals(2, jobExecutions.size());
+ assertEquals("FAILED", jobExecutions.get(0).getBatchStatus().name());
+ assertEquals("out", jobExecutions.get(0).getExitStatus());
+ assertEquals("j0", jobExecutions.get(0).getJobName());
+ assertEquals("COMPLETED", jobExecutions.get(1).getBatchStatus().name());
+ assertEquals("es", jobExecutions.get(1).getExitStatus());
+ assertEquals("j1", jobExecutions.get(1).getJobName());
+ }
+
+ @Test
+ public void getStepExecutions() {
+ final List<StepExecution> stepExecutions = client.getStepExecutions(8946);
+ assertNotNull(stepExecutions);
+ assertEquals(2, stepExecutions.size());
+ assertEquals("FAILED", stepExecutions.get(0).getBatchStatus().name());
+ assertEquals("out", stepExecutions.get(0).getExitStatus());
+ assertEquals("j0", stepExecutions.get(0).getStepName());
+ assertEquals("COMPLETED", stepExecutions.get(1).getBatchStatus().name());
+ assertEquals("es", stepExecutions.get(1).getExitStatus());
+ assertEquals("j1", stepExecutions.get(1).getStepName());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/CxfClientTest.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/CxfClientTest.java b/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/CxfClientTest.java
new file mode 100644
index 0000000..99a466a
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/CxfClientTest.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.client;
+
+import javax.batch.operations.JobOperator;
+
+public class CxfClientTest extends ClientTestBase {
+ @Override
+ protected JobOperator newJobOperator(final int port) {
+ final ClientConfiguration configuration = new ClientConfiguration();
+ configuration.setBaseUrl("http://localhost:" + port + "/");
+ return BatchEEJAXRSClientFactory.newClient(configuration, BatchEEJAXRSClientFactory.API.CXF);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/JAXRS2ClientTest.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/JAXRS2ClientTest.java b/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/JAXRS2ClientTest.java
new file mode 100644
index 0000000..7dcfd4d
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/java/org/apache/batchee/jaxrs/client/JAXRS2ClientTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.client;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+
+import javax.batch.operations.JobOperator;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class JAXRS2ClientTest extends ClientTestBase {
+ private static ClassLoader oldLoader;
+
+ @BeforeClass
+ public static void setEnvironment() { // forcing to use jersey, can't be done through system properties cause of FactoryFinder order
+ oldLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(new URLClassLoader(new URL[0], oldLoader) {
+ @Override
+ public InputStream getResourceAsStream(String name) {
+ if ("META-INF/services/javax.ws.rs.ext.RuntimeDelegate".equals(name)) {
+ return new ByteArrayInputStream("org.glassfish.jersey.internal.RuntimeDelegateImpl".getBytes());
+ }
+ if ("META-INF/services/javax.ws.rs.client.ClientBuilder".equals(name)) {
+ return new ByteArrayInputStream("org.glassfish.jersey.client.JerseyClientBuilder".getBytes());
+ }
+ return super.getResourceAsStream(name);
+ }
+
+ @Override
+ protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
+ if (name.startsWith("org.apache.cxf")) {
+ throw new ClassNotFoundException();
+ }
+ return super.loadClass(name, resolve);
+ }
+ });
+ }
+ @AfterClass
+ public static void resetEnvironment() {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+
+ @Override // this client hacks the class loader to be able to use jaxrs 2 api even if we use jaxrs 1 by default
+ protected JobOperator newJobOperator(final int port) {
+ final ClientConfiguration configuration = new ClientConfiguration();
+ configuration.setBaseUrl("http://localhost:" + port + "/");
+ return BatchEEJAXRSClientFactory.newClient(configuration, BatchEEJAXRSClientFactory.API.JAXRS2);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/resources/batchee/execution/parameter/54.json
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/resources/batchee/execution/parameter/54.json b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/execution/parameter/54.json
new file mode 100644
index 0000000..5ffa51d
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/execution/parameter/54.json
@@ -0,0 +1 @@
+{"entries":[{"key":"a","value":"b"}, {"key":"c","value":"d"}]}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/resources/batchee/executions/running/running.json
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/resources/batchee/executions/running/running.json b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/executions/running/running.json
new file mode 100644
index 0000000..44e2ace
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/executions/running/running.json
@@ -0,0 +1 @@
+[1, 2]
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-execution/159.json
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-execution/159.json b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-execution/159.json
new file mode 100644
index 0000000..872de26
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-execution/159.json
@@ -0,0 +1,8 @@
+{"id": 753, "name": "job", "batchStatus": "COMPLETED", "startTime": 1380887154330, "endTime": 1380887154448, "exitStatus": "exit", "createTime": 1380887154287, "lastUpdatedTime": 1380887154448, "jobParameters": {
+ "entries": [
+ {
+ "key": "test",
+ "value": "jbatch"
+ }
+ ]
+}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-executions/45896/job.json
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-executions/45896/job.json b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-executions/45896/job.json
new file mode 100644
index 0000000..48a3651
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-executions/45896/job.json
@@ -0,0 +1,15 @@
+[
+ {
+ "id": 0,
+ "name": "j0",
+ "batchStatus": "FAILED",
+ "startTime": 1380887154398,
+ "endTime": 1380887154435,
+ "exitStatus": "out"
+ },
+ {
+ "name": "j1",
+ "batchStatus": "COMPLETED",
+ "exitStatus": "es"
+ }
+]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instance/2.json
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instance/2.json b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instance/2.json
new file mode 100644
index 0000000..a433bfe
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instance/2.json
@@ -0,0 +1 @@
+{"name":"ji","id":12}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instance/count/ajob.json
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instance/count/ajob.json b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instance/count/ajob.json
new file mode 100644
index 0000000..7813681
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instance/count/ajob.json
@@ -0,0 +1 @@
+5
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instances/anotherjob.json
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instances/anotherjob.json b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instances/anotherjob.json
new file mode 100644
index 0000000..98ebfee
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-instances/anotherjob.json
@@ -0,0 +1 @@
+[{"name":"owb","id":0}, {"name":"tomee","id":1}]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-names.json
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-names.json b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-names.json
new file mode 100644
index 0000000..af5046c
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/job-names.json
@@ -0,0 +1 @@
+["s1", "s2"]
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-client/src/test/resources/batchee/step-executions/8946.json
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-client/src/test/resources/batchee/step-executions/8946.json b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/step-executions/8946.json
new file mode 100644
index 0000000..48a3651
--- /dev/null
+++ b/gui/jaxrs/jaxrs-client/src/test/resources/batchee/step-executions/8946.json
@@ -0,0 +1,15 @@
+[
+ {
+ "id": 0,
+ "name": "j0",
+ "batchStatus": "FAILED",
+ "startTime": 1380887154398,
+ "endTime": 1380887154435,
+ "exitStatus": "out"
+ },
+ {
+ "name": "j1",
+ "batchStatus": "COMPLETED",
+ "exitStatus": "es"
+ }
+]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-common/pom.xml
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-common/pom.xml b/gui/jaxrs/jaxrs-common/pom.xml
new file mode 100644
index 0000000..fbb9f26
--- /dev/null
+++ b/gui/jaxrs/jaxrs-common/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>batchee-jaxrs</artifactId>
+ <groupId>org.apache.batchee</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>batchee-jaxrs-common</artifactId>
+ <name>BatchEE :: GUI :: JAXRS :: Common</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.batch</groupId>
+ <artifactId>javax.batch-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxrs_1.1_spec</artifactId>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/JBatchResource.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/JBatchResource.java b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/JBatchResource.java
new file mode 100644
index 0000000..a9f8e31
--- /dev/null
+++ b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/JBatchResource.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.common;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+@Consumes({MediaType.APPLICATION_JSON})
+@Produces({MediaType.APPLICATION_JSON})
+@Path("batchee")
+public interface JBatchResource {
+ @GET
+ @Path("job-names")
+ String[] getJobNames();
+
+ @GET
+ @Path("job-instance/count/{name}")
+ int getJobInstanceCount(final @PathParam("name") String jobName);
+
+ @GET
+ @Path("job-instances/{name}")
+ RestJobInstance[] getJobInstances(final @PathParam("name") String jobName, final @QueryParam("start") int start, final @QueryParam("count") int count);
+
+ @GET
+ @Path("executions/running/{name}")
+ Long[] getRunningExecutions(final @PathParam("name") String jobName);
+
+ @GET
+ @Path("execution/parameter/{id}")
+ RestProperties getParameters(final @PathParam("id") long executionId);
+
+ @GET
+ @Path("job-instance/{id}")
+ RestJobInstance getJobInstance(final @PathParam("id") long executionId);
+
+ @GET
+ @Path("job-executions/{id}/{name}")
+ RestJobExecution[] getJobExecutions(final @PathParam("id") long id, final @PathParam("name") String name);
+
+ @GET
+ @Path("job-execution/{id}")
+ RestJobExecution getJobExecution(final @PathParam("id") long executionId);
+
+ @GET
+ @Path("step-executions/{id}")
+ RestStepExecution[] getStepExecutions(final @PathParam("id") long jobExecutionId);
+
+ @POST
+ @Path("execution/start/{name}")
+ long start(final @PathParam("name") String jobXMLName, final RestProperties jobParameters);
+
+ @POST
+ @Path("execution/restart/{id}")
+ long restart(final @PathParam("id") long executionId, final RestProperties restartParameters);
+
+ @HEAD
+ @Path("execution/stop/{id}")
+ void stop(final @PathParam("id") long executionId);
+
+ @HEAD
+ @Path("execution/abandon/{id}")
+ void abandon(final @PathParam("id") long executionId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestEntry.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestEntry.java b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestEntry.java
new file mode 100644
index 0000000..06899c1
--- /dev/null
+++ b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestEntry.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.common;
+
+public class RestEntry {
+ private String key;
+ private String value;
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(final String key) {
+ this.key = key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(final String value) {
+ this.value = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestJobExecution.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestJobExecution.java b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestJobExecution.java
new file mode 100644
index 0000000..e9512bb
--- /dev/null
+++ b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestJobExecution.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.common;
+
+import javax.batch.runtime.BatchStatus;
+import javax.batch.runtime.JobExecution;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class RestJobExecution {
+ private long id;
+ private String name;
+ private BatchStatus batchStatus;
+ private Date startTime;
+ private Date endTime;
+ private String exitStatus;
+ private Date createTime;
+ private Date lastUpdatedTime;
+ private RestProperties jobParameters;
+
+ public RestJobExecution() {
+ // no-op
+ }
+
+ public void setId(final long id) {
+ this.id = id;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public void setBatchStatus(final BatchStatus batchStatus) {
+ this.batchStatus = batchStatus;
+ }
+
+ public void setStartTime(final Date startTime) {
+ this.startTime = startTime;
+ }
+
+ public void setEndTime(final Date endTime) {
+ this.endTime = endTime;
+ }
+
+ public void setExitStatus(final String exitStatus) {
+ this.exitStatus = exitStatus;
+ }
+
+ public void setCreateTime(final Date createTime) {
+ this.createTime = createTime;
+ }
+
+ public void setLastUpdatedTime(final Date lastUpdatedTime) {
+ this.lastUpdatedTime = lastUpdatedTime;
+ }
+
+ public void setJobParameters(final RestProperties jobParameters) {
+ this.jobParameters = jobParameters;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public BatchStatus getBatchStatus() {
+ return batchStatus;
+ }
+
+ public Date getStartTime() {
+ return startTime;
+ }
+
+ public Date getEndTime() {
+ return endTime;
+ }
+
+ public String getExitStatus() {
+ return exitStatus;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public Date getLastUpdatedTime() {
+ return lastUpdatedTime;
+ }
+
+ public RestProperties getJobParameters() {
+ return jobParameters;
+ }
+
+ public static List<RestJobExecution> wrap(final List<JobExecution> jobExecutions) {
+ final List<RestJobExecution> executions = new ArrayList<RestJobExecution>(jobExecutions.size());
+ for (final JobExecution exec : jobExecutions) {
+ executions.add(wrap(exec));
+ }
+ return executions;
+ }
+
+ public static RestJobExecution wrap(final JobExecution jobExecution) {
+ final RestJobExecution execution = new RestJobExecution();
+ execution.setId(jobExecution.getExecutionId());
+ execution.setName(jobExecution.getJobName());
+ execution.setBatchStatus(jobExecution.getBatchStatus());
+ execution.setStartTime(jobExecution.getStartTime());
+ execution.setEndTime(jobExecution.getEndTime());
+ execution.setExitStatus(jobExecution.getExitStatus());
+ execution.setCreateTime(jobExecution.getCreateTime());
+ execution.setLastUpdatedTime(jobExecution.getLastUpdatedTime());
+ execution.setJobParameters(RestProperties.wrap(jobExecution.getJobParameters()));
+ return execution;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestJobInstance.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestJobInstance.java b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestJobInstance.java
new file mode 100644
index 0000000..43f228f
--- /dev/null
+++ b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestJobInstance.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.common;
+
+import javax.batch.runtime.JobInstance;
+import java.util.ArrayList;
+import java.util.List;
+
+public class RestJobInstance {
+ private String name;
+ private long id;
+
+ public RestJobInstance() {
+ // no-op
+ }
+
+ public RestJobInstance(final String name, final long id) {
+ this.name = name;
+ this.id = id;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public static List<RestJobInstance> wrap(final List<JobInstance> jobInstances) {
+ final List<RestJobInstance> instances = new ArrayList<RestJobInstance>(jobInstances.size());
+ for (final JobInstance instance : jobInstances) {
+ instances.add(wrap(instance));
+ }
+ return instances;
+ }
+
+ public static RestJobInstance wrap(final JobInstance instance) {
+ return new RestJobInstance(instance.getJobName(), instance.getInstanceId());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestMetric.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestMetric.java b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestMetric.java
new file mode 100644
index 0000000..fdc1e23
--- /dev/null
+++ b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestMetric.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.common;
+
+import javax.batch.runtime.Metric;
+
+public class RestMetric {
+ private Metric.MetricType type;
+ private long value;
+
+ public RestMetric() {
+ // no-op
+ }
+
+ public RestMetric(final Metric.MetricType type, final long value) {
+ this.type = type;
+ this.value = value;
+ }
+
+ public void setType(final Metric.MetricType type) {
+ this.type = type;
+ }
+
+ public void setValue(final long value) {
+ this.value = value;
+ }
+
+ public Metric.MetricType getType() {
+ return type;
+ }
+
+ public long getValue() {
+ return value;
+ }
+
+ public static RestMetric wrap(final Metric m) {
+ return new RestMetric(m.getType(), m.getValue());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestProperties.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestProperties.java b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestProperties.java
new file mode 100644
index 0000000..1eea047
--- /dev/null
+++ b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestProperties.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.common;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+public class RestProperties {
+ private List<RestEntry> entries = new LinkedList<RestEntry>();
+
+ public List<RestEntry> getEntries() {
+ return entries;
+ }
+
+ public static RestProperties wrap(final Properties parameters) {
+ final RestProperties p = new RestProperties();
+ for (final Map.Entry<Object, Object> e : parameters.entrySet()) {
+ final RestEntry restEntry = new RestEntry();
+ restEntry.setKey(e.getKey().toString());
+ if (e.getValue() != null) {
+ restEntry.setValue(e.getValue().toString());
+ }
+ p.getEntries().add(restEntry);
+ }
+ return p;
+ }
+
+ public static Properties unwrap(final RestProperties jobParameters) {
+ final Properties p = new Properties();
+ for (final RestEntry e : jobParameters.getEntries()) {
+ p.setProperty(e.getKey(), e.getValue());
+ }
+ return p;
+ }
+
+ public static Properties toProperties(final RestProperties props) {
+ final Properties p = new Properties();
+ if (props != null && props.getEntries() != null) {
+ for (final RestEntry entry : props.getEntries()) {
+ p.put(entry.getKey(), entry.getValue());
+ }
+ }
+ return p;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestStepExecution.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestStepExecution.java b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestStepExecution.java
new file mode 100644
index 0000000..5596781
--- /dev/null
+++ b/gui/jaxrs/jaxrs-common/src/main/java/org/apache/batchee/jaxrs/common/RestStepExecution.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.common;
+
+import javax.batch.runtime.BatchStatus;
+import javax.batch.runtime.Metric;
+import javax.batch.runtime.StepExecution;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+public class RestStepExecution {
+ private long id;
+ private String name;
+ private BatchStatus batchStatus;
+ private Date startTime;
+ private Date endTime;
+ private String exitStatus;
+ private List<RestMetric> metrics = new LinkedList<RestMetric>();
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setBatchStatus(BatchStatus batchStatus) {
+ this.batchStatus = batchStatus;
+ }
+
+ public void setStartTime(Date startTime) {
+ this.startTime = startTime;
+ }
+
+ public void setEndTime(Date endTime) {
+ this.endTime = endTime;
+ }
+
+ public void setExitStatus(String exitStatus) {
+ this.exitStatus = exitStatus;
+ }
+
+ public void setMetrics(List<RestMetric> metrics) {
+ this.metrics = metrics;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public BatchStatus getBatchStatus() {
+ return batchStatus;
+ }
+
+ public Date getStartTime() {
+ return startTime;
+ }
+
+ public Date getEndTime() {
+ return endTime;
+ }
+
+ public String getExitStatus() {
+ return exitStatus;
+ }
+
+ public List<RestMetric> getMetrics() {
+ return metrics;
+ }
+
+ public static List<RestStepExecution> wrap(final List<StepExecution> stepExecutions) {
+ final List<RestStepExecution> executions = new ArrayList<RestStepExecution>(stepExecutions.size());
+ for (final StepExecution exec : stepExecutions) {
+ executions.add(wrap(exec));
+ }
+ return executions;
+ }
+
+ private static RestStepExecution wrap(final StepExecution exec) {
+ final RestStepExecution execution = new RestStepExecution();
+ execution.setId(exec.getStepExecutionId());
+ execution.setName(exec.getStepName());
+ execution.setBatchStatus(exec.getBatchStatus());
+ execution.setExitStatus(exec.getExitStatus());
+ execution.setStartTime(exec.getStartTime());
+ execution.setEndTime(exec.getEndTime());
+ if (exec.getMetrics() != null) {
+ for (final Metric m : exec.getMetrics()) {
+ execution.getMetrics().add(RestMetric.wrap(m));
+ }
+ }
+ return execution;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-server/pom.xml
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-server/pom.xml b/gui/jaxrs/jaxrs-server/pom.xml
new file mode 100644
index 0000000..4449f81
--- /dev/null
+++ b/gui/jaxrs/jaxrs-server/pom.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>batchee-jaxrs</artifactId>
+ <groupId>org.apache.batchee</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>batchee-jaxrs-server</artifactId>
+ <name>BatchEE :: GUI :: JAXRS :: Server</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.batch</groupId>
+ <artifactId>javax.batch-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxrs_1.1_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.batchee</groupId>
+ <artifactId>batchee-jaxrs-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.batchee</groupId>
+ <artifactId>batchee-jbatch</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.descriptors</groupId>
+ <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-tomcat-embedded-7</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt.core.compiler</groupId>
+ <artifactId>ecj</artifactId>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-server/src/main/java/org/apache/batchee/jaxrs/server/JBatchExceptionMapper.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-server/src/main/java/org/apache/batchee/jaxrs/server/JBatchExceptionMapper.java b/gui/jaxrs/jaxrs-server/src/main/java/org/apache/batchee/jaxrs/server/JBatchExceptionMapper.java
new file mode 100644
index 0000000..37099ff
--- /dev/null
+++ b/gui/jaxrs/jaxrs-server/src/main/java/org/apache/batchee/jaxrs/server/JBatchExceptionMapper.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.server;
+
+import javax.batch.operations.BatchRuntimeException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+
+public class JBatchExceptionMapper implements ExceptionMapper<BatchRuntimeException> {
+ @Override
+ public Response toResponse(final BatchRuntimeException e) {
+ return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-server/src/main/java/org/apache/batchee/jaxrs/server/JBatchResourceImpl.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-server/src/main/java/org/apache/batchee/jaxrs/server/JBatchResourceImpl.java b/gui/jaxrs/jaxrs-server/src/main/java/org/apache/batchee/jaxrs/server/JBatchResourceImpl.java
new file mode 100644
index 0000000..5ca54b2
--- /dev/null
+++ b/gui/jaxrs/jaxrs-server/src/main/java/org/apache/batchee/jaxrs/server/JBatchResourceImpl.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.server;
+
+import org.apache.batchee.jaxrs.common.JBatchResource;
+import org.apache.batchee.jaxrs.common.RestJobExecution;
+import org.apache.batchee.jaxrs.common.RestJobInstance;
+import org.apache.batchee.jaxrs.common.RestProperties;
+import org.apache.batchee.jaxrs.common.RestStepExecution;
+
+import javax.annotation.PostConstruct;
+import javax.batch.operations.JobOperator;
+import javax.batch.runtime.BatchRuntime;
+import javax.batch.runtime.JobInstance;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+import java.util.Set;
+
+@Consumes({ MediaType.APPLICATION_JSON })
+@Produces({ MediaType.APPLICATION_JSON })
+@Path("batchee")
+public class JBatchResourceImpl implements JBatchResource {
+ private JobOperator operator;
+
+ @PostConstruct
+ public void findOperator() { // avoid to ServiceLoader.load everytimes
+ operator = BatchRuntime.getJobOperator();
+ }
+
+ @GET
+ @Path("job-names")
+ public String[] getJobNames() {
+ final Set<String> jobNames = operator.getJobNames();
+ return jobNames.toArray(new String[jobNames.size()]);
+ }
+
+ @GET
+ @Path("job-instance/count/{name}")
+ public int getJobInstanceCount(final @PathParam("name") String jobName) {
+ return operator.getJobInstanceCount(jobName);
+ }
+
+ @GET
+ @Path("job-instances/{name}")
+ public RestJobInstance[] getJobInstances(final @PathParam("name") String jobName, final @QueryParam("start") int start, final @QueryParam("count") int count) {
+ final List<RestJobInstance> restJobInstances = RestJobInstance.wrap(operator.getJobInstances(jobName, start, count));
+ return restJobInstances.toArray(new RestJobInstance[restJobInstances.size()]);
+ }
+
+ @GET
+ @Path("executions/running/{name}")
+ public Long[] getRunningExecutions(final @PathParam("name") String jobName) {
+ final List<Long> runningExecutions = operator.getRunningExecutions(jobName);
+ return runningExecutions.toArray(runningExecutions.toArray(new Long[runningExecutions.size()]));
+ }
+
+ @GET
+ @Path("execution/parameter/{id}")
+ public RestProperties getParameters(final @PathParam("id") long executionId) {
+ return RestProperties.wrap(operator.getParameters(executionId));
+ }
+
+ @GET
+ @Path("job-instance/{id}")
+ public RestJobInstance getJobInstance(final @PathParam("id") long executionId) {
+ return RestJobInstance.wrap(operator.getJobInstance(executionId));
+ }
+
+ @GET
+ @Path("job-executions/{id}/{name}")
+ public RestJobExecution[] getJobExecutions(final @PathParam("id") long id, final @PathParam("name") String name) {
+ final List<RestJobExecution> restJobExecutions = RestJobExecution.wrap(operator.getJobExecutions(new JobInstanceImpl(name, id)));
+ return restJobExecutions.toArray(new RestJobExecution[restJobExecutions.size()]);
+ }
+
+ @GET
+ @Path("job-execution/{id}")
+ public RestJobExecution getJobExecution(final @PathParam("id") long executionId) {
+ return RestJobExecution.wrap(operator.getJobExecution(executionId));
+ }
+
+ @GET
+ @Path("step-executions/{id}")
+ public RestStepExecution[] getStepExecutions(final @PathParam("id") long jobExecutionId) {
+ final List<RestStepExecution> restStepExecutions = RestStepExecution.wrap(operator.getStepExecutions(jobExecutionId));
+ return restStepExecutions.toArray(new RestStepExecution[restStepExecutions.size()]);
+ }
+
+ @POST
+ @Path("execution/start/{name}")
+ public long start(final @PathParam("name") String jobXMLName, final RestProperties jobParameters) {
+ return operator.start(jobXMLName, RestProperties.unwrap(jobParameters));
+ }
+
+ @POST
+ @Path("execution/restart/{id}")
+ public long restart(final @PathParam("id") long executionId, final RestProperties restartParameters) {
+ return operator.restart(executionId, RestProperties.unwrap(restartParameters));
+ }
+
+ @HEAD
+ @Path("execution/stop/{id}")
+ public void stop(final @PathParam("id") long executionId) {
+ operator.stop(executionId);
+ }
+
+ @HEAD
+ @Path("execution/abandon/{id}")
+ public void abandon(final @PathParam("id") long executionId) {
+ operator.abandon(executionId);
+ }
+
+ /* // needs to import jbatch impl and get the org.apache.batchee.spi.PersistenceManagerService + same note as start/restart methods ^^
+ @HEAD
+ @Path("clean-up/{id}")
+ public void cleanUp(final @PathParam("id") long instanceId) {
+ throw new UnsupportedOperationException();
+ }
+ */
+
+ private static class JobInstanceImpl implements JobInstance {
+ private final String name;
+ private final long id;
+
+ public JobInstanceImpl(final String name, final long id) {
+ this.name = name;
+ this.id = id;
+ }
+
+ @Override
+ public long getInstanceId() {
+ return id;
+ }
+
+ @Override
+ public String getJobName() {
+ return name;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/RestTest.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/RestTest.java b/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/RestTest.java
new file mode 100644
index 0000000..321404a
--- /dev/null
+++ b/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/RestTest.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.server;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+import org.apache.batchee.jaxrs.common.JBatchResource;
+import org.apache.batchee.jaxrs.common.RestEntry;
+import org.apache.batchee.jaxrs.common.RestJobExecution;
+import org.apache.batchee.jaxrs.common.RestJobInstance;
+import org.apache.batchee.jaxrs.common.RestProperties;
+import org.apache.batchee.jaxrs.common.RestStepExecution;
+import org.apache.batchee.jaxrs.server.util.CreateSomeJobs;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.batch.runtime.BatchStatus;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.net.URL;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+@RunWith(Arquillian.class)
+public class RestTest {
+ @ArquillianResource
+ private URL base;
+
+ @Test
+ public void getJobNames() {
+ final String[] jobNames = newClient().path("job-names").get(String[].class);
+ assertNotNull(jobNames);
+ assertEquals(1, jobNames.length);
+ assertEquals("init", jobNames[0]);
+ }
+
+ @Test
+ public void getJobInstanceCount() {
+ final int count = newClient().path("job-instance/count/{id}", "init").get(Integer.class);
+ assertEquals(1, count);
+ }
+
+ @Test
+ public void getJobInstances() {
+ final RestJobInstance[] instances = newClient().path("job-instances/{name}", "init").query("start", 0).query("count", 10).get(RestJobInstance[].class);
+ assertNotNull(instances);
+ assertEquals(1, instances.length);
+ assertEquals(0, instances[0].getId());
+ assertEquals("init", instances[0].getName());
+ }
+
+ @Test
+ public void getRunningExecutions() {
+ final int status = newClient().path("executions/running/{name}", "init").get().getStatus();
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), status); // no more running so exception
+ }
+
+ @Test
+ public void getJobInstance() {
+ final RestJobInstance instance = newClient().path("job-instance/{id}", 0).get(RestJobInstance.class);
+ assertNotNull(instance);
+ assertEquals(0, instance.getId());
+ assertEquals("init", instance.getName());
+ }
+
+ @Test
+ public void getParameters() {
+ final RestProperties params = newClient().path("execution/parameter/{id}", 0).get(RestProperties.class);
+ assertNotNull(params);
+ assertEquals(1, params.getEntries().size());
+
+ final RestEntry entry = params.getEntries().iterator().next();
+ assertEquals("test", entry.getKey());
+ assertEquals("jbatch", entry.getValue());
+ }
+
+ @Test
+ public void getJobExecutions() {
+ final RestJobExecution[] executions = newClient().path("job-executions/{id}/{name}", 0, "init").get(RestJobExecution[].class);
+ assertNotNull(executions);
+ assertEquals(1, executions.length);
+ assertEquals(0, executions[0].getId());
+ assertEquals("init", executions[0].getName());
+ assertEquals("COMPLETED", executions[0].getExitStatus());
+ assertEquals(BatchStatus.COMPLETED, executions[0].getBatchStatus());
+ }
+
+ @Test
+ public void getJobExecution() {
+ final RestJobExecution executions = newClient().path("job-execution/{id}", 0).get(RestJobExecution.class);
+ assertNotNull(executions);
+ assertEquals(0, executions.getId());
+ assertEquals("init", executions.getName());
+ assertEquals("COMPLETED", executions.getExitStatus());
+ assertEquals(BatchStatus.COMPLETED, executions.getBatchStatus());
+ }
+
+ @Test
+ public void getStepExecutions() {
+ final RestStepExecution[] executions = newClient().path("step-executions/{id}", 0).get(RestStepExecution[].class);
+ assertNotNull(executions);
+ assertEquals(1, executions.length);
+ assertEquals(0, executions[0].getId());
+ assertEquals("step1", executions[0].getName());
+ assertEquals("OK", executions[0].getExitStatus());
+ assertEquals(BatchStatus.COMPLETED, executions[0].getBatchStatus());
+ }
+
+ @Deployment(testable = false)
+ @OverProtocol("Servlet 2.5") // to use a custom web.xml
+ public static Archive<?> war() {
+ return ShrinkWrap.create(WebArchive.class, "batchee-gui.war")
+ // GUI
+ .addPackages(true, JBatchResourceImpl.class.getPackage())
+ .addPackages(true, JBatchResource.class.getPackage())
+ .addAsWebInfResource(new StringAsset(
+ Descriptors.create(WebAppDescriptor.class)
+ .metadataComplete(false)
+ .createServlet()
+ .servletName("CXF")
+ .servletClass("org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet")
+ .createInitParam()
+ .paramName("jaxrs.serviceClasses")
+ .paramValue(JBatchResourceImpl.class.getName())
+ .up()
+ .createInitParam()
+ .paramName("jaxrs.providers")
+ .paramValue("com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider," + JBatchExceptionMapper.class.getName())
+ .up()
+ .createInitParam()
+ .paramName("jaxrs.outInterceptors")
+ .paramValue(LoggingOutInterceptor.class.getName())
+ .up()
+ .up()
+ .createServletMapping()
+ .servletName("CXF")
+ .urlPattern("/api/*")
+ .up()
+ .exportAsString()
+ ), "web.xml")
+ // test data to create some job things to do this test
+ .addPackage(CreateSomeJobs.class.getPackage())
+ .addAsWebInfResource("META-INF/batch-jobs/init.xml", "classes/META-INF/batch-jobs/init.xml");
+ }
+
+ private WebClient newClient() {
+ return WebClient.create(base.toExternalForm() + "api/batchee", Arrays.asList(new JacksonJsonProvider())).accept(MediaType.APPLICATION_JSON_TYPE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/util/CreateSomeJobs.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/util/CreateSomeJobs.java b/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/util/CreateSomeJobs.java
new file mode 100644
index 0000000..c3ab16c
--- /dev/null
+++ b/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/util/CreateSomeJobs.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.server.util;
+
+import org.apache.batchee.util.Batches;
+
+import javax.batch.operations.JobOperator;
+import javax.batch.operations.NoSuchJobException;
+import javax.batch.runtime.BatchRuntime;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+import java.util.Properties;
+
+@WebListener
+public class CreateSomeJobs implements ServletContextListener {
+ @Override
+ public void contextInitialized(final ServletContextEvent sce) {
+ final JobOperator operator = BatchRuntime.getJobOperator();
+
+ try { // initialize only once to ensure we can use in tests ids
+ operator.getJobInstances("init", 0, 10);
+ } catch (final NoSuchJobException nsje) {
+ final Properties jobParameters = new Properties();
+ jobParameters.setProperty("test", "jbatch");
+ final long id = operator.start("init", jobParameters);
+ Batches.waitForEnd(operator, id);
+ }
+ }
+
+ @Override
+ public void contextDestroyed(final ServletContextEvent sce) {
+ // no-op
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/util/SimpleBatchlet.java
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/util/SimpleBatchlet.java b/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/util/SimpleBatchlet.java
new file mode 100644
index 0000000..29a0df8
--- /dev/null
+++ b/gui/jaxrs/jaxrs-server/src/test/java/org/apache/batchee/jaxrs/server/util/SimpleBatchlet.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.batchee.jaxrs.server.util;
+
+import javax.batch.api.Batchlet;
+import javax.batch.api.BatchProperty;
+import javax.inject.Inject;
+
+public class SimpleBatchlet implements Batchlet {
+ @Inject
+ @BatchProperty
+ private String value;
+
+ @Inject
+ @BatchProperty
+ private String sleep;
+
+ private volatile boolean stopped = false;
+
+ @Override
+ public String process() throws Exception {
+ if (value == null) {
+ value = "OK";
+ }
+ if (sleep != null) {
+ long done = 0;
+ final long max = Long.parseLong(sleep);
+ while (done < max && !stopped) {
+ Thread.sleep(1000);
+ done += 1000;
+ }
+ }
+ return value;
+ }
+
+ @Override
+ public void stop() throws Exception {
+ stopped = true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-server/src/test/resources/META-INF/batch-jobs/another-job.xml
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-server/src/test/resources/META-INF/batch-jobs/another-job.xml b/gui/jaxrs/jaxrs-server/src/test/resources/META-INF/batch-jobs/another-job.xml
new file mode 100644
index 0000000..d6358ef
--- /dev/null
+++ b/gui/jaxrs/jaxrs-server/src/test/resources/META-INF/batch-jobs/another-job.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ See the NOTICE file distributed with this work for additional information
+ regarding copyright ownership. Licensed under the Apache License,
+ Version 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<job id="another-job" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+ <step id="single-step">
+ <batchlet ref="org.apache.batchee.jaxrs.server.util.SimpleBatchlet">
+ <properties>
+ <property name="value" value="#{jobParameters['value']}"/>
+ <property name="sleep" value="#{jobParameters['sleep']}"/>
+ </properties>
+ </batchlet>
+ </step>
+</job>
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-server/src/test/resources/META-INF/batch-jobs/init.xml
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-server/src/test/resources/META-INF/batch-jobs/init.xml b/gui/jaxrs/jaxrs-server/src/test/resources/META-INF/batch-jobs/init.xml
new file mode 100644
index 0000000..c32748a
--- /dev/null
+++ b/gui/jaxrs/jaxrs-server/src/test/resources/META-INF/batch-jobs/init.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ See the NOTICE file distributed with this work for additional information
+ regarding copyright ownership. Licensed under the Apache License,
+ Version 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<job id="init" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
+ <step id="step1">
+ <batchlet ref="org.apache.batchee.jaxrs.server.util.SimpleBatchlet">
+ <properties>
+ <property name="value" value="#{jobParameters['value']}"/>
+ <property name="sleep" value="#{jobParameters['sleep']}"/>
+ </properties>
+ </batchlet>
+ </step>
+</job>
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/jaxrs-server/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/gui/jaxrs/jaxrs-server/src/test/resources/arquillian.xml b/gui/jaxrs/jaxrs-server/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..96514c8
--- /dev/null
+++ b/gui/jaxrs/jaxrs-server/src/test/resources/arquillian.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<arquillian xmlns="http://jboss.org/schema/arquillian"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian
+ http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+ <container qualifier="tomcat7" default="true">
+ <configuration>
+ <property name="tomcatHome">target/tomcat7</property>
+ <property name="workDir">target/arquillian-work</property>
+ <property name="unpackArchive">true</property>
+ <property name="bindHttpPort">1234</property>
+ </configuration>
+ </container>
+</arquillian>
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/jaxrs/pom.xml
----------------------------------------------------------------------
diff --git a/gui/jaxrs/pom.xml b/gui/jaxrs/pom.xml
new file mode 100644
index 0000000..2d6c940
--- /dev/null
+++ b/gui/jaxrs/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>batchee-gui</artifactId>
+ <groupId>org.apache.batchee</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>batchee-jaxrs</artifactId>
+ <name>BatchEE :: GUI :: JAXRS</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>jaxrs-server</module>
+ <module>jaxrs-common</module>
+ <module>jaxrs-client</module>
+ </modules>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/pom.xml
----------------------------------------------------------------------
diff --git a/gui/pom.xml b/gui/pom.xml
new file mode 100644
index 0000000..63a4185
--- /dev/null
+++ b/gui/pom.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>batchee-parent</artifactId>
+ <groupId>org.apache.batchee</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>batchee-gui</artifactId>
+ <name>BatchEE :: GUI</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>jaxrs</module>
+ <module>servlet</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxrs_1.1_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>${atinject.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-javamail_1.4_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ws.xmlschema</groupId>
+ <artifactId>xmlschema-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>woodstox-core-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.descriptors</groupId>
+ <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
+ <version>2.0.0-alpha-5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+ <version>2.0.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <version>${arquillian.version}</version>
+ <!-- sadly tomcat7 embedded is not compatible with later impl in v1.0.0.CR5 -->
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-tomcat-embedded-7</artifactId>
+ <version>1.0.0.CR5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ <version>${tomcat.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt.core.compiler</groupId>
+ <artifactId>ecj</artifactId>
+ <version>4.2.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>2.12</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <properties>
+ <arquillian.version>1.0.3.Final</arquillian.version>
+ <cxf.version>2.6.9</cxf.version>
+ <tomcat.version>7.0.42</tomcat.version>
+ </properties>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/efa64877/gui/servlet/pom.xml
----------------------------------------------------------------------
diff --git a/gui/servlet/pom.xml b/gui/servlet/pom.xml
new file mode 100644
index 0000000..22fa367
--- /dev/null
+++ b/gui/servlet/pom.xml
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>batchee-gui</artifactId>
+ <groupId>org.apache.batchee</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>batchee-servlet</artifactId>
+ <name>BatchEE :: GUI :: Servlet</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.batch</groupId>
+ <artifactId>javax.batch-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxrs_1.1_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.batchee</groupId>
+ <artifactId>batchee-jbatch</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.descriptors</groupId>
+ <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-tomcat-embedded-7</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt.core.compiler</groupId>
+ <artifactId>ecj</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin> <!-- use mvn clean package tomcat7:run -DskipTests -->
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <ignorePackaging>true</ignorePackaging>
+ <path>/</path>
+ <warSourceDirectory>${project.basedir}/src/main/resources/META-INF/resources</warSourceDirectory>
+ <additionalClasspathDirs>
+ <additionalClasspathDir>${project.build.directory}/${project.build.finalName}.${project.packaging}
+ </additionalClasspathDir>
+ <additionalClasspathDir>${project.build.directory}/${project.build.finalName}-tests.${project.packaging}
+ </additionalClasspathDir>
+ </additionalClasspathDirs>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>${atinject.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <version>${atinject.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.batch</groupId>
+ <artifactId>javax.batch-api</artifactId>
+ <version>${batch-api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-javamail_1.4_spec</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ws.xmlschema</groupId>
+ <artifactId>xmlschema-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>woodstox-core-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.batchee</groupId>
+ <artifactId>batchee-jbatch</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+</project>