View Javadoc

1   /*
2    * Copyright 2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may	obtain a copy of the License at
7    *
8    * 	http://www.osedu.org/licenses/ECL-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.student.datadictionary.mojo;
17  
18  import static org.junit.Assert.assertTrue;
19  
20  import java.io.File;
21  import java.util.ArrayList;
22  import java.util.LinkedHashMap;
23  import java.util.List;
24  
25  import org.apache.maven.model.Build;
26  import org.apache.maven.model.Model;
27  import org.apache.maven.project.MavenProject;
28  import org.junit.After;
29  import org.junit.AfterClass;
30  import org.junit.Before;
31  import org.junit.BeforeClass;
32  import org.junit.Ignore;
33  import org.junit.Test;
34  /**
35   *
36   * @author nwright
37   */
38  @Ignore // need to figure out how to provide the path info for locating the files when running the tests.
39  public class KSDictionaryDocMojoTest {
40      private static final String DICTIONARY_DOC_DIRECTORY = "target/site/dictionary";
41      public KSDictionaryDocMojoTest() {
42      }
43  
44      @BeforeClass
45      public static void setUpClass() throws Exception {
46      }
47  
48      @AfterClass
49      public static void tearDownClass() throws Exception {
50      }
51      
52      @Before
53      public void setUp() {
54      }
55      
56      @After
57      public void tearDown() {
58      }
59  
60      /**
61       * Test of execute method, of class KSDictionaryDocMojo.
62       */
63      @Test
64      public void testExecute() throws Exception {
65          System.out.println("execute");
66          KSDictionaryDocMojo instance = new KSDictionaryDocMojo();
67          List<String> supportFiles = new ArrayList<String> ();
68          supportFiles.add("ks-base-dictionary.xml");          
69          supportFiles.add("ks-base-dictionary-validchars.xml");
70          supportFiles.add("org/kuali/rice/krad/bo/datadictionary/DataDictionaryBaseTypes.xml");
71          supportFiles.add("org/kuali/rice/krad/uif/UifControlDefinitions.xml");
72          supportFiles.add("org/kuali/rice/krad/uif/UifWidgetDefinitions.xml");        
73          supportFiles.add("org/kuali/rice/krad/uif/UifFieldDefinitions.xml");
74          supportFiles.add("org/kuali/rice/krad/uif/UifGroupDefinitions.xml");
75          instance.setSupportFiles(supportFiles);        
76          instance.setHtmlDirectory(new File (DICTIONARY_DOC_DIRECTORY));
77  		
78  		instance.setTestDictionaryFile("ks-test-AtpInfo-dictionary.xml");
79  		
80          instance.execute();
81          assertTrue(new File(instance.getHtmlDirectory() + "/" + "index.html").exists());        
82          assertTrue(new File(instance.getHtmlDirectory() + "/" + "AtpInfo.html").exists());
83      }
84  }