1 /*
2 * Copyright 2011 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.osedu.org/licenses/ECL-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.student.datadictionary.mojo;
17
18 import java.io.File;
19 import java.util.ArrayList;
20 import java.util.HashMap;
21 import java.util.List;
22 import java.util.Map;
23 import org.apache.maven.project.MavenProject;
24 import org.junit.After;
25 import org.junit.AfterClass;
26 import org.junit.Before;
27 import org.junit.BeforeClass;
28 import org.junit.Test;
29
30 /**
31 *
32 * @author nwright
33 */
34 public class KSDictionaryCreatorMojoTest {
35
36 private static final String CORE_DIRECTORY =
37 "C:/svn/ks-1.3/ks-core/ks-core-api/src/main/java";
38 // "C:/svn/maven-dictionary-generator/trunk/src/main/java/org/kuali/student/core";
39 private static final String COMMON_DIRECTORY =
40 "C:/svn/ks-1.3/ks-common/ks-common-api/src/main/java";
41 private static final String ENROLL_PROJECT_SRC_MAIN = "C:/svn/ks-1.3/ks-enroll/ks-enroll-api/src/main";
42 private static final String ENROLL_PROJECT_JAVA_DIRECTORY = ENROLL_PROJECT_SRC_MAIN + "/java";
43 private static final String ENROLL_PROJECT_RESOURCES_DIRECTORY = ENROLL_PROJECT_SRC_MAIN + "/resources";
44 private static final String LUM_DIRECTORY =
45 "C:/svn/ks-1.3/ks-lum/ks-lum-api/src/main/java";
46 private static final String RICE_DIRECTORY =
47 "C:/svn/rice/rice-release-1-0-2-1-br/api/src/main/java";
48 private static final String TEST_SOURCE_DIRECTORY =
49 "src/test/java/org/kuali/student/contract/model/test/source";
50 private static final String TARGET_GENERATED_SOURCES = "target/generated-sources";
51 private static final String RESOURCES_DIRECTORY =
52 // "C:/svn/student/ks-core/ks-core-api/src/main/java";
53 "src/main/resources";
54 private static final String PESC_CORE_MAIN = RESOURCES_DIRECTORY
55 + "/CoreMain_v1.8.0.xsd";
56
57 public KSDictionaryCreatorMojoTest() {
58 }
59
60 @BeforeClass
61 public static void setUpClass() throws Exception {
62 }
63
64 @AfterClass
65 public static void tearDownClass() throws Exception {
66 }
67
68 @Before
69 public void setUp() {
70 }
71
72 @After
73 public void tearDown() {
74 }
75
76 /**
77 * Test of execute method, of class KSDictionaryCreatorMojo.
78 */
79 @Test
80 public void testExecute() throws Exception {
81 System.out.println("execute");
82 List<String> srcDirs = new ArrayList<String>();
83 srcDirs.add(TEST_SOURCE_DIRECTORY);
84 // srcDirs.add(ENROLL_PROJECT_JAVA_DIRECTORY);
85
86 // srcDirs.add(CORE_DIRECTORY);
87 // srcDirs.add(COMMON_DIRECTORY);
88 // srcDirs.add(LUM_DIRECTORY);
89 KSDictionaryCreatorMojo instance = new KSDictionaryCreatorMojo();
90 Map pluginContext = new HashMap ();
91 MavenProject project = new MavenProject ();
92 pluginContext.put("project", project);
93 instance.setPluginContext(pluginContext);
94 instance.setSourceDirs(srcDirs);
95 instance.setOutputDirectory(new File(TARGET_GENERATED_SOURCES));
96 // instance.setOutputDirectory(new File(ENROLL_PROJECT_RESOURCES_DIRECTORY));
97 // Be careful when you uncomment this one it will overwrite stuff in another project
98 // instance.setOutputDirectory(new File(ENROLL_PROJECT_RESOURCES_DIRECTORY));
99 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 }