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