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 java.io.File;
019    import java.util.ArrayList;
020    import java.util.List;
021    import org.junit.After;
022    import org.junit.AfterClass;
023    import org.junit.Before;
024    import org.junit.BeforeClass;
025    import org.junit.Test;
026    import static org.junit.Assert.*;
027    /**
028     *
029     * @author nwright
030     */
031    public class KSDictionaryDocMojoTest {
032        private static final String DICTIONARY_DOC_DIRECTORY = "target/site/dictionary";
033        public KSDictionaryDocMojoTest() {
034        }
035    
036        @BeforeClass
037        public static void setUpClass() throws Exception {
038        }
039    
040        @AfterClass
041        public static void tearDownClass() throws Exception {
042        }
043        
044        @Before
045        public void setUp() {
046        }
047        
048        @After
049        public void tearDown() {
050        }
051    
052        /**
053         * Test of execute method, of class KSDictionaryDocMojo.
054         */
055        @Test
056        public void testExecute() throws Exception {
057            System.out.println("execute");
058            KSDictionaryDocMojo instance = new KSDictionaryDocMojo();
059            List<String> supportFiles = new ArrayList ();
060    //        supportFiles.add("ks-AtpInfo-dictionary-generated.xml");        
061            supportFiles.add("ks-base-dictionary.xml");          
062            supportFiles.add("ks-base-dictionary-validchars.xml");
063            supportFiles.add("org/kuali/rice/krad/bo/datadictionary/DataDictionaryBaseTypes.xml");
064            supportFiles.add("org/kuali/rice/krad/uif/UifControlDefinitions.xml");
065            supportFiles.add("org/kuali/rice/krad/uif/UifWidgetDefinitions.xml");        
066            supportFiles.add("org/kuali/rice/krad/uif/UifFieldDefinitions.xml");
067            supportFiles.add("org/kuali/rice/krad/uif/UifGroupDefinitions.xml");
068            instance.setSupportFiles(supportFiles);        
069            List<String> inputFiles = new ArrayList ();
070            inputFiles.add("ks-AtpInfo-dictionary.xml");        
071    //        inputFiles.add("ks-LprInfo-dictionary.xml");            
072            instance.setInputFiles(inputFiles);
073            instance.setHtmlDirectory(new File (DICTIONARY_DOC_DIRECTORY));
074            instance.execute();
075            assertTrue(new File(instance.getHtmlDirectory() + "/" + "index.html").exists());        
076            assertTrue(new File(instance.getHtmlDirectory() + "/" + "AtpInfo.html").exists());
077        }
078    }