001    /*
002     * Copyright 2011 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may      obtain a copy of the License at
007     *
008     *      http://www.osedu.org/licenses/ECL-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.student.datadictionary.mojo;
017    
018    import static org.junit.Assert.assertTrue;
019    
020    import java.io.File;
021    import java.util.ArrayList;
022    import java.util.LinkedHashMap;
023    import java.util.List;
024    
025    import org.apache.maven.model.Build;
026    import org.apache.maven.model.Model;
027    import org.apache.maven.project.MavenProject;
028    import org.junit.After;
029    import org.junit.AfterClass;
030    import org.junit.Before;
031    import org.junit.BeforeClass;
032    import org.junit.Ignore;
033    import org.junit.Test;
034    /**
035     *
036     * @author nwright
037     */
038    @Ignore // need to figure out how to provide the path info for locating the files when running the tests.
039    public class KSDictionaryDocMojoTest {
040        private static final String DICTIONARY_DOC_DIRECTORY = "target/site/dictionary";
041        public KSDictionaryDocMojoTest() {
042        }
043    
044        @BeforeClass
045        public static void setUpClass() throws Exception {
046        }
047    
048        @AfterClass
049        public static void tearDownClass() throws Exception {
050        }
051        
052        @Before
053        public void setUp() {
054        }
055        
056        @After
057        public void tearDown() {
058        }
059    
060        /**
061         * Test of execute method, of class KSDictionaryDocMojo.
062         */
063        @Test
064        public void testExecute() throws Exception {
065            System.out.println("execute");
066            KSDictionaryDocMojo instance = new KSDictionaryDocMojo();
067            List<String> supportFiles = new ArrayList<String> ();
068            supportFiles.add("ks-base-dictionary.xml");          
069            supportFiles.add("ks-base-dictionary-validchars.xml");
070            supportFiles.add("org/kuali/rice/krad/bo/datadictionary/DataDictionaryBaseTypes.xml");
071            supportFiles.add("org/kuali/rice/krad/uif/UifControlDefinitions.xml");
072            supportFiles.add("org/kuali/rice/krad/uif/UifWidgetDefinitions.xml");        
073            supportFiles.add("org/kuali/rice/krad/uif/UifFieldDefinitions.xml");
074            supportFiles.add("org/kuali/rice/krad/uif/UifGroupDefinitions.xml");
075            instance.setSupportFiles(supportFiles);        
076            instance.setHtmlDirectory(new File (DICTIONARY_DOC_DIRECTORY));
077                    
078                    instance.setTestDictionaryFile("ks-test-AtpInfo-dictionary.xml");
079                    
080            instance.execute();
081            assertTrue(new File(instance.getHtmlDirectory() + "/" + "index.html").exists());        
082            assertTrue(new File(instance.getHtmlDirectory() + "/" + "AtpInfo.html").exists());
083        }
084    }