Skip to content
Permalink
Browse files
remove System.out
  • Loading branch information
olamy committed Nov 20, 2012
1 parent cacf251 commit 86407502409de9c9ea977ed793a2198c26136b90
Showing 2 changed files with 17 additions and 10 deletions.
@@ -18,23 +18,29 @@
* specific language governing permissions and limitations
* under the License.
*/

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;

public class JobOne
implements Job
{

private Logger logger = LoggerFactory.getLogger( getClass() );

public JobOne()
{
}

public void execute( JobExecutionContext context )
throws JobExecutionException
{
System.out.println(
logger.info(
" --- Testing Scheduler Component\n --- " + context.getJobDetail().getDescription() + " executed.["
+ new Date() + "]" );

@@ -30,19 +30,23 @@
import org.quartz.TriggerListener;
import org.quartz.impl.JobDetailImpl;
import org.quartz.impl.triggers.SimpleTriggerImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.inject.Inject;

@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath:/spring-context.xml"} )
@RunWith ( SpringJUnit4ClassRunner.class )
@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class SchedulerTest
extends TestCase
implements TriggerListener
{
private boolean triggerFired;

private Logger logger = LoggerFactory.getLogger( getClass() );

@Inject
private Scheduler scheduler;

@@ -57,7 +61,6 @@ public void testCreation()
throws Exception
{


assertNotNull( scheduler );

JobDataMap dataMap = new JobDataMap();
@@ -76,12 +79,11 @@ public void testCreation()

scheduler.scheduleJob( jobDetail, trigger );

while ( ! triggerFired )
while ( !triggerFired )
{
//System.out.println("! triggerFired");
Thread.sleep( 10 );
Thread.sleep( 10 );
}
System.out.println("ok triggerFired");
logger.info( "ok triggerFired" );
}

public void triggerComplete( Trigger trigger, JobExecutionContext context, int triggerInstructionCode )
@@ -95,7 +97,7 @@ public boolean vetoJobExecution( Trigger trigger, JobExecutionContext context )

public void triggerFired( Trigger trigger, JobExecutionContext context )
{
System.out.println( "Trigger fired!" );
logger.info( "Trigger fired!" );

triggerFired = true;
}
@@ -116,6 +118,5 @@ public String getName()
}



}

0 comments on commit 8640750

Please sign in to comment.