001package org.apache.fulcrum.quartz; 002 003 004import static org.junit.jupiter.api.Assertions.assertNotNull; 005import static org.junit.jupiter.api.Assertions.fail; 006 007import org.apache.avalon.framework.logger.Logger; 008import org.apache.fulcrum.quartz.test.NotSoSimpleJob; 009import org.apache.fulcrum.quartz.test.SimpleJob; 010 011/* 012 * Licensed to the Apache Software Foundation (ASF) under one 013 * or more contributor license agreements. See the NOTICE file 014 * distributed with this work for additional information 015 * regarding copyright ownership. The ASF licenses this file 016 * to you under the Apache License, Version 2.0 (the 017 * "License"); you may not use this file except in compliance 018 * with the License. You may obtain a copy of the License at 019 * 020 * http://www.apache.org/licenses/LICENSE-2.0 021 * 022 * Unless required by applicable law or agreed to in writing, 023 * software distributed under the License is distributed on an 024 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 025 * KIND, either express or implied. See the License for the 026 * specific language governing permissions and limitations 027 * under the License. 028 */ 029 030 031import org.apache.fulcrum.testcontainer.BaseUnit5Test; 032import org.junit.jupiter.api.AfterEach; 033import org.junit.jupiter.api.BeforeEach; 034 035 036/** 037 * Handle looking up and then the icky cleanup of Quartz. 038 * 039 * @author <a href="mailto:epughNOSPAM@opensourceconnections.com">Eric Pugh </a> 040 */ 041 042public class BaseQuartzTestCase extends BaseUnit5Test 043{ 044 045 private final String preDefinedOutput = "{\"container\":{\"cf\":\"Config.xml\"},\"configurationName\":\"Config.xml\",\"name\":\"mytest\"}"; 046 QuartzScheduler quartz = null; 047 Logger logger; 048 049 /** 050 * @throws Exception generic exception 051 */ 052 @BeforeEach 053 public void setUp() throws Exception 054 { 055 SimpleJob.reset(); 056 NotSoSimpleJob.reset(); 057 try 058 { 059 quartz = (QuartzScheduler) this.lookup(QuartzScheduler.ROLE); 060 } 061 catch (Throwable e) 062 { 063 fail(e.getMessage()); 064 } 065 assertNotNull(quartz); 066 } 067 068 069 /* (non-Javadoc) 070 * @see org.apache.fulcrum.testcontainer.BaseUnit5Test#tearDown() 071 */ 072 @AfterEach 073 public void tearDown() 074 { 075 release(QuartzScheduler.ROLE); 076 SimpleJob.reset(); 077 NotSoSimpleJob.reset(); 078 super.tearDown(); 079 } 080}