You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by gp...@apache.org on 2013/12/25 10:33:41 UTC

git commit: DELTASPIKE-476 mocked scheduler tests

Updated Branches:
  refs/heads/master a60f751e1 -> 26504284a


DELTASPIKE-476 mocked scheduler tests


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/26504284
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/26504284
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/26504284

Branch: refs/heads/master
Commit: 26504284afe6a35c99ab77bc33d7f360bda98c01
Parents: a60f751
Author: gpetracek <gp...@apache.org>
Authored: Wed Dec 25 10:22:52 2013 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Wed Dec 25 10:22:52 2013 +0100

----------------------------------------------------------------------
 deltaspike/modules/scheduler/impl/pom.xml       |   6 +
 .../scheduler/impl/SchedulerExtension.java      |   3 +-
 .../scheduler/custom/AutoRegisteredJob.java     |  26 +++++
 .../scheduler/custom/CustomConfigSource.java    |  65 +++++++++++
 .../test/scheduler/custom/CustomJob.java        |  23 ++++
 .../scheduler/custom/CustomSchedulerTest.java   | 117 +++++++++++++++++++
 .../test/scheduler/custom/ManualJob.java        |  26 +++++
 .../test/scheduler/custom/MockedScheduler.java  |  66 +++++++++++
 .../scheduler/custom/QuartzDeactivator.java     |  33 ++++++
 .../test/scheduler/custom/TestJobManager.java   | 104 +++++++++++++++++
 .../deltaspike/test/util/ArchiveUtils.java      |  41 +++++++
 .../impl/src/test/resources/META-INF/beans.xml  |  24 ++++
 ...ache.deltaspike.core.spi.config.ConfigSource |  20 ++++
 ...rg.apache.deltaspike.scheduler.spi.Scheduler |  20 ++++
 .../impl/src/test/resources/arquillian.xml      |  83 +++++++++++++
 15 files changed, 656 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/pom.xml b/deltaspike/modules/scheduler/impl/pom.xml
index 83bb92e..8433b19 100644
--- a/deltaspike/modules/scheduler/impl/pom.xml
+++ b/deltaspike/modules/scheduler/impl/pom.xml
@@ -78,6 +78,12 @@
             <artifactId>commons-logging</artifactId>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.deltaspike.core</groupId>
