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  import org.kuali.student.validation.decorator.mojo.ValidationDecoratorWriterForOneService;
35  import org.slf4j.Logger;
36  import org.slf4j.LoggerFactory;
37  /**
38   *
39   * @author nwright
40   */
41  @Ignore // need to figure out how to provide the path info for locating the files when running the tests.
42  public class KSDictionaryDocMojoTest {
43      private static Logger log = LoggerFactory.getLogger(KSDictionaryDocMojoTest.class);
44      
45      private static final String DICTIONARY_DOC_DIRECTORY = "target/site/dictionary";
46      public KSDictionaryDocMojoTest() {
47      }
48  
49      @BeforeClass
50      public static void setUpClass() throws Exception {
51      }
52  
53      @AfterClass
54      public static void tearDownClass() throws Exception {
55      }
56      
57      @Before
58      public void setUp() {
59      }
60      
61      @After
62      public void tearDown() {
63      }
64  
65      /**
66       * Test of execute method, of class KSDictionaryDocMojo.
67       */
68      @Test
69      public void testExecute() throws Exception {
70          log.info("execute");
71          KSDictionaryDocMojo instance = new KSDictionaryDocMojo();
72          List<String> supportFiles = new ArrayList<String> ();
73          supportFiles.add("ks-base-dictionary.xml");          
74          supportFiles.add("ks-base-dictionary-validchars.xml");
75          supportFiles.add("org/kuali/rice/krad/bo/datadictionary/DataDictionaryBaseTypes.xml");
76          supportFiles.add("org/kuali/rice/krad/uif/UifControlDefinitions.xml");
77          supportFiles.add("org/kuali/rice/krad/uif/UifWidgetDefinitions.xml");        
78          supportFiles.add("org/kuali/rice/krad/uif/UifFieldDefinitions.xml");
79          supportFiles.add("org/kuali/rice/krad/uif/UifGroupDefinitions.xml");
80          instance.setSupportFiles(supportFiles);        
81          instance.setHtmlDirectory(new File (DICTIONARY_DOC_DIRECTORY));
82  		
83  		instance.setTestDictionaryFile("ks-test-AtpInfo-dictionary.xml");
84  		
85          instance.execute();
86          assertTrue(new File(instance.getHtmlDirectory() + "/" + "index.html").exists());        
87          assertTrue(new File(instance.getHtmlDirectory() + "/" + "AtpInfo.html").exists());
88      }
89  }