1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.contract.model.impl; |
17 |
|
|
18 |
|
import java.io.File; |
19 |
|
import java.util.ArrayList; |
20 |
|
import java.util.Collection; |
21 |
|
import java.util.Date; |
22 |
|
import java.util.HashMap; |
23 |
|
import java.util.HashSet; |
24 |
|
import java.util.List; |
25 |
|
import java.util.Map; |
26 |
|
import java.util.Set; |
27 |
|
import org.junit.After; |
28 |
|
import org.junit.AfterClass; |
29 |
|
import org.junit.Before; |
30 |
|
import org.junit.BeforeClass; |
31 |
|
import org.junit.Test; |
32 |
|
import static org.junit.Assert.*; |
33 |
|
|
34 |
|
import org.kuali.student.contract.model.MessageStructure; |
35 |
|
import org.kuali.student.contract.model.Service; |
36 |
|
import org.kuali.student.contract.model.ServiceContractModel; |
37 |
|
import org.kuali.student.contract.model.ServiceMethod; |
38 |
|
import org.kuali.student.contract.model.ServiceMethodParameter; |
39 |
|
import org.kuali.student.contract.model.XmlType; |
40 |
|
import org.kuali.student.contract.model.util.HtmlContractMessageStructureWriter; |
41 |
|
import org.kuali.student.contract.model.util.ModelFinder; |
42 |
|
import org.kuali.student.contract.model.validation.ServiceContractModelValidator; |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
@author |
47 |
|
|
48 |
|
|
|
|
| 0% |
Uncovered Elements: 631 (631) |
Complexity: 105 |
Complexity Density: 0.22 |
|
49 |
|
public class R1R2ServiceContractComparisonTest { |
50 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
51 |
0
|
public R1R2ServiceContractComparisonTest() {... |
52 |
|
} |
53 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
54 |
0
|
@BeforeClass... |
55 |
|
public static void setUpClass() throws Exception { |
56 |
|
} |
57 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
58 |
0
|
@AfterClass... |
59 |
|
public static void tearDownClass() throws Exception { |
60 |
|
} |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
|
62 |
0
|
@Before... |
63 |
|
public void setUp() { |
64 |
|
|
65 |
0
|
System.out.println("This section was created by programmatically comparing the message structures."); |
66 |
0
|
System.out.println("Run on: " + new Date()); |
67 |
0
|
System.out.println("See [R1R2ServiceContractComparisonTest.java|https://test.kuali.org/svn/student/tools/maven-kscontractdoc-plugin/trunk/src/test/java/org/kuali/student/contract/model/impl/R1R2ServiceContractComparisonTest.java]"); |
68 |
0
|
System.out.println(""); |
69 |
0
|
System.out.println("*TABLE OF CONTENTS*"); |
70 |
0
|
System.out.println("{toc}"); |
71 |
0
|
System.out.println(""); |
72 |
0
|
System.out.println("h1. Loading models of the contracts from the source code"); |
73 |
0
|
System.out.println("h2. Log from loading model for R1"); |
74 |
0
|
getModel1(); |
75 |
0
|
System.out.println("h2. Log from loading model for R2"); |
76 |
0
|
getModel2(); |
77 |
0
|
getFinder1(); |
78 |
0
|
getFinder2(); |
79 |
0
|
loadKnownObjectRenames(); |
80 |
0
|
loadKnownUnconvertedObjects(); |
81 |
0
|
loadKnownFieldRenames(); |
82 |
0
|
loadKnownFieldIssues(); |
83 |
0
|
loadKnownMethodRenames(); |
84 |
0
|
loadKnownMethodIssues (); |
85 |
|
} |
86 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
87 |
0
|
@After... |
88 |
|
public void tearDown() { |
89 |
|
} |
90 |
|
private static final String RESOURCES_DIRECTORY = "src/test/resources"; |
91 |
|
private static final String TEST_SOURCE_DIRECTORY = |
92 |
|
"src/test/java/org/kuali/student/contract/model/test/source"; |
93 |
|
private static final String ENROLL_PROJECT_SRC_MAIN = "C:/svn/ks-1.3-services/ks-enroll/ks-enroll-api/src/main"; |
94 |
|
private static final String ENROLL_PROJECT_JAVA_DIRECTORY = ENROLL_PROJECT_SRC_MAIN + "/java"; |
95 |
|
private static final String RICE_CORE_API_DIRECTORY = "C:/svn/rice/trunk/core/api/src/main/java"; |
96 |
|
private static final String RICE_KIM_API_DIRECTORY = "C:/svn/rice/trunk/kim/kim-api/src/main/java"; |
97 |
|
private static final String RICE_LOCATION_API_DIRECTORY = "C:/svn/rice/trunk/location/api/src/main/java"; |
98 |
|
private static final String RICE_KEW_API_DIRECTORY = "C:/svn/rice/trunk/kew/api/src/main/java"; |
99 |
|
private static final String RICE_KEN_API_DIRECTORY = "C:/svn/rice/trunk/ken/api/src/main/java"; |
100 |
|
private static final String RICE_KSB_API_DIRECTORY = "C:/svn/rice/trunk/ksb/api/src/main/java"; |
101 |
|
private static final String RICE_KRMS_API_DIRECTORY = "C:/svn/rice/trunk/krms/api/src/main/java"; |
102 |
|
private static final String R1_PROJECT_DIRECTORY = "C:/svn/student/"; |
103 |
|
private static final String CORE_API_DIRECTORY = R1_PROJECT_DIRECTORY + "ks-core/ks-core-api/src/main/java"; |
104 |
|
private static final String COMMON_API_DIRECTORY = R1_PROJECT_DIRECTORY + "ks-common/ks-common-api/src/main/java"; |
105 |
|
private static final String LUM_API_DIRECTORY = R1_PROJECT_DIRECTORY + "ks-lum/ks-lum-api/src/main/java"; |
106 |
|
private static ServiceContractModel model1 = null; |
107 |
|
private static ServiceContractModel model2 = null; |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
4
-
|
|
112 |
0
|
@Test... |
113 |
|
public void testCompareModels() { |
114 |
0
|
System.out.println(""); |
115 |
0
|
System.out.println("h1. Message Structure Comparison"); |
116 |
0
|
compareTypes(); |
117 |
0
|
System.out.println(""); |
118 |
0
|
System.out.println("h1. Service Method Comparison"); |
119 |
0
|
compareMethods(); |
120 |
|
} |
121 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 2 |
Complexity Density: 0.11 |
|
122 |
0
|
private ServiceContractModel getModel1() {... |
123 |
0
|
if (model1 != null) { |
124 |
0
|
return model1; |
125 |
|
} |
126 |
0
|
List<String> srcDirs = new ArrayList(); |
127 |
0
|
System.out.println("User directory=" + System.getProperty("user.dir")); |
128 |
0
|
System.out.println("Current directory=" + new File(".").getAbsolutePath()); |
129 |
0
|
srcDirs.add(COMMON_API_DIRECTORY); |
130 |
0
|
srcDirs.add(CORE_API_DIRECTORY); |
131 |
0
|
srcDirs.add(LUM_API_DIRECTORY); |
132 |
0
|
System.out.println ("Reading as input:"); |
133 |
0
|
for (String directory : srcDirs) { |
134 |
0
|
System.out.println ("* " + directory); |
135 |
|
} |
136 |
0
|
System.out.println (""); |
137 |
0
|
boolean validateKualiStudent = false; |
138 |
0
|
ServiceContractModel instance = new ServiceContractModelQDoxLoader(srcDirs, validateKualiStudent); |
139 |
|
|
140 |
0
|
instance = new ServiceContractModelCache(instance); |
141 |
0
|
validate(instance); |
142 |
0
|
model1 = instance; |
143 |
0
|
return instance; |
144 |
|
} |
145 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 2 |
Complexity Density: 0.12 |
|
146 |
0
|
private ServiceContractModel getModel2() {... |
147 |
0
|
if (model2 != null) { |
148 |
0
|
return model2; |
149 |
|
} |
150 |
0
|
List<String> srcDirs = new ArrayList(); |
151 |
0
|
System.out.println("User directory=" + System.getProperty("user.dir")); |
152 |
0
|
System.out.println("Current directory=" + new File(".").getAbsolutePath()); |
153 |
0
|
srcDirs.add(ENROLL_PROJECT_JAVA_DIRECTORY); |
154 |
0
|
System.out.println ("Reading as input:"); |
155 |
0
|
for (String directory : srcDirs) { |
156 |
0
|
System.out.println ("* " + directory); |
157 |
|
} |
158 |
0
|
System.out.println (""); |
159 |
0
|
boolean validateKualiStudent = true; |
160 |
0
|
ServiceContractModel instance = new ServiceContractModelQDoxLoader(srcDirs, validateKualiStudent); |
161 |
|
|
162 |
0
|
instance = new ServiceContractModelCache(instance); |
163 |
0
|
validate(instance); |
164 |
0
|
model2 = instance; |
165 |
0
|
return instance; |
166 |
|
} |
167 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
|
168 |
0
|
private String dump(ServiceMethod method) {... |
169 |
0
|
StringBuilder bldr = new StringBuilder(); |
170 |
0
|
bldr.append(method.getName()); |
171 |
0
|
String comma = ""; |
172 |
0
|
bldr.append("("); |
173 |
0
|
for (ServiceMethodParameter param : method.getParameters()) { |
174 |
0
|
bldr.append(comma); |
175 |
0
|
comma = ", "; |
176 |
0
|
bldr.append(param.getType()); |
177 |
0
|
bldr.append(" "); |
178 |
0
|
bldr.append(param.getName()); |
179 |
|
} |
180 |
0
|
bldr.append(")"); |
181 |
0
|
return bldr.toString(); |
182 |
|
} |
183 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
184 |
0
|
private void validate(ServiceContractModel model) {... |
185 |
0
|
Collection<String> errors = |
186 |
|
new ServiceContractModelValidator(model).validate(); |
187 |
0
|
if (errors.size() > 0) { |
188 |
0
|
StringBuilder buf = new StringBuilder(); |
189 |
0
|
buf.append(errors.size()).append(" errors found while validating the data."); |
190 |
0
|
int cnt = 0; |
191 |
0
|
for (String msg : errors) { |
192 |
0
|
cnt++; |
193 |
0
|
buf.append("\n"); |
194 |
0
|
buf.append("*error*").append(cnt).append(":").append(msg); |
195 |
|
} |
196 |
|
|
197 |
0
|
fail(buf.toString()); |
198 |
|
} |
199 |
|
} |
200 |
|
private ModelFinder finder1 = null; |
201 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
202 |
0
|
private ModelFinder getFinder1() {... |
203 |
0
|
if (finder1 == null) { |
204 |
0
|
finder1 = new ModelFinder(getModel1()); |
205 |
|
} |
206 |
0
|
return finder1; |
207 |
|
} |
208 |
|
private ModelFinder finder2 = null; |
209 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
210 |
0
|
private ModelFinder getFinder2() {... |
211 |
0
|
if (finder2 == null) { |
212 |
0
|
finder2 = new ModelFinder(getModel2()); |
213 |
|
} |
214 |
0
|
return finder2; |
215 |
|
} |
216 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
217 |
0
|
private void compareTypes() {... |
218 |
0
|
for (Service service : model1.getServices()) { |
219 |
0
|
System.out.println(""); |
220 |
0
|
System.out.println("h2. " + service.getName() + " Structures"); |
221 |
0
|
for (XmlType type : finder1.findAllComplexTypesInService(service.getKey())) { |
222 |
0
|
findCompareType(type); |
223 |
|
} |
224 |
|
} |
225 |
|
} |
226 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
227 |
0
|
private String calcService(XmlType xmlType) {... |
228 |
0
|
StringBuilder bldr = new StringBuilder(); |
229 |
0
|
String comma = ""; |
230 |
0
|
for (String serviceKey : HtmlContractMessageStructureWriter.calcUsageByService(model1, xmlType)) { |
231 |
0
|
bldr.append(comma); |
232 |
0
|
comma = ", "; |
233 |
0
|
bldr.append(serviceKey); |
234 |
|
} |
235 |
0
|
return bldr.toString(); |
236 |
|
} |
237 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
238 |
0
|
private String calcFieldNames(XmlType xmlType) {... |
239 |
0
|
StringBuilder bldr = new StringBuilder(); |
240 |
0
|
String comma = ""; |
241 |
0
|
for (MessageStructure ms : finder2.findMessageStructures(xmlType.getName())) { |
242 |
0
|
bldr.append(comma); |
243 |
0
|
comma = ", "; |
244 |
0
|
bldr.append(ms.getShortName()); |
245 |
|
} |
246 |
0
|
return bldr.toString(); |
247 |
|
} |
248 |
|
private Map<String, String> knownUnconvertedObjects = null; |
249 |
|
|
|
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 1 |
Complexity Density: 0.03 |
|
250 |
0
|
private void loadKnownUnconvertedObjects() {... |
251 |
0
|
Map<String, String> missings = new HashMap<String, String>(); |
252 |
0
|
missings.put("ObjectStructureDefinition", "Old R1 dictionary not converted"); |
253 |
0
|
missings.put("FieldDefinition", "Old R1 dictionary not converted"); |
254 |
0
|
missings.put("ValidCharsConstraint", "Old R1 dictionary not converted"); |
255 |
0
|
missings.put("RequiredConstraint", "Old R1 dictionary not converted"); |
256 |
0
|
missings.put("CaseConstraint", "Old R1 dictionary not converted"); |
257 |
0
|
missings.put("WhenConstraint", "Old R1 dictionary not converted"); |
258 |
0
|
missings.put("Constraint", "Old R1 dictionary not converted"); |
259 |
0
|
missings.put("MustOccurConstraint", "Old R1 dictionary not converted"); |
260 |
0
|
missings.put("LookupConstraint", "Old R1 dictionary not converted"); |
261 |
0
|
missings.put("CommonLookupParam", "Old R1 dictionary not converted"); |
262 |
0
|
missings.put("CommonLookup", "Old R1 dictionary not converted"); |
263 |
0
|
missings.put("DateRangeInfo", "DateRange was merged in with Milestone"); |
264 |
0
|
missings.put("CredentialInfo", "LRC was revamped and Class II like objects were dropped"); |
265 |
0
|
missings.put("CreditInfo", "LRC was revamped and Class II like objects were dropped"); |
266 |
0
|
missings.put("ScaleInfo", "Changed to be ResultScaleInfo"); |
267 |
0
|
missings.put("GradeInfo", "LRC was revamped and Class II like objects were dropped"); |
268 |
0
|
missings.put("ResultComponentInfo", "Changed to be ResultValuesGroupInfo"); |
269 |
0
|
missings.put("QueryParamInfo", "Is really a type object that holds typing info information about a parameter model as TypeInfo and use type-type relation to connnect it to search criteria"); |
270 |
0
|
missings.put("FieldDescriptor", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
271 |
0
|
missings.put("SearchSelector", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
272 |
0
|
missings.put("ObjectStructure", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
273 |
0
|
missings.put("Type", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
274 |
0
|
missings.put("State", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
275 |
0
|
missings.put("Field", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
276 |
0
|
missings.put("ConstraintDescriptor", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
277 |
0
|
missings.put("ConstraintSelector", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
278 |
0
|
missings.put("RequireConstraint", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
279 |
0
|
missings.put("TypeStateCaseConstraint", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
280 |
0
|
missings.put("TypeStateWhenConstraint", "Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
281 |
0
|
missings.put("OccursConstraint", " Old pre-R1 dictionary structure that were attached to search param types were dropped -- ui dictionary provided that info"); |
282 |
0
|
missings.put("ResultColumnInfo", " is really a type that describes the type of result that comes back, store as a TypeInfo object and use type-type relation to connect to result"); |
283 |
|
|
284 |
0
|
missings.put("java.lang.String", ""); |
285 |
0
|
missings.put("Map<String, String>", ""); |
286 |
0
|
missings.put("LuiInfo", "Lui was pulled out and put in it's own service. The LuiInfo object was not used in R1 and was radically redesigned in R2"); |
287 |
|
|
288 |
0
|
knownUnconvertedObjects = missings; |
289 |
0
|
return; |
290 |
|
} |
291 |
|
private Map<String, String> knownObjectRenames = null; |
292 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
293 |
0
|
private void loadKnownObjectRenames() {... |
294 |
0
|
Map<String, String> renames = new HashMap<String, String>(); |
295 |
0
|
renames.put("Message", "MessageInfo"); |
296 |
0
|
renames.put("SearchRequest", "SearchRequestInfo"); |
297 |
0
|
renames.put("SearchResult", "SearchResultInfo"); |
298 |
0
|
renames.put("SearchParam", "SearchParamInfo"); |
299 |
0
|
renames.put("SearchResultRow", "SearchResultRowInfo"); |
300 |
0
|
renames.put("SearchResultCell", "SearchResultCellInfo"); |
301 |
0
|
renames.put("Message", "MessageInfo"); |
302 |
0
|
knownObjectRenames = renames; |
303 |
0
|
return; |
304 |
|
} |
305 |
|
private Map<String, String> knownFieldRenames = null; |
306 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 1 |
Complexity Density: 0.04 |
|
307 |
0
|
private void loadKnownFieldRenames() {... |
308 |
0
|
Map<String, String> renames = new HashMap<String, String>(); |
309 |
0
|
renames.put("id", "key"); |
310 |
0
|
renames.put("desc", "descr"); |
311 |
0
|
renames.put("state", "stateKey"); |
312 |
0
|
renames.put("type", "typeKey"); |
313 |
0
|
renames.put("metaInfo", "meta"); |
314 |
0
|
renames.put("desc", "descr"); |
315 |
0
|
renames.put("startTerm", "startTermId"); |
316 |
0
|
renames.put("endTerm", "endTermId"); |
317 |
0
|
renames.put("longDesc", "longDescr"); |
318 |
0
|
renames.put("shortDesc", "shortDescr"); |
319 |
0
|
renames.put("objectTypeURI", "refObjectUri"); |
320 |
|
|
321 |
0
|
renames.put("detailDesc", "descr"); |
322 |
0
|
renames.put("milestoneDate", "startDate"); |
323 |
0
|
renames.put("success", "isSuccess"); |
324 |
0
|
renames.put("relationType", "relationTypeKey"); |
325 |
0
|
renames.put("unitType", "unitTypeKey"); |
326 |
0
|
renames.put("enrollable", "isEnrollable"); |
327 |
0
|
renames.put("hazardousForDisabledStudents", "isHazardousForDisabledStudents"); |
328 |
0
|
renames.put("versionInfo", "version"); |
329 |
0
|
renames.put("primary", "isPrimary"); |
330 |
0
|
renames.put("activityType", "typeKey"); |
331 |
0
|
renames.put("loRepository", "loRepositoryKey"); |
332 |
0
|
renames.put("queryParamValueList", "queryParamValues"); |
333 |
0
|
renames.put("credentialProgramType", "typeKey"); |
334 |
0
|
knownFieldRenames = renames; |
335 |
0
|
return; |
336 |
|
} |
337 |
|
private Map<String, String> knownFieldIssues = null; |
338 |
|
|
|
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 1 |
Complexity Density: 0.03 |
|
339 |
0
|
private void loadKnownFieldIssues() {... |
340 |
0
|
Map<String, String> issues = new HashMap<String, String>(); |
341 |
0
|
issues.put("AtpInfo.key", "Switched from key to Id"); |
342 |
0
|
issues.put("MilestoneInfo.key", "Switched from key to Id"); |
343 |
0
|
issues.put("AtpInfo.id", ""); |
344 |
0
|
issues.put("MilestoneInfo.id", ""); |
345 |
0
|
issues.put("MilestoneInfo.atpId", "Is not in R2 because a Milestone can be connected to more than one ATP so it is managed through a relationship"); |
346 |
0
|
issues.put("Message.locale", "the type was changed from String to LocaleInfo to hold the different parts of the locale info"); |
347 |
0
|
issues.put("SearchRequest.params", ""); |
348 |
0
|
issues.put("SearchResult.rows", ""); |
349 |
0
|
issues.put("SearchResultRow.cells", ""); |
350 |
0
|
issues.put("ValidationResultInfo.errorLevel", ""); |
351 |
0
|
issues.put("ValidationResultInfo.level", ""); |
352 |
0
|
issues.put("ValidationResultInfo.ok", ""); |
353 |
0
|
issues.put("ValidationResultInfo.warn", ""); |
354 |
0
|
issues.put("ValidationResultInfo.error", ""); |
355 |
0
|
issues.put("DocumentInfo.documentBinaryInfo", "renamd to just documentBinary (removing the trailing Info from the field name)"); |
356 |
0
|
issues.put("OrgHierarchyInfo.key", "Switched from key to Id"); |
357 |
0
|
issues.put("SearchResultTypeInfo.resultColumns", "ResultColumns is really anotther type to describe the column, Use type-type relation to hold that info"); |
358 |
0
|
issues.put("ReqCompFieldTypeInfo.fieldDescriptor", "was dropped because it was an Old Pre-R1 dictionary and was not used -- UI dictionary provides that info instead"); |
359 |
0
|
issues.put("LuTypeInfo.instructionalFormat", "Instructional format is a TypeInfo object and should be modeled as such using the type-type relation to connect it to a learning unit type"); |
360 |
0
|
issues.put("LuTypeInfo.deliveryMethod", "Delivery method is a TypeInfo object and should be modeled as such using type-type relation to connect it to a learning unit type"); |
361 |
0
|
issues.put("SearchCriteriaTypeInfo.queryParams", "Query Params is a TypeInfo that describes the parameter, model as type and type-type relation"); |
362 |
0
|
issues.put("OrgOrgRelationTypeInfo.orgHierarchyKey", "This was removed because a particular relation type can participate in more than one hierarchies!"); |
363 |
0
|
issues.put("SearchParam.value", "Renamed to values which is List<String>, in R1 the setValue method was overloaded to take a string or List, Kept in R2 but marked as deprecated"); |
364 |
0
|
issues.put("", ""); |
365 |
0
|
issues.put("", ""); |
366 |
0
|
issues.put("", ""); |
367 |
0
|
issues.put("", ""); |
368 |
0
|
issues.put("", ""); |
369 |
0
|
issues.put("", ""); |
370 |
0
|
issues.put("", ""); |
371 |
0
|
issues.put("", ""); |
372 |
0
|
issues.put("", ""); |
373 |
0
|
issues.put("", ""); |
374 |
|
|
375 |
0
|
knownFieldIssues = issues; |
376 |
0
|
return; |
377 |
|
} |
378 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 6 |
Complexity Density: 0.43 |
|
379 |
0
|
private XmlType findType(XmlType r1) {... |
380 |
0
|
XmlType r2 = finder2.findXmlType(r1.getName()); |
381 |
0
|
if (r2 == null) { |
382 |
0
|
String renamedName = this.knownObjectRenames.get(r1.getName()); |
383 |
0
|
if (renamedName != null) { |
384 |
0
|
r2 = finder2.findXmlType(renamedName); |
385 |
0
|
if (r2 == null) { |
386 |
0
|
System.out.println("# (-) " + r1.getName() + ": was not found even after being renamed to " + renamedName); |
387 |
0
|
return null; |
388 |
|
} |
389 |
0
|
System.out.println("# (/) " + r1.getName() + ": was renamed to " + renamedName); |
390 |
0
|
return r2; |
391 |
|
} |
392 |
|
} |
393 |
0
|
if (r2 == null) { |
394 |
0
|
if (r1.getName().endsWith("TypeInfo")) { |
395 |
0
|
r2 = finder2.findXmlType("TypeInfo"); |
396 |
|
} |
397 |
|
} |
398 |
0
|
return r2; |
399 |
|
} |
400 |
|
|
|
|
| 0% |
Uncovered Elements: 45 (45) |
Complexity: 10 |
Complexity Density: 0.37 |
|
401 |
0
|
private void findCompareType(XmlType r1) {... |
402 |
0
|
if (r1.getName().endsWith("List")) { |
403 |
0
|
return; |
404 |
|
} |
405 |
0
|
if (this.knownUnconvertedObjects.containsKey(r1.getName())) { |
406 |
0
|
String message = this.knownUnconvertedObjects.get(r1.getName()); |
407 |
0
|
if (message.isEmpty()) { |
408 |
0
|
return; |
409 |
|
} |
410 |
0
|
System.out.println("# (/) " + r1.getName() + ":" + message); |
411 |
0
|
return; |
412 |
|
} |
413 |
0
|
XmlType r2 = findType(r1); |
414 |
0
|
if (r2 == null) { |
415 |
0
|
System.out.println("# " + r1.getName() + ": has no corresponding object in r2"); |
416 |
0
|
return; |
417 |
|
} |
418 |
0
|
Set<MessageStructure> usedInR2 = new HashSet<MessageStructure>(); |
419 |
0
|
for (MessageStructure ms : finder1.findMessageStructures(r1.getName())) { |
420 |
0
|
MessageStructure used = findCompareMessageStructure(ms, r2); |
421 |
0
|
if (used != null) { |
422 |
0
|
usedInR2.add(used); |
423 |
|
} |
424 |
|
} |
425 |
|
|
426 |
0
|
if (!r2.getName().equals("TypeInfo")) { |
427 |
0
|
for (MessageStructure ms : finder2.findMessageStructures(r2.getName())) { |
428 |
0
|
if (usedInR2.contains(ms)) { |
429 |
0
|
continue; |
430 |
|
} |
431 |
0
|
String issue = this.knownFieldIssues.get(ms.getXmlObject() + "." + ms.getShortName()); |
432 |
0
|
if (issue != null) { |
433 |
0
|
if (!issue.isEmpty()) { |
434 |
0
|
System.out.println("# (*g) " + ms.getXmlObject() + "." + ms.getShortName() + ": " + issue); |
435 |
|
} |
436 |
0
|
continue; |
437 |
|
} |
438 |
0
|
System.out.println("# (+) " + ms.getXmlObject() + "." + ms.getShortName() + " - new field added in R2"); |
439 |
|
} |
440 |
|
} |
441 |
|
} |
442 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 9 |
Complexity Density: 0.53 |
|
443 |
0
|
private MessageStructure findCompareMessageStructure(MessageStructure r1, XmlType xmlType2) {... |
444 |
0
|
MessageStructure r2 = findMessageStructure(r1, xmlType2); |
445 |
0
|
String issue = this.knownFieldIssues.get(r1.getXmlObject() + "." + r1.getShortName()); |
446 |
0
|
if (issue != null) { |
447 |
0
|
if (!issue.isEmpty()) { |
448 |
0
|
System.out.println("# (*g) " + r1.getXmlObject() + "." + r1.getShortName() + ": " + issue); |
449 |
|
} |
450 |
0
|
return r2; |
451 |
|
} |
452 |
0
|
if (r2 == null) { |
453 |
0
|
if (xmlType2.getName().equals("TypeInfo")) { |
454 |
0
|
if (r1.getShortName().endsWith("Type") |
455 |
|
|| r1.getShortName().endsWith("TypeInfo") |
456 |
|
|| r1.getShortName().endsWith("Types") |
457 |
|
|| r1.getShortName().endsWith("TypeInfos")) { |
458 |
0
|
System.out.println("# (*g) " + r1.getXmlObject() + "." + r1.getShortName() + " was a type stored on a type: use type-type relationship instead"); |
459 |
0
|
return null; |
460 |
|
} |
461 |
0
|
System.out.println("# (!) " + r1.getXmlObject() + "." + r1.getShortName() + " was extra data on type, store in dynamic attribute if actually used"); |
462 |
0
|
return null; |
463 |
|
} |
464 |
0
|
System.out.println("# (-) " + r1.getXmlObject() + "." + r1.getShortName() + " not found in r2: renamed to one of these? " + calcFieldNames(xmlType2)); |
465 |
0
|
return null; |
466 |
|
} |
467 |
0
|
compareType(r1, r2); |
468 |
0
|
return r2; |
469 |
|
} |
470 |
|
|
|
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 9 |
Complexity Density: 0.75 |
|
471 |
0
|
private void compareType(MessageStructure r1, MessageStructure r2) {... |
472 |
0
|
if (r1.getType().equalsIgnoreCase(r2.getType())) { |
473 |
0
|
return; |
474 |
|
} |
475 |
0
|
if (r1.getShortName().equals("attributes")) { |
476 |
0
|
if (r1.getType().equals("Map<String, String>")) { |
477 |
0
|
if (r2.getType().equals("AttributeInfoList")) { |
478 |
0
|
return; |
479 |
|
} |
480 |
|
} |
481 |
|
} |
482 |
0
|
if (r1.getShortName().equals("desc") || r1.getShortName().equals("descr")) { |
483 |
0
|
if (r1.getType().equals("String")) { |
484 |
0
|
if (r2.getType().equals("RichTextInfo")) { |
485 |
0
|
System.out.println("# (*g) " + r1.getXmlObject() + "." + r1.getShortName() + ": description type were changed to RichText, use plain version"); |
486 |
0
|
return; |
487 |
|
} |
488 |
|
} |
489 |
|
} |
490 |
0
|
System.out.println("# (!) " + r1.getXmlObject() + "." + r1.getShortName() + ": the type was changed from " + r1.getType() + " to " + r2.getType()); |
491 |
|
} |
492 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 4 |
Complexity Density: 0.4 |
|
493 |
0
|
private MessageStructure findMessageStructure(MessageStructure r1, XmlType xmlType2) {... |
494 |
0
|
MessageStructure r2 = finder2.findMessageStructure(xmlType2.getName(), r1.getShortName()); |
495 |
0
|
if (r2 == null) { |
496 |
0
|
String renamed = this.knownFieldRenames.get(r1.getShortName()); |
497 |
0
|
if (renamed != null) { |
498 |
0
|
r2 = finder2.findMessageStructure(xmlType2.getName(), renamed); |
499 |
0
|
if (r2 == null) { |
500 |
0
|
System.out.println("# (-) " + r1.getXmlObject() + "." + r1.getShortName() |
501 |
|
+ " was renamed to " + xmlType2.getName() + "." + renamed |
502 |
|
+ " BUT IT STILL DIDN'T EXIST IN R2"); |
503 |
0
|
return null; |
504 |
|
} |
505 |
0
|
System.out.println("# (*g) " + r1.getXmlObject() + "." + r1.getShortName() |
506 |
|
+ " was renamed to " + xmlType2.getName() + "." + renamed); |
507 |
|
} |
508 |
|
} |
509 |
0
|
return r2; |
510 |
|
} |
511 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
512 |
0
|
private void compareMethods() {... |
513 |
0
|
for (Service service : model1.getServices()) { |
514 |
0
|
System.out.println(""); |
515 |
0
|
System.out.println("h2. " + service.getName() + " Methods"); |
516 |
0
|
List<ServiceMethod> methodsInService = finder1.findServiceMethods(service.getKey()); |
517 |
0
|
for (ServiceMethod method : methodsInService) { |
518 |
0
|
findCompareMethod(method); |
519 |
|
} |
520 |
|
} |
521 |
|
} |
522 |
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 7 |
Complexity Density: 0.41 |
|
523 |
0
|
private void findCompareMethod(ServiceMethod method1) {... |
524 |
0
|
String issue = knownMethodIssues.get (method1.getService() + "Service." + method1.getName()); |
525 |
0
|
if (issue != null) { |
526 |
0
|
if (!issue.isEmpty()) { |
527 |
0
|
System.out.println("# (*g) " + method1.getService() + "Service." + method1.getName() |
528 |
|
+ ": " + issue); |
529 |
|
} |
530 |
0
|
return; |
531 |
|
} |
532 |
0
|
ServiceMethod method2 = findMethod(method1); |
533 |
0
|
if (method2 == null) { |
534 |
|
|
535 |
0
|
if (isTypeMethod(method1)) { |
536 |
0
|
System.out.println("# (*g) " + method1.getService() + "Service." + method1.getName() |
537 |
|
+ " was dropped because it is a type, use TypeService instead"); |
538 |
0
|
return; |
539 |
|
} |
540 |
0
|
String possibleMethods = this.calcPossibleMethods(method1); |
541 |
0
|
if (possibleMethods.isEmpty()) { |
542 |
0
|
System.out.println("# (-) " + method1.getService() + "Service." + method1.getName() |
543 |
|
+ " could not be found in R2"); |
544 |
|
} else { |
545 |
0
|
System.out.println("# (!) " + method1.getService() + "Service." + method1.getName() |
546 |
|
+ " might have been renamed to one of these: " |
547 |
|
+ possibleMethods); |
548 |
|
} |
549 |
0
|
return; |
550 |
|
} |
551 |
0
|
if (!method1.getName().equals(method2.getName())) { |
552 |
0
|
System.out.println("# (*g) " + method1.getService() + "Service." + method1.getName() |
553 |
|
+ " was renamed to " + method2.getService() + "Service." + method2.getName()); |
554 |
|
} |
555 |
|
} |
556 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
557 |
0
|
private ServiceMethod findMethod(ServiceMethod method1) {... |
558 |
0
|
ServiceMethod method2 = findMethod2(method1.getService(), method1.getName()); |
559 |
0
|
if (method2 == null) { |
560 |
0
|
String methodRename = knownMethodRenames.get(method1.getService() + "Service." + method1.getName()); |
561 |
0
|
if (methodRename != null) { |
562 |
0
|
method2 = findMethod2(method1.getService(), methodRename); |
563 |
0
|
if (method2 == null) { |
564 |
0
|
System.out.println("# (x) " + method1.getService() + "Service." + method1.getName() |
565 |
|
+ " could not be found even after being renamed to " + methodRename); |
566 |
0
|
return null; |
567 |
|
} |
568 |
|
} |
569 |
|
} |
570 |
0
|
return method2; |
571 |
|
} |
572 |
|
private Map<String, String> knownMethodRenames = null; |
573 |
|
|
|
|
| 0% |
Uncovered Elements: 51 (51) |
Complexity: 1 |
Complexity Density: 0.02 |
|
574 |
0
|
private void loadKnownMethodRenames() {... |
575 |
0
|
Map<String, String> renames = new HashMap<String, String>(); |
576 |
0
|
renames.put("AtpService.getAtpsByAtpType", "getAtpIdsByType"); |
577 |
0
|
renames.put("AtpService.getMilestonesByAtp", "getMilestonesForAtp"); |
578 |
0
|
renames.put("AtpService.addMilestone", "addMilestoneToAtp"); |
579 |
0
|
renames.put("AtpService.removeMilestone", "removeMilestoneFromAtp"); |
580 |
0
|
renames.put("MessageService.getMessageGroups", "getMessageGroupKeys"); |
581 |
0
|
renames.put("CommentService.getComments", "getCommentsByReferenceAndType"); |
582 |
0
|
renames.put("CommentService.getTags", "getTagsByReferenceAndType"); |
583 |
0
|
renames.put("CommentService.addTag", "createTag"); |
584 |
0
|
renames.put("CommentService.addComment", "createComment"); |
585 |
0
|
renames.put("CommentService.removeComment", "deleteComment"); |
586 |
0
|
renames.put("CommentService.removeTag", "deleteTag"); |
587 |
0
|
renames.put("CommentService.removeComments", "deleteCommentsByReference"); |
588 |
0
|
renames.put("CommentService.removeTags", "deleteTagsByReference"); |
589 |
0
|
renames.put("DocumentService.getDocumentsByIdList", "getDocumentsByIds"); |
590 |
0
|
renames.put("DocumentService.getCategoriesByDocument", "getDocumentCategoriesByDocumentId"); |
591 |
0
|
renames.put("DocumentService.getRefDocRelationsByDoc", "getRefDocRelationsByDocument"); |
592 |
0
|
renames.put("EnumerationManagementService.removeEnumeratedValue", "deleteEnumeratedValue"); |
593 |
0
|
renames.put("OrganizationService.getOrganization", "getOrg"); |
594 |
0
|
renames.put("OrganizationService.getOrganizationsByIdList", "getOrgsByIds"); |
595 |
0
|
renames.put("OrganizationService.getOrgOrgRelationsByIdList", "getOrgOrgRelationsByIds"); |
596 |
0
|
renames.put("OrganizationService.getOrgPersonRelationsByIdList", "getOrgPersonRelationsByIds"); |
597 |
0
|
renames.put("OrganizationService.getPersonIdsForOrgByRelationType", ""); |
598 |
0
|
renames.put("OrganizationService.getAllOrgPersonRelationsByPerson", "getOrgPersonRelationsByPerson"); |
599 |
0
|
renames.put("OrganizationService.getAllOrgPersonRelationsByOrg", "getOrgPersonRelationsByOrg"); |
600 |
0
|
renames.put("OrganizationService.createOrganization", "createOrg"); |
601 |
0
|
renames.put("OrganizationService.updateOrganization", "updateOrg"); |
602 |
0
|
renames.put("OrganizationService.deleteOrganization", "deleteOrg"); |
603 |
0
|
renames.put("OrganizationService.validateOrganization", "validateOrg"); |
604 |
0
|
renames.put("OrganizationService.removeOrgOrgRelation", "deleteOrgOrgRelation"); |
605 |
0
|
renames.put("OrganizationService.removeOrgPersonRelation", "deleteOrgPersonRelation"); |
606 |
0
|
renames.put("OrganizationService.addPositionRestrictionToOrg", "createOrgPositionRestriction"); |
607 |
0
|
renames.put("OrganizationService.updatePositionRestrictionForOrg", "updateOrgPositionRestriction"); |
608 |
0
|
renames.put("OrganizationService.removePositionRestrictionFromOrg", "deleteOrgPositionRestriction"); |
609 |
0
|
renames.put("StatementService.getStatementsUsingReqComponent", "getStatementsByReqComponent"); |
610 |
0
|
renames.put("StatementService.getStatementsUsingStatement", "getStatementsForStatement"); |
611 |
0
|
renames.put("CourseService.getCourseFormats", "getCourseFormatsByCourse"); |
612 |
0
|
renames.put("CourseService.getCourseActivities", "getCourseActivitiesByCourseFormat"); |
613 |
0
|
renames.put("CourseService.getCourseLos", "getCourseLearningObjectivesByCourse"); |
614 |
0
|
renames.put("LearningObjectiveService.getLoCategories", "getLoCategoriesByLoRepository"); |
615 |
0
|
renames.put("LearningObjectiveService.getLoByIdList", "getLosByIds"); |
616 |
0
|
renames.put("LearningObjectiveService.getLosByRepository", "getLosByLoRepository"); |
617 |
0
|
renames.put("LearningObjectiveService.getLoCategoriesForLo", "getLoCategoriesByLo"); |
618 |
0
|
renames.put("LrcService.getResultComponent", "getResultValuesGroup"); |
619 |
0
|
renames.put("", ""); |
620 |
0
|
renames.put("", ""); |
621 |
0
|
renames.put("", ""); |
622 |
0
|
renames.put("", ""); |
623 |
0
|
renames.put("", ""); |
624 |
0
|
knownMethodRenames = renames; |
625 |
0
|
return; |
626 |
|
} |
627 |
|
|
628 |
|
private Map<String, String> knownMethodIssues = null; |
629 |
|
|
|
|
| 0% |
Uncovered Elements: 43 (43) |
Complexity: 1 |
Complexity Density: 0.02 |
|
630 |
0
|
private void loadKnownMethodIssues() {... |
631 |
0
|
Map<String, String> issues = new HashMap<String, String>(); |
632 |
0
|
issues.put("AtpService.validateDateRange", "Dropped because DateRange objects were merged in with milestones"); |
633 |
0
|
issues.put("AtpService.getDateRange", "Dropped because DateRange objects were merged in with milestones"); |
634 |
0
|
issues.put("AtpService.getDateRangesByAtp", "Dropped because DateRange objects were merged in with milestones"); |
635 |
0
|
issues.put("AtpService.getDateRangesByDate", "Dropped because DateRange objects were merged in with milestones"); |
636 |
0
|
issues.put("AtpService.addDateRange", "Dropped because DateRange objects were merged in with milestones"); |
637 |
0
|
issues.put("AtpService.updateDateRange", "Dropped because DateRange objects were merged in with milestones"); |
638 |
0
|
issues.put("AtpService.removeDateRange", "Dropped because DateRange objects were merged in with milestones"); |
639 |
0
|
issues.put("DictionaryService.getObjectTypes", "Dictionary service was completely revamped to match KRAD, old one is still around use that for R1 stuff"); |
640 |
0
|
issues.put("DictionaryService.getObjectStructure", "Dictionary service was completely revamped to match KRAD, old one is still around use that for R1 stuff"); |
641 |
0
|
issues.put("CommentService.getCommentsByType", "Renamed and changed to just get Ids, so use getCommentIdsByType then call getCommentsByIds"); |
642 |
0
|
issues.put("CommentService.getTagsByType", "Renamed and changed to just get Ids, so use getTagIdsByType then call getTagsByIds"); |
643 |
0
|
issues.put("DocumentService.getRefObjectTypes", "Use type service but (!) there is no getRefObjectUris () method"); |
644 |
0
|
issues.put("DocumentService.getRefObjectSubTypes", "Use type service but (!) but do not have a refObject 'subtype' defined"); |
645 |
0
|
issues.put("OrganizationService.getOrgOrgRelationsByRelatedOrg", " (!) the two methods for tranversing by one side of the relationship or other has replaced by a single method that finds relationships no matter which side it is on (?) Need to possibly rethink this it imposes a big change on both the implementation and on the the application. "); |
646 |
0
|
issues.put("OrganizationService.getPersonIdsForOrgByRelationType", "Was removed, instead use getOrgPersonRelationsByTypeAndPerson and loop through the relationships to get the list of personIds that you want. The issue was the old method did not take into account relationships that are old/inactive so using it would lead to errors that would only appear once transitions occured in the people being related to the org."); |
647 |
0
|
issues.put("OrganizationService.getOrgPersonRelationsByPerson", "Renamd to getOrgPersonRelationsByOrgAndPerson, because the R1 was badly named, it said just by person but the parameters required an Org as well!"); |
648 |
0
|
issues.put("OrganizationService.getPositionRestrictionsByOrg", "use getOrgPositionRestrictionIdsByOrg then call getOrgPositionRestrictionsByIds to get the objects"); |
649 |
0
|
issues.put("LearningObjectiveService.getAllowedLoLoRelationTypesForLoType", "is a type method, use Type Service instead"); |
650 |
0
|
issues.put("LrcService.getCredential", "Is a Class 2 concept and as dropped from the Class 1 service"); |
651 |
0
|
issues.put("LrcService.getCredentialsByKeyList", "Is a Class 2 concept and as dropped from the Class 1 service"); |
652 |
0
|
issues.put("LrcService.getCredentialKeysByCredentialType", "Is a Class 2 concept and as dropped from the Class 1 service"); |
653 |
0
|
issues.put("LrcService.getCredit", "Is a Class 2 concept and as dropped from the Class 1 service"); |
654 |
0
|
issues.put("LrcService.getCreditsByKeyList", "Is a Class 2 concept and as dropped from the Class 1 service"); |
655 |
0
|
issues.put("LrcService.getCreditKeysByCreditType", "Is a Class 2 concept and as dropped from the Class 1 service"); |
656 |
0
|
issues.put("LrcService.getGrade", "Is a Class 2 concept and as dropped from the Class 1 service"); |
657 |
0
|
issues.put("LrcService.getGradesByKeyList", "Is a Class 2 concept and as dropped from the Class 1 service"); |
658 |
0
|
issues.put("LrcService.getGradeKeysByGradeType", "Is a Class 2 concept and as dropped from the Class 1 service"); |
659 |
0
|
issues.put("LrcService.getGradesByScale", "Is a Class 2 concept and as dropped from the Class 1 service"); |
660 |
0
|
issues.put("LrcService.translateGrade", "(-) is not being supported at this time, translations will be added later"); |
661 |
0
|
issues.put("LrcService.compareGrades", "(-) is not being supported at this time, comparisons will be added later"); |
662 |
0
|
issues.put("LrcService.getResultComponentIdsByResultComponentType", "roughly maps to getResultValuesGroupIdsByType but they are different objects and the types have changed as well"); |
663 |
0
|
issues.put("LrcService.getResultComponentIdsByResult", "roughly maps to getResultValuesGroupsByResultValue but doesn't take the extra type parameter"); |
664 |
0
|
issues.put("LrcService.createResultComponent", "rougly maps to createResultValuesGroup"); |
665 |
0
|
issues.put("LrcService.updateResultComponent", "rougly maps to updateResultValuesGroup"); |
666 |
0
|
issues.put("LrcService.deleteResultComponent", "rougly maps to deleteResultValuesGroup"); |
667 |
0
|
issues.put("LrcService.getScale", "roughly maps to getResultScale"); |
668 |
0
|
issues.put("", ""); |
669 |
0
|
issues.put("", ""); |
670 |
0
|
issues.put("", ""); |
671 |
0
|
issues.put("", ""); |
672 |
0
|
knownMethodIssues = issues; |
673 |
0
|
return; |
674 |
|
} |
675 |
|
|
676 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
677 |
0
|
private ServiceMethod findMethod2(String serviceKey, String methodName) {... |
678 |
0
|
ServiceMethod method2 = finder2.findServiceMethod(serviceKey, methodName); |
679 |
0
|
if (method2 == null) { |
680 |
0
|
if (serviceKey.equals("Lu")) { |
681 |
0
|
method2 = finder2.findServiceMethod("Clu", methodName); |
682 |
0
|
if (method2 == null) { |
683 |
0
|
method2 = finder2.findServiceMethod("Lui", methodName); |
684 |
|
} |
685 |
|
} |
686 |
|
} |
687 |
0
|
return method2; |
688 |
|
} |
689 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
690 |
0
|
private String calcMethods(ServiceMethod method1) {... |
691 |
0
|
StringBuilder bldr = new StringBuilder(); |
692 |
0
|
String comma = ""; |
693 |
0
|
for (ServiceMethod method2 : finder2.findServiceMethods(method1.getService())) { |
694 |
0
|
bldr.append(comma); |
695 |
0
|
comma = ", "; |
696 |
0
|
bldr.append(method2.getName()); |
697 |
|
} |
698 |
0
|
return bldr.toString(); |
699 |
|
} |
700 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
701 |
0
|
private String calcPossibleMethods(ServiceMethod method1) {... |
702 |
0
|
StringBuilder bldr = new StringBuilder(); |
703 |
0
|
String comma = ""; |
704 |
0
|
for (ServiceMethod method2 : findPossibleMethods(method1)) { |
705 |
0
|
bldr.append(comma); |
706 |
0
|
comma = ", "; |
707 |
0
|
bldr.append(method2.getName()); |
708 |
|
} |
709 |
0
|
return bldr.toString(); |
710 |
|
} |
711 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
712 |
0
|
private List<ServiceMethod> findPossibleMethods(ServiceMethod method1) {... |
713 |
0
|
List<ServiceMethod> methods = new ArrayList<ServiceMethod>(); |
714 |
0
|
List<ServiceMethod> wideNet = null; |
715 |
0
|
if (method1.getService().equals("Lu")) { |
716 |
0
|
wideNet = finder2.findServiceMethods("Clu"); |
717 |
0
|
wideNet.addAll(finder2.findServiceMethods("Lui")); |
718 |
|
} else { |
719 |
0
|
wideNet = finder2.findServiceMethods(method1.getService()); |
720 |
|
} |
721 |
0
|
for (ServiceMethod method2 : wideNet) { |
722 |
0
|
if (isPossibleMatch(method1, method2)) { |
723 |
0
|
methods.add(method2); |
724 |
|
} |
725 |
|
} |
726 |
0
|
return methods; |
727 |
|
} |
728 |
|
|
|
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 17 |
Complexity Density: 0.89 |
|
729 |
0
|
private boolean isPossibleMatch(ServiceMethod method1, ServiceMethod method2) {... |
730 |
0
|
if (method1.getName().contains(method2.getName())) { |
731 |
0
|
return true; |
732 |
|
} |
733 |
0
|
if (method2.getName().contains(method1.getName())) { |
734 |
0
|
return true; |
735 |
|
} |
736 |
0
|
if (method1.getName().startsWith("get") && method2.getName().startsWith("get")) { |
737 |
0
|
return true; |
738 |
|
} |
739 |
0
|
if (method1.getName().startsWith("add") && method2.getName().startsWith("create")) { |
740 |
0
|
return true; |
741 |
|
} |
742 |
0
|
if (method1.getName().startsWith("create") && method2.getName().startsWith("create")) { |
743 |
0
|
return true; |
744 |
|
} |
745 |
0
|
if (method1.getName().startsWith("update") && method2.getName().startsWith("update")) { |
746 |
0
|
return true; |
747 |
|
} |
748 |
0
|
if (method1.getName().startsWith("delete") && method2.getName().startsWith("delete")) { |
749 |
0
|
return true; |
750 |
|
} |
751 |
0
|
if (method1.getName().startsWith("remove") && method2.getName().startsWith("delete")) { |
752 |
0
|
return true; |
753 |
|
} |
754 |
0
|
if (method1.getName().startsWith("validate") && method2.getName().startsWith("validate")) { |
755 |
0
|
return true; |
756 |
|
} |
757 |
0
|
return false; |
758 |
|
} |
759 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
760 |
0
|
private boolean isTypeMethod(ServiceMethod method1) {... |
761 |
0
|
if (method1.getReturnValue().getType().endsWith("TypeInfo")) { |
762 |
0
|
return true; |
763 |
|
} |
764 |
0
|
if (method1.getReturnValue().getType().endsWith("TypeInfoList")) { |
765 |
0
|
return true; |
766 |
|
} |
767 |
0
|
return false; |
768 |
|
} |
769 |
|
} |