-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some exceptions into the API so we can reuse them. Add a propert…
…y to make HA deployment mandatory, and fail deployment if HA doesn't come online.
- Loading branch information
Showing
27 changed files
with
194 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...org/jboss/seam/cron/scheduling/test/timerservice/TimerServiceSchedulingHaFailureTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* JBoss, Home of Professional Open Source Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual contributors by the @authors | ||
* tag. See the copyright.txt in the distribution for a full listing of individual contributors. | ||
* | ||
* 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. | ||
*/ | ||
package org.jboss.seam.cron.scheduling.test.timerservice; | ||
|
||
import java.io.File; | ||
import javax.inject.Inject; | ||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.seam.cron.scheduling.timerservice.TimerScheduleProviderEjb; | ||
import static org.jboss.seam.cron.test.SeamCronTestBase.addCronAsJar; | ||
import static org.jboss.seam.cron.test.SeamCronTestBase.addNonCDILibraries; | ||
import org.jboss.seam.cron.test.scheduling.beans.ScheduledBean; | ||
import org.jboss.seam.cron.test.scheduling.tck.SeamCronSchedulingTCKTest; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import static org.junit.Assert.assertNotNull; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* NOTE: This test should actually cause an error, since the code that enforces HA deployment should fail on deployment with a runtime | ||
* exception. Because we can't specifically test for that with Arquillian we just have to run this test manually from time to time and make | ||
* sure it fails with the appropriate error. | ||
* | ||
* @author Peter Royle | ||
*/ | ||
@RunWith(Arquillian.class) | ||
@Ignore | ||
public class TimerServiceSchedulingHaFailureTest { | ||
|
||
private static Logger log = LoggerFactory.getLogger(TimerServiceSchedulingHaFailureTest.class); | ||
|
||
@Inject | ||
ScheduledBean bean; | ||
|
||
@Deployment() | ||
public static WebArchive createDefaultArchive() { | ||
JavaArchive baseArchive = SeamCronSchedulingTCKTest.createSchedulingTckTestArchive(false, false) | ||
.addPackages(true, TimerScheduleProviderEjb.class.getPackage()); | ||
WebArchive archive = ShrinkWrap.create(WebArchive.class, "test-long.war"); | ||
archive.addAsLibrary(baseArchive) | ||
.addAsResource(new File("src/test/resources/cron-ha.properties"), "cron.properties") | ||
.addAsWebInfResource(new File("src/main/resources/META-INF/beans.xml"), "beans.xml"); | ||
|
||
addNonCDILibraries(archive); | ||
addCronAsJar(archive); | ||
|
||
log.debug(archive.toString(true)); | ||
return archive; | ||
} | ||
|
||
@Test | ||
public void isDeployed() { | ||
assertNotNull(bean); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
providers/scheduling/timerservice/src/test/resources/cron-ha.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# JBoss, Home of Professional Open Source | ||
# Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual | ||
# contributors by the @authors tag. See the copyright.txt in the | ||
# distribution for a full listing of individual contributors. | ||
# | ||
# 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. | ||
# | ||
# This file defines the set of available schedules in the form: | ||
# name=schedule | ||
# Each schedule may be used for ne or more jobs. If more than one job is | ||
# is assigned to a single schedule then those jobs will be executed in a | ||
# round robin style. | ||
|
||
# Open issues: | ||
# 1. For round robin, what if the previous job has not completed? Should it | ||
# wait until next scheduled time or should it start as soon as the previous | ||
# job finishes? | ||
# 2. What is the best interpretation of 12:00/5? For a single job it would | ||
# most obviously be that the job would run every 5 minutes, starting at 12:00. | ||
# But if you added multiple jobs, would they continue to round robin around | ||
# the clock or would they only ru until all the jobs have been executed once, | ||
# and then wait for 12:00 to come again? | ||
|
||
# This schedule is called "test.one" and runs every 5 seconds | ||
test.one=*/5 * * ? * * | ||
|
||
# This schedule is called "test.two" and runs at precisely 1:12 PM every day | ||
test.two=13:12 | ||
|
||
# This schedule is called "test.three" and will execute every 5 minutes, | ||
# starting at 12:00PM. | ||
test.three=12:00/5 | ||
# could also be per-job, | ||
test.three.qeueumode=delayed | ||
|
||
# HACK (because we can't actually set a system property with the version of Arquillian and JBoss AS we're using) | ||
test.system.property=*/5 * * ? * * | ||
|
||
# As per default, if the HA singleton doesn't start, we'll just fall back to a timerservice per JVM | ||
# (use 'mandatory' to fail on startup if the HA singleton doesn't start) | ||
ha.singleton.mode=mandatory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.