001/**
002 * Copyright 2004-2014 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.opensource.org/licenses/ecl2.php
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 */
016package org.kuali.student.datadictionary.mojo;
017
018import static org.junit.Assert.assertTrue;
019
020import java.io.File;
021import java.util.ArrayList;
022import java.util.LinkedHashMap;
023import java.util.List;
024
025import org.apache.maven.model.Build;
026import org.apache.maven.model.Model;
027import org.apache.maven.project.MavenProject;
028import org.junit.After;
029import org.junit.AfterClass;
030import org.junit.Before;
031import org.junit.BeforeClass;
032import org.junit.Ignore;
033import org.junit.Test;
034import org.kuali.student.validation.decorator.mojo.ValidationDecoratorWriterForOneService;
035import org.slf4j.Logger;
036import org.slf4j.LoggerFactory;
037/**
038 *
039 * @author nwright
040 */
041@Ignore // need to figure out how to provide the path info for locating the files when running the tests.
042public class KSDictionaryDocMojoTest {
043    private static Logger log = LoggerFactory.getLogger(KSDictionaryDocMojoTest.class);
044    
045    private static final String DICTIONARY_DOC_DIRECTORY = "target/site/dictionary";
046    public KSDictionaryDocMojoTest() {
047    }
048
049    @BeforeClass
050    public static void setUpClass() throws Exception {
051    }
052
053    @AfterClass
054    public static void tearDownClass() throws Exception {
055    }
056    
057    @Before
058    public void setUp() {
059    }
060    
061    @After
062    public void tearDown() {
063    }
064
065    /**
066     * Test of execute method, of class KSDictionaryDocMojo.
067     */
068    @Test
069    public void testExecute() throws Exception {
070        log.info("execute");
071        KSDictionaryDocMojo instance = new KSDictionaryDocMojo();
072        List<String> supportFiles = new ArrayList<String> ();
073        supportFiles.add("ks-base-dictionary.xml");          
074        supportFiles.add("ks-base-dictionary-validchars.xml");
075        supportFiles.add("org/kuali/rice/krad/bo/datadictionary/DataDictionaryBaseTypes.xml");
076        supportFiles.add("org/kuali/rice/krad/uif/UifControlDefinitions.xml");
077        supportFiles.add("org/kuali/rice/krad/uif/UifWidgetDefinitions.xml");        
078        supportFiles.add("org/kuali/rice/krad/uif/UifFieldDefinitions.xml");
079        supportFiles.add("org/kuali/rice/krad/uif/UifGroupDefinitions.xml");
080        instance.setSupportFiles(supportFiles);        
081        instance.setHtmlDirectory(new File (DICTIONARY_DOC_DIRECTORY));
082                
083                instance.setTestDictionaryFile("ks-test-AtpInfo-dictionary.xml");
084                
085        instance.execute();
086        assertTrue(new File(instance.getHtmlDirectory() + "/" + "index.html").exists());        
087        assertTrue(new File(instance.getHtmlDirectory() + "/" + "AtpInfo.html").exists());
088    }
089}