1   package org.apache.velocity.test;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.    
20   */
21  
22  import junit.framework.Test;
23  import junit.framework.TestSuite;
24  
25  
26  
27  /**
28   * This is a test case for Texen. Simply executes a simple
29   * generative task and compares the output.
30   *
31   * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
32   * @version $Id: TexenClasspathTestCase.java 463298 2006-10-12 16:10:32Z henning $
33   */
34  public class TexenClasspathTestCase
35      extends BaseTestCase
36  {
37      /**
38       * Directory where results are generated.
39       */
40      private static final String RESULTS_DIR = TEST_RESULT_DIR + "/texen-classpath";
41  
42      /**
43       * Directory where comparison output is stored.
44       */
45      private static final String COMPARE_DIR = TEST_COMPARE_DIR + "/texen-classpath/compare";
46  
47      /**
48       * Creates a new instance.
49       *
50       */
51      public TexenClasspathTestCase(String name)
52      {
53          super(name);
54      }
55  
56      public static Test suite()
57      {
58          return new TestSuite(TexenClasspathTestCase.class);
59      }
60  
61      /**
62       * Runs the test.
63       */
64      public void testTexenClasspath ()
65              throws Exception
66      {
67          assureResultsDirectoryExists(RESULTS_DIR);
68  
69          if (!isMatch(RESULTS_DIR,COMPARE_DIR,"TurbineWeather","java","java") ||
70              !isMatch(RESULTS_DIR,COMPARE_DIR,"TurbineWeatherService","java","java") ||
71              !isMatch(RESULTS_DIR,COMPARE_DIR,"WeatherService","java","java") ||
72              !isMatch(RESULTS_DIR,COMPARE_DIR,"book","txt","txt") ||
73              !isMatch(RESULTS_DIR,COMPARE_DIR,"Test","txt","txt"))
74          {
75              fail("Output is incorrect!");
76          }
77      }
78  }