+            <artifactId>deltaspike-core-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/SchedulerExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/SchedulerExtension.java b/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/SchedulerExtension.java
index bb1bcc9..2986810 100644
--- a/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/SchedulerExtension.java
+++ b/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/SchedulerExtension.java
@@ -41,6 +41,7 @@ import java.util.logging.Logger;
 
 public class SchedulerExtension implements Extension, Deactivatable
 {
+    public static final String JOB_CLASS_CONFIG_KEY = "deltaspike.scheduler.job-class";
     private static final Logger LOG = Logger.getLogger(SchedulerExtension.class.getName());
 
     private Boolean isActivated = true;
@@ -57,7 +58,7 @@ public class SchedulerExtension implements Extension, Deactivatable
 
         if (this.isActivated)
         {
-            String jobClassName = ConfigResolver.getPropertyValue("deltaspike.scheduler.job-class", "org.quartz.Job");
+            String jobClassName = ConfigResolver.getPropertyValue(JOB_CLASS_CONFIG_KEY, "org.quartz.Job");
 
             this.jobClass = ClassUtils.tryToLoadClassForName(jobClassName);
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/AutoRegisteredJob.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/AutoRegisteredJob.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/AutoRegisteredJob.java
new file mode 100644
index 0000000..5a4fbd8
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/AutoRegisteredJob.java
@@ -0,0 +1,26 @@
+/*
+ * 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.deltaspike.test.scheduler.custom;
+
+import org.apache.deltaspike.scheduler.api.Scheduled;
+
+@Scheduled(cronExpression = "*/1 * * * * ?")
+public class AutoRegisteredJob implements CustomJob
+{
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomConfigSource.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomConfigSource.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomConfigSource.java
new file mode 100644
index 0000000..7664959
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomConfigSource.java
@@ -0,0 +1,65 @@
+/*
+ * 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.deltaspike.test.scheduler.custom;
+
+import org.apache.deltaspike.core.spi.activation.ClassDeactivator;
+import org.apache.deltaspike.core.spi.config.ConfigSource;
+import org.apache.deltaspike.scheduler.impl.SchedulerExtension;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class CustomConfigSource implements ConfigSource
+{
+    private Map<String, String> config = new HashMap<String, String>()
+    {{
+        put(SchedulerExtension.JOB_CLASS_CONFIG_KEY, CustomJob.class.getName());
+        put(ClassDeactivator.class.getName(), QuartzDeactivator.class.getName());
+    }};
+
+    @Override
+    public int getOrdinal()
+    {
+        return 1001;
+    }
+
+    @Override
+    public Map<String, String> getProperties()
+    {
+        return this.config;
+    }
+
+    @Override
+    public String getPropertyValue(String key)
+    {
+        return this.config.get(key);
+    }
+
+    @Override
+    public String getConfigName()
+    {
+        return "scheduler-test-config";
+    }
+
+    @Override
+    public boolean isScannable()
+    {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomJob.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomJob.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomJob.java
new file mode 100644
index 0000000..0b8746f
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomJob.java
@@ -0,0 +1,23 @@
+/*
+ * 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.deltaspike.test.scheduler.custom;
+
+public interface CustomJob
+{
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerTest.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerTest.java
new file mode 100644
index 0000000..541388d
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerTest.java
@@ -0,0 +1,117 @@
+/*
+ * 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.deltaspike.test.scheduler.custom;
+
+import junit.framework.Assert;
+import org.apache.deltaspike.core.spi.config.ConfigSource;
+import org.apache.deltaspike.scheduler.spi.Scheduler;
+import org.apache.deltaspike.test.util.ArchiveUtils;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+
+@RunWith(Arquillian.class)
+public class CustomSchedulerTest
+{
+    @Deployment
+    public static WebArchive deploy()
+    {
+        String simpleName = CustomSchedulerTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "customSchedulerTest.jar")
+                .addPackage(CustomSchedulerTest.class.getPackage().getName())
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+                .addAsResource(new StringAsset(MockedScheduler.class.getName()),
+                        "META-INF/services/" + Scheduler.class.getName())
+                .addAsResource(new StringAsset(CustomConfigSource.class.getName()),
+                        "META-INF/services/" + ConfigSource.class.getName());
+
+        return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSchedulerArchive())
+                .addAsLibraries(testJar)
+                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    @Inject
+    private Scheduler<CustomJob> scheduler;
+
+    @Inject
+    private TestJobManager testJobManager;
+
+    @Test
+    public void checkAutoRegisteredSchedulerJob()
+    {
+        Assert.assertTrue(testJobManager.isStarted());
+        Assert.assertEquals(1, testJobManager.getRegisteredJobs().size());
+        Assert.assertEquals(AutoRegisteredJob.class, testJobManager.getRegisteredJobs().iterator().next());
+        Assert.assertEquals(1, testJobManager.getRunningJobs().size());
+        Assert.assertEquals(AutoRegisteredJob.class, testJobManager.getRunningJobs().iterator().next());
+    }
+
+    @Test
+    public void checkManualSchedulerJobManagement()
+    {
+        Assert.assertTrue(testJobManager.isStarted());
+        Assert.assertEquals(1, testJobManager.getRegisteredJobs().size());
+        Assert.assertEquals(AutoRegisteredJob.class, testJobManager.getRegisteredJobs().iterator().next());
+        Assert.assertEquals(1, testJobManager.getRunningJobs().size());
+        Assert.assertEquals(AutoRegisteredJob.class, testJobManager.getRunningJobs().iterator().next());
+
+        this.scheduler.registerNewJob(ManualJob.class);
+        Assert.assertEquals(2, testJobManager.getRegisteredJobs().size());
+        Assert.assertEquals(2, testJobManager.getRunningJobs().size());
+
+        this.scheduler.interruptJob(AutoRegisteredJob.class);
+        Assert.assertEquals(1, testJobManager.getRunningJobs().size());
+        Assert.assertEquals(ManualJob.class, testJobManager.getRunningJobs().iterator().next());
+
+        Assert.assertEquals(2, testJobManager.getRegisteredJobs().size());
+        this.scheduler.pauseJob(AutoRegisteredJob.class);
+        Assert.assertEquals(1, testJobManager.getRegisteredJobs().size());
+        Assert.assertEquals(ManualJob.class, testJobManager.getRegisteredJobs().iterator().next());
+
+        this.scheduler.pauseJob(ManualJob.class);
+        Assert.assertEquals(0, testJobManager.getRegisteredJobs().size());
+        this.scheduler.resumeJob(ManualJob.class);
+        Assert.assertEquals(1, testJobManager.getRegisteredJobs().size());
+        Assert.assertEquals(ManualJob.class, testJobManager.getRegisteredJobs().iterator().next());
+
+        this.scheduler.pauseJob(ManualJob.class);
+        this.scheduler.interruptJob(ManualJob.class);
+        Assert.assertEquals(0, testJobManager.getRunningJobs().size());
+        Assert.assertEquals(0, testJobManager.getRegisteredJobs().size());
+
+        this.scheduler.startJobManually(ManualJob.class);
+        Assert.assertTrue(this.scheduler.isExecutingJob(ManualJob.class));
+        Assert.assertEquals(0, testJobManager.getRegisteredJobs().size());
+        this.scheduler.interruptJob(ManualJob.class);
+
+        this.scheduler.registerNewJob(AutoRegisteredJob.class);
+        Assert.assertEquals(1, testJobManager.getRegisteredJobs().size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/ManualJob.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/ManualJob.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/ManualJob.java
new file mode 100644
index 0000000..708cd1b
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/ManualJob.java
@@ -0,0 +1,26 @@
+/*
+ * 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.deltaspike.test.scheduler.custom;
+
+import org.apache.deltaspike.scheduler.api.Scheduled;
+
+@Scheduled(cronExpression = "*/1 * * * * ?", onStartup = false)
+public class ManualJob implements CustomJob
+{
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/MockedScheduler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/MockedScheduler.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/MockedScheduler.java
new file mode 100644
index 0000000..bc152f3
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/MockedScheduler.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.deltaspike.test.scheduler.custom;
+
+import org.apache.deltaspike.scheduler.spi.Scheduler;
+
+public class MockedScheduler implements Scheduler<CustomJob>
+{
+    @Override
+    public void start()
+    {
+        TestJobManager.getInstance().start();
+    }
+
+    @Override
+    public void stop()
+    {
+        TestJobManager.getInstance().stop();
+    }
+
+    public void pauseJob(Class<? extends CustomJob> jobClass)
+    {
+        TestJobManager.getInstance().pauseJob(jobClass);
+    }
+
+    public void resumeJob(Class<? extends CustomJob> jobClass)
+    {
+        TestJobManager.getInstance().resumeJob(jobClass);
+    }
+
+    public void interruptJob(Class<? extends CustomJob> jobClass)
+    {
+        TestJobManager.getInstance().interruptJob(jobClass);
+    }
+
+    public boolean isExecutingJob(Class<? extends CustomJob> jobClass)
+    {
+        return TestJobManager.getInstance().isExecutingJob(jobClass);
+    }
+
+    public void registerNewJob(Class<? extends CustomJob> jobClass)
+    {
+        TestJobManager.getInstance().registerNewJob(jobClass);
+    }
+
+    public void startJobManually(Class<? extends CustomJob> jobClass)
+    {
+        TestJobManager.getInstance().startJobManually(jobClass);
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/QuartzDeactivator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/QuartzDeactivator.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/QuartzDeactivator.java
new file mode 100644
index 0000000..0a929bf
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/QuartzDeactivator.java
@@ -0,0 +1,33 @@
+/*
+ * 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.deltaspike.test.scheduler.custom;
+
+import org.apache.deltaspike.core.spi.activation.ClassDeactivator;
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
+
+public class QuartzDeactivator implements ClassDeactivator
+{
+    private static final long serialVersionUID = 6185043496640765473L;
+
+    @Override
+    public Boolean isActivated(Class<? extends Deactivatable> targetClass)
+    {
+        return !"QuartzScheduler".equals(targetClass.getSimpleName());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/TestJobManager.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/TestJobManager.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/TestJobManager.java
new file mode 100644
index 0000000..92f3b5e
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/TestJobManager.java
@@ -0,0 +1,104 @@
+/*
+ * 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.deltaspike.test.scheduler.custom;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Typed;
+import java.util.ArrayList;
+import java.util.List;
+
+@Typed()
+public class TestJobManager
+{
+    private static TestJobManager currentManager = new TestJobManager();
+
+    private boolean started;
+
+    private List<Class<? extends CustomJob>> registeredJobs = new ArrayList<Class<? extends CustomJob>>();
+    private List<Class<? extends CustomJob>> runningJobs = new ArrayList<Class<? extends CustomJob>>();
+
+    public static TestJobManager getInstance()
+    {
+        return currentManager;
+    }
+
+    @Produces
+    @ApplicationScoped
+    protected TestJobManager expose()
+    {
+        return currentManager;
+    }
+
+    public void start()
+    {
+        this.started = true;
+    }
+
+    public void stop()
+    {
+        currentManager = new TestJobManager();
+    }
+
+    public void pauseJob(Class<? extends CustomJob> jobClass)
+    {
+        this.registeredJobs.remove(jobClass);
+    }
+
+    public void resumeJob(Class<? extends CustomJob> jobClass)
+    {
+        this.registeredJobs.add(jobClass);
+    }
+
+    public void interruptJob(Class<? extends CustomJob> jobClass)
+    {
+        this.runningJobs.remove(jobClass);
+    }
+
+    public boolean isExecutingJob(Class<? extends CustomJob> jobClass)
+    {
+        return this.runningJobs.contains(jobClass);
+    }
+
+    public void registerNewJob(Class<? extends CustomJob> jobClass)
+    {
+        this.registeredJobs.add(jobClass);
+        this.runningJobs.add(jobClass);
+    }
+
+    public void startJobManually(Class<? extends CustomJob> jobClass)
+    {
+        this.runningJobs.add(jobClass);
+    }
+
+    public boolean isStarted()
+    {
+        return started;
+    }
+
+    public List<Class<? extends CustomJob>> getRegisteredJobs()
+    {
+        return registeredJobs;
+    }
+
+    public List<Class<? extends CustomJob>> getRunningJobs()
+    {
+        return runningJobs;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
new file mode 100644
index 0000000..59b31be
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
@@ -0,0 +1,41 @@
+/*
+ * 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.deltaspike.test.util;
+
+import org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ * This class contains helpers for building frequently used archives
+ */
+public class ArchiveUtils
+{
+    private ArchiveUtils()
+    {
+    }
+
+    public static JavaArchive[] getDeltaSpikeCoreAndSchedulerArchive()
+    {
+        return ShrinkWrapArchiveUtil.getArchives(
+                null,
+                "META-INF/beans.xml",
+                new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.scheduler"},
+                null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/beans.xml b/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/beans.xml
new file mode 100644
index 0000000..0eaf52c
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/beans.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+    <!-- DON'T add content to this file - it's >only< needed as marker file for the test-scan -->
+</beans>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource b/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource
new file mode 100644
index 0000000..35b3807
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource
@@ -0,0 +1,20 @@
+#####################################################################################
+# 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.
+#####################################################################################
+
+org.apache.deltaspike.test.scheduler.custom.CustomConfigSource
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/services/org.apache.deltaspike.scheduler.spi.Scheduler
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/services/org.apache.deltaspike.scheduler.spi.Scheduler b/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/services/org.apache.deltaspike.scheduler.spi.Scheduler
new file mode 100644
index 0000000..39c22d9
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/resources/META-INF/services/org.apache.deltaspike.scheduler.spi.Scheduler
@@ -0,0 +1,20 @@
+#####################################################################################
+# 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.
+#####################################################################################
+
+org.apache.deltaspike.test.scheduler.custom.MockedScheduler
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/26504284/deltaspike/modules/scheduler/impl/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/resources/arquillian.xml b/deltaspike/modules/scheduler/impl/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..a385b7f
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/resources/arquillian.xml
@@ -0,0 +1,83 @@
+<!--
+    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">
+
+    <!--Uncomment to have test archives exported to the file system for inspection -->
+    <!--engine>
+        <property name="deploymentExportPath">target/</property>
+    </engine-->
+
+    <container qualifier="jbossas-managed-7">
+        <configuration>
+            <property name="javaVmArguments">-client -noverify -Xms64m -Xmx1024m -XX:MaxPermSize=512m</property>
+            <property name="outputToConsole">false</property>
+            <property name="allowConnectingToRunningServer">true</property>
+        </configuration>
+    </container>
+
+    <container qualifier="jbossas-build-managed-7">
+        <configuration>
+            <property name="jbossHome">${arquillian.jboss_home}</property>
+            <property name="javaVmArguments">-client -noverify -Xms64m -Xmx1024m -XX:MaxPermSize=512m</property>
+            <property name="outputToConsole">false</property>
+            <property name="allowConnectingToRunningServer">true</property>
+        </configuration>
+    </container>
+
+    <container qualifier="jbossas-remote-7">
+        <!--
+        for remote debugging enable "remote socket debugging" - uncomment:
+            set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
+        in
+            standalone.conf (standalone.conf.bat)
+        and connect to
+            port 8787
+        -->
+    </container>
+
+    <!-- don't remove the qualifier - it's needed for the arquillian.launch property -->
+    <container qualifier="glassfish-remote-3.1">
+    </container>
+
+    <container qualifier="wls-remote-12c">
+        <configuration>
+            <property name="adminUrl">t3://localhost:7001</property>
+            <property name="adminUserName">weblogic1</property>
+            <property name="adminPassword">weblogic1</property>
+            <property name="target">AdminServer</property>
+            <property name="wlsHome">${WLS_HOME}</property>
+        </configuration>
+    </container>
+
+    <container qualifier="tomee">
+        <configuration>
+            <!-- tomee gets copied to this directory during the build -->
+            <property name="dir">target/tomee</property>
+
+            <!-- value '-1' to allow arquillian-tomee-remote to use dynamic settings -->
+            <property name="httpPort">-1</property>
+            <property name="ajpPort">-1</property>
+            <property name="stopPort">-1</property>
+            <property name="appWorkingDir">target/arquillian-test-working-dir</property>
+            <property name="simpleLog">true</property>
+        </configuration>
+    </container>
+</arquillian>