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 */ 016 package org.kuali.student.datadictionary.mojo; 017 018 import java.io.File; 019 import java.util.ArrayList; 020 import java.util.HashMap; 021 import java.util.List; 022 import java.util.Map; 023 024 import org.apache.maven.project.MavenProject; 025 import org.junit.After; 026 import org.junit.AfterClass; 027 import org.junit.Before; 028 import org.junit.BeforeClass; 029 import org.junit.Test; 030 import org.kuali.student.validation.decorator.mojo.ValidationDecoratorWriterForOneService; 031 import org.slf4j.Logger; 032 import org.slf4j.LoggerFactory; 033 034 /** 035 * 036 * @author nwright 037 */ 038 public class KSDictionaryCreatorMojoTest { 039 040 private static Logger log = LoggerFactory.getLogger(KSDictionaryCreatorMojoTest.class); 041 042 043 private static final String CORE_DIRECTORY = 044 "C:/svn/ks-1.3/ks-core/ks-core-api/src/main/java"; 045 // "C:/svn/maven-dictionary-generator/trunk/src/main/java/org/kuali/student/core"; 046 private static final String COMMON_DIRECTORY = 047 "C:/svn/ks-1.3/ks-common/ks-common-api/src/main/java"; 048 private static final String ENROLL_PROJECT_SRC_MAIN = "C:/svn/ks-1.3/ks-enroll/ks-enroll-api/src/main"; 049 private static final String ENROLL_PROJECT_JAVA_DIRECTORY = ENROLL_PROJECT_SRC_MAIN + "/java"; 050 private static final String ENROLL_PROJECT_RESOURCES_DIRECTORY = ENROLL_PROJECT_SRC_MAIN + "/resources"; 051 private static final String LUM_DIRECTORY = 052 "C:/svn/ks-1.3/ks-lum/ks-lum-api/src/main/java"; 053 private static final String RICE_DIRECTORY = 054 "C:/svn/rice/rice-release-1-0-2-1-br/api/src/main/java"; 055 private static final String TEST_SOURCE_DIRECTORY = 056 "src/test/java/org/kuali/student/contract/model/test/source"; 057 private static final String TARGET_GENERATED_SOURCES = "target/generated-sources"; 058 private static final String RESOURCES_DIRECTORY = 059 // "C:/svn/student/ks-core/ks-core-api/src/main/java"; 060 "src/main/resources"; 061 private static final String PESC_CORE_MAIN = RESOURCES_DIRECTORY 062 + "/CoreMain_v1.8.0.xsd"; 063 064 public KSDictionaryCreatorMojoTest() { 065 } 066 067 @BeforeClass 068 public static void setUpClass() throws Exception { 069 } 070 071 @AfterClass 072 public static void tearDownClass() throws Exception { 073 } 074 075 @Before 076 public void setUp() { 077 } 078 079 @After 080 public void tearDown() { 081 } 082 083 /** 084 * Test of execute method, of class KSDictionaryCreatorMojo. 085 */ 086 @Test 087 public void testExecute() throws Exception { 088 log.info("execute"); 089 List<String> srcDirs = new ArrayList<String>(); 090 srcDirs.add(TEST_SOURCE_DIRECTORY); 091 // srcDirs.add(ENROLL_PROJECT_JAVA_DIRECTORY); 092 093 // srcDirs.add(CORE_DIRECTORY); 094 // srcDirs.add(COMMON_DIRECTORY); 095 // srcDirs.add(LUM_DIRECTORY); 096 KSDictionaryCreatorMojo instance = new KSDictionaryCreatorMojo(); 097 Map pluginContext = new HashMap (); 098 MavenProject project = new MavenProject (); 099 pluginContext.put("project", project); 100 instance.setPluginContext(pluginContext); 101 instance.setSourceDirs(srcDirs); 102 instance.setOutputDirectory(new File(TARGET_GENERATED_SOURCES)); 103 // instance.setOutputDirectory(new File(ENROLL_PROJECT_RESOURCES_DIRECTORY)); 104 // Be careful when you uncomment this one it will overwrite stuff in another project 105 // instance.setOutputDirectory(new File(ENROLL_PROJECT_RESOURCES_DIRECTORY)); 106 instance.setWriteManual(true); 107 instance.setWriteGenerated(true); 108 instance.setThrowExceptionIfNotAllFilesProcessed(false); 109 List<String> classNames = new ArrayList(); 110 // Atp 111 // classNames.add("AtpInfo"); 112 // classNames.add("MilestoneInfo"); 113 // classNames.add("AtpMilestoneRelationInfo"); 114 // classNames.add("AtpAtpRelationInfo"); 115 // // Acal 116 // classNames.add("AcademicCalendarInfo"); 117 // classNames.add("CampusCalendarInfo"); 118 // classNames.add("TermInfo"); 119 // classNames.add("RegistrationDateGroupInfo"); 120 // classNames.add("HolidayInfo"); 121 // classNames.add("KeyDateInfo"); 122 // // LPR 123 // classNames.add("LuiPersonRelationInfo"); 124 // classNames.add("LprRosterInfo"); 125 // classNames.add("LprRosterEntryInfo"); 126 // classNames.add("LprTransactionInfo"); 127 // classNames.add("LprTransactionItemInfo"); 128 // classNames.add("RequestOptionInfo"); 129 // classNames.add("LprTransactionItemResultInfo"); 130 // // Hold 131 // classNames.add("HoldInfo"); 132 // classNames.add("IssueInfo"); 133 // classNames.add("RestrictionInfo"); 134 // // LUI 135 // classNames.add("LuiInfo"); 136 // classNames.add("LuiIdentifierInfo"); 137 // classNames.add("LuCodeInfo"); 138 // classNames.add("FeeInfo"); 139 // classNames.add("CurrencyAmountInfo"); 140 // classNames.add("RevenueInfo"); 141 // classNames.add("AffiliatedOrgInfo"); 142 // classNames.add("MeetingScheduleInfo"); 143 // classNames.add("LuiLuiRelationInfo"); 144 // classNames.add("LuiCapacityInfo"); 145 146 // // Course Offering 147 // classNames.add("CourseOfferingInfo"); 148 // classNames.add("CourseWaitlistEntryInfo"); 149 // classNames.add("OfferingInstructorInfo"); 150 // classNames.add("ActivityOfferingInfo"); 151 // classNames.add("RegistrationGroupInfo"); 152 // classNames.add("SeatPoolDefinitionInfo"); 153 // classNames.add("StatementTreeViewInfo"); 154 // classNames.add("ReqComponentInfo"); 155 // classNames.add("ReqCompFieldInfo"); 156 157 // // Course registration 158 // classNames.add("CourseRegistrationInfo"); 159 // classNames.add("ActivityRegistrationInfo"); 160 // classNames.add("RegGroupRegistrationInfo"); 161 // classNames.add("RegRequestInfo"); 162 // classNames.add("RegRequestItemInfo"); 163 // classNames.add("RegResponseInfo"); 164 // classNames.add("RegResponseItemInfo"); 165 // 166 // // Exemption 167 // classNames.add("ExemptionInfo"); 168 // classNames.add("ExemptionRequestInfo"); 169 // 170 // // Grading 171 // classNames.add("GradeRosterInfo"); 172 // classNames.add("GradeRosterEntryInfo"); 173 // classNames.add("GradeValuesGroupInfo"); 174 // 175 // // LRR 176 // classNames.add("LearningResultRecordInfo"); 177 // classNames.add("ResultSourceInfo"); 178 // 179 // // LRC 180 // classNames.add("ResultValuesGroupInfo"); 181 // classNames.add("ResultValueInfo"); 182 // classNames.add("ResultScaleInfo"); 183 184 instance.execute(); 185 // assertTrue(new File(instance.getOutputDirectory() + "/" + "ks-LprInfo-dictionary.xml").exists()); 186 } 187 }