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
24 import org.apache.maven.project.MavenProject;
25 import org.junit.After;
26 import org.junit.AfterClass;
27 import org.junit.Before;
28 import org.junit.BeforeClass;
29 import org.junit.Test;
30 import org.kuali.student.validation.decorator.mojo.ValidationDecoratorWriterForOneService;
31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory;
33
34 /**
35 *
36 * @author nwright
37 */
38 public class KSDictionaryCreatorMojoTest {
39
40 private static Logger log = LoggerFactory.getLogger(KSDictionaryCreatorMojoTest.class);
41
42
43 private static final String CORE_DIRECTORY =
44 "C:/svn/ks-1.3/ks-core/ks-core-api/src/main/java";
45 // "C:/svn/maven-dictionary-generator/trunk/src/main/java/org/kuali/student/core";
46 private static final String COMMON_DIRECTORY =
47 "C:/svn/ks-1.3/ks-common/ks-common-api/src/main/java";
48 private static final String ENROLL_PROJECT_SRC_MAIN = "C:/svn/ks-1.3/ks-enroll/ks-enroll-api/src/main";
49 private static final String ENROLL_PROJECT_JAVA_DIRECTORY = ENROLL_PROJECT_SRC_MAIN + "/java";
50 private static final String ENROLL_PROJECT_RESOURCES_DIRECTORY = ENROLL_PROJECT_SRC_MAIN + "/resources";
51 private static final String LUM_DIRECTORY =
52 "C:/svn/ks-1.3/ks-lum/ks-lum-api/src/main/java";
53 private static final String RICE_DIRECTORY =
54 "C:/svn/rice/rice-release-1-0-2-1-br/api/src/main/java";
55 private static final String TEST_SOURCE_DIRECTORY =
56 "src/test/java/org/kuali/student/contract/model/test/source";
57 private static final String TARGET_GENERATED_SOURCES = "target/generated-sources";
58 private static final String RESOURCES_DIRECTORY =
59 // "C:/svn/student/ks-core/ks-core-api/src/main/java";
60 "src/main/resources";
61 private static final String PESC_CORE_MAIN = RESOURCES_DIRECTORY
62 + "/CoreMain_v1.8.0.xsd";
63
64 public KSDictionaryCreatorMojoTest() {
65 }
66
67 @BeforeClass
68 public static void setUpClass() throws Exception {
69 }
70
71 @AfterClass
72 public static void tearDownClass() throws Exception {
73 }
74
75 @Before
76 public void setUp() {
77 }
78
79 @After
80 public void tearDown() {
81 }
82
83 /**
84 * Test of execute method, of class KSDictionaryCreatorMojo.
85 */
86 @Test
87 public void testExecute() throws Exception {
88 log.info("execute");
89 List<String> srcDirs = new ArrayList<String>();
90 srcDirs.add(TEST_SOURCE_DIRECTORY);
91 // srcDirs.add(ENROLL_PROJECT_JAVA_DIRECTORY);
92
93 // srcDirs.add(CORE_DIRECTORY);
94 // srcDirs.add(COMMON_DIRECTORY);
95 // srcDirs.add(LUM_DIRECTORY);
96 KSDictionaryCreatorMojo instance = new KSDictionaryCreatorMojo();
97 Map pluginContext = new HashMap ();
98 MavenProject project = new MavenProject ();
99 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 